Documentation ¶
Index ¶
- func CompareMsg(exp, act interface{}) string
- func CompareMsgf(exp, act interface{}, msg string, args ...interface{}) string
- func IsFloatNear(epsilon, expected, actual float64) bool
- type T
- func (tb T) Assert(condition bool, v ...interface{}) bool
- func (tb T) Equals(exp, act interface{}, v ...interface{}) bool
- func (tb T) Exact(exp, act interface{}, v ...interface{}) bool
- func (tb T) FloatNear(epsilon float64, expected float64, actual float64, v ...interface{}) bool
- func (tb T) MustAssert(condition bool, v ...interface{})
- func (tb T) MustEqual(exp, act interface{}, v ...interface{})
- func (tb T) MustExact(exp, act interface{}, v ...interface{})
- func (tb T) MustFloatNear(epsilon float64, expected float64, actual float64, v ...interface{})
- func (tb T) MustFloatsNear(epsilon float64, expected []float64, actual []float64, v ...interface{})
- func (tb T) MustOK(err error)
- func (tb T) MustOKAll(errs ...interface{})
- func (tb T) OK(err error) bool
- func (tb T) OKAll(errs ...interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareMsg ¶
func CompareMsg(exp, act interface{}) string
func CompareMsgf ¶
func IsFloatNear ¶
Types ¶
type T ¶
T wraps a testing.T or a testing.B with a simple set of custom assertions.
Assertions prefixed with 'Must' will terminate the execution of the test case immediately.
Assertions that are not prefixed with 'Must' will fail the test but allow the test to continue.
func (T) Equals ¶
Equals fails the test but continues executing if exp is not equal to act using reflect.DeepEqual() and returns whether the assertion succeded. See Exact for equality comparisons using '=='.
func (T) Exact ¶
Exact fails the test but continues executing if the Go language equality rules for '==' do not apply to the arguments. This is distinct from MustEqual, which performs a reflect.DeepEqual().
func (T) MustAssert ¶
MustAssert immediately fails the test if the condition is false.
func (T) MustEqual ¶
func (tb T) MustEqual(exp, act interface{}, v ...interface{})
MustEqual immediately fails the test if exp is not equal to act based on reflect.DeepEqual(). See Exact for equality comparisons using '=='.
func (T) MustExact ¶
func (tb T) MustExact(exp, act interface{}, v ...interface{})
MustExact immediately fails the test if the Go language equality rules for '==' do not apply to the arguments. This is distinct from MustEqual, which performs a reflect.DeepEqual().