25 lines
478 B
Go
25 lines
478 B
Go
package assert
|
|
|
|
import (
|
|
"testing"
|
|
"reflect"
|
|
)
|
|
|
|
func Equal[T comparable](t *testing.T, got, want T) {
|
|
if (got != want) {
|
|
t.Errorf("not equal: %v and %v", got, want)
|
|
}
|
|
}
|
|
|
|
func NotEqual[T comparable](t *testing.T, got, want T) {
|
|
if (got == want) {
|
|
t.Errorf("unexpected equal: %v and %v", got, want)
|
|
}
|
|
}
|
|
|
|
func DeepEqual(t *testing.T, got, want interface{}){
|
|
if !(reflect.DeepEqual(got,want)) {
|
|
t.Errorf("unequal deep structure: wanted %v; but got %v", want, got)
|
|
}
|
|
}
|