Negative asserts that the specified element is negative assert.Negative(t, -1) assert.Negative(t, -1.23)
(t TestingT, e interface{}, msgAndArgs ...interface{})
| 453 | // assert.Negative(t, -1) |
| 454 | // assert.Negative(t, -1.23) |
| 455 | func 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 | |
| 464 | func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { |
| 465 | if h, ok := t.(tHelper); ok { |