Documentation
¶
Index ¶
- Constants
- func CheckComplexes[T Complex](t *testing.T, expected []T, actual []T, tolerance float64, checkOrder bool, ...) (bool, string)
- func CheckFloats[T Float](t *testing.T, expected []T, actual []T, tolerance float64, checkOrder bool, ...) (bool, string)
- func CheckNumeric[T Numeric](t *testing.T, expected []T, actual []T, checkOrder bool, assertErr bool) (bool, string)
- func CheckStrings(t *testing.T, expected []string, actual []string, checkOrder bool, ...) (bool, string)
- type Complex
- type Float
- type Numeric
Constants ¶
View Source
const ( ExpectedOrActualBothNotNil = "One of arrays (expected, actual) is nil other is not nil" ArraysLengthAreNotSame = "Arrays length are not same" ItemNotFound = "Expected array item: \"{0}\" at index: \"{1}\" was not found in actual array" )
Variables ¶
This section is empty.
Functions ¶
func CheckComplexes ¶
func CheckComplexes[T Complex](t *testing.T, expected []T, actual []T, tolerance float64, checkOrder bool, assertErr bool) (bool, string)
CheckComplexes
This function allow us to compare two arrays Complex with order and without it with tolerance applying to real and imaginary part independently
* This function could work without assert (see assertErr param)
- Parameters:
- - t is Test State, because we provide functions to check equality in tests
- - expected - one array of complex64
- - actual - another array of complex64
- - tolerance - tolerance between array items, used as math.abs(real(expected) - real(actual)) < tolerance &&
- math.abs(imag(expected) - imag(actual)) < tolerance
- - checkOrder - parameter that is responsible for check data with respect to order of arrays items
- - assertErr - assert if True otherwise just use a result to check whether error occurred or not
- Functions return nothing and asserts if arrays are not equals
- Returns (true, empty str) if there is no assert fail, otherwise - false + reason
func CheckFloats ¶
func CheckFloats[T Float](t *testing.T, expected []T, actual []T, tolerance float64, checkOrder bool, assertErr bool) (bool, string)
CheckFloats
This function allow us to compare two arrays of Float with order and without it with tolerance
* This function could work without assert (see assertErr param)
- Parameters:
- - t is Test State, because we provide functions to check equality in tests
- - expected - one array of float32
- - actual - another array of float32
- - tolerance - tolerance between array items, used as math.abs(expected - actual) < tolerance
- - checkOrder - parameter that is responsible for check data with respect to order of arrays items
- - assertErr - assert if True otherwise just use a result to check whether error occurred or not
- Functions return nothing and asserts if arrays are not equals
- Returns (true, empty str) if there is no assert fail, otherwise - false + reason
func CheckNumeric ¶ added in v1.3.0
func CheckNumeric[T Numeric](t *testing.T, expected []T, actual []T, checkOrder bool, assertErr bool) (bool, string)
CheckNumeric
This function allow us to compare two arrays of Numeric values with order and without it
* This function could work without assert (see assertErr param)
- Parameters:
- - t is Test State, because we provide functions to check equality in tests
- - expected - one array of int
- - actual - another array of int
- - checkOrder - parameter that is responsible for check data with respect to order of arrays items
- - assertErr - assert if True otherwise just use a result to check whether error occurred or not
- Functions return nothing and asserts if arrays are not equals
- Returns (true, empty str) if there is no assert fail, otherwise - false + reason
func CheckStrings ¶
func CheckStrings(t *testing.T, expected []string, actual []string, checkOrder bool, assertErr bool) (bool, string)
CheckStrings
This function allow us to compare two arrays of Strings with order and without it and with asserts (assertErr is true) and without order
* This function could work without assert (see assertErr param)
- Parameters:
- - t is Test State, because we provide functions to check equality in tests
- - expected - one array of strings
- - actual - another array of strings
- - checkOrder - parameter that is responsible for check data with respect to order of arrays items
- - assertErr - assert if True otherwise just use a result to check whether error occurred or not
- Functions return nothing and asserts if arrays are not equals
- Returns (true, empty str) if there is no assert fail, otherwise - false + reason
Types ¶
type Complex ¶ added in v1.3.0
type Complex interface { complex64 | complex128 }
Click to show internal directories.
Click to hide internal directories.