Improved code quality
This commit is contained in:
13
Equal.go
13
Equal.go
@ -2,35 +2,34 @@ package assert
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Equal asserts that the two parameters are equal.
|
||||
func Equal[T comparable](t testing.TB, a T, b T) {
|
||||
func Equal[T comparable](t test, a T, b T) {
|
||||
if a == b {
|
||||
return
|
||||
}
|
||||
|
||||
t.Errorf(formatTwoParameters, file(), "Equal", a, b)
|
||||
t.Errorf(twoParameters, file(), "Equal", a, b)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// NotEqual asserts that the two parameters are not equal.
|
||||
func NotEqual[T comparable](t testing.TB, a T, b T) {
|
||||
func NotEqual[T comparable](t test, a T, b T) {
|
||||
if a != b {
|
||||
return
|
||||
}
|
||||
|
||||
t.Errorf(formatTwoParameters, file(), "NotEqual", a, b)
|
||||
t.Errorf(twoParameters, file(), "NotEqual", a, b)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// DeepEqual asserts that the two parameters are deeply equal.
|
||||
func DeepEqual[T any](t testing.TB, a T, b T) {
|
||||
func DeepEqual[T any](t test, a T, b T) {
|
||||
if reflect.DeepEqual(a, b) {
|
||||
return
|
||||
}
|
||||
|
||||
t.Errorf(formatTwoParameters, file(), "DeepEqual", a, b)
|
||||
t.Errorf(twoParameters, file(), "DeepEqual", a, b)
|
||||
t.FailNow()
|
||||
}
|
||||
|
Reference in New Issue
Block a user