MCPcopy
hub / github.com/stretchr/testify / Negative

Function Negative

assert/assertion_compare.go:455–462  ·  view source on GitHub ↗

Negative asserts that the specified element is negative assert.Negative(t, -1) assert.Negative(t, -1.23)

(t TestingT, e interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

453// assert.Negative(t, -1)
454// assert.Negative(t, -1.23)
455func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
456 if h, ok := t.(tHelper); ok {
457 h.Helper()
458 }
459 zero := reflect.Zero(reflect.TypeOf(e))
460 failMessage := fmt.Sprintf("\"%v\" is not negative", e)
461 return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...)
462}
463
464func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool {
465 if h, ok := t.(tHelper); ok {

Callers 5

NegativeFunction · 0.92
NegativefFunction · 0.70
TestNegativeFunction · 0.70
NegativeMethod · 0.70

Calls 3

compareTwoValuesFunction · 0.85
HelperMethod · 0.65
ZeroMethod · 0.45

Tested by 2

TestNegativeFunction · 0.56