34 lines
627 B
Go
34 lines
627 B
Go
package assert
|
|
|
|
import "reflect"
|
|
|
|
// Equal asserts that the two given values are equal
|
|
func Equal[T comparable](t test, a T, b T) {
|
|
if a == b {
|
|
return
|
|
}
|
|
|
|
t.Errorf(twoValues, file(), "Equal", a, b)
|
|
t.FailNow()
|
|
}
|
|
|
|
// NotEqual asserts that the two given values are not equal
|
|
func NotEqual[T comparable](t test, a T, b T) {
|
|
if a != b {
|
|
return
|
|
}
|
|
|
|
t.Errorf(twoValues, file(), "NotEqual", a, b)
|
|
t.FailNow()
|
|
}
|
|
|
|
// DeepEqual asserts that the two given values are deeply equal
|
|
func DeepEqual[T any](t test, a T, b T) {
|
|
if reflect.DeepEqual(a, b) {
|
|
return
|
|
}
|
|
|
|
t.Errorf(twoValues, file(), "DeepEqual", a, b)
|
|
t.FailNow()
|
|
}
|