Example #1
0
func Equals(
	t *testing.T,
	a interface{},
	b interface{},
) bool {
	if a != b {
		if is_int(a) && is_int(b) {
			if fmt.Sprintf("%d", a) == fmt.Sprintf("%d", b) {
				return true
			}
		}
		s := "`"
		s += print(a)
		s += fmt.Sprintf("` (%T) != `", a)
		s += print(b)
		s += fmt.Sprintf("` (%T)\n", b)
		s += stacktrace.StackTrace(0)
		s += "\n"
		if t != nil {
			t.Fatal(s)
		} else {
			log.Print(s)
		}
		return false
	}
	return true
}
Example #2
0
func NotNil(
	t *testing.T,
	a interface{},
) bool {
	if isNil(a) {
		s := "`"
		s += print(a)
		s += fmt.Sprintf("` (%T) == nil\n", a)
		s += stacktrace.StackTrace(0)
		s += "\n"
		if t != nil {
			t.Fatal(s)
		} else {
			log.Print(s)
		}
		return false
	}
	return true
}