| 481 | } |
| 482 | |
| 483 | func TestInEpsilonWrapper(t *testing.T) { |
| 484 | assert := New(new(testing.T)) |
| 485 | |
| 486 | cases := []struct { |
| 487 | a, b interface{} |
| 488 | epsilon float64 |
| 489 | }{ |
| 490 | {uint8(2), uint16(2), .001}, |
| 491 | {2.1, 2.2, 0.1}, |
| 492 | {2.2, 2.1, 0.1}, |
| 493 | {-2.1, -2.2, 0.1}, |
| 494 | {-2.2, -2.1, 0.1}, |
| 495 | {uint64(100), uint8(101), 0.01}, |
| 496 | {0.1, -0.1, 2}, |
| 497 | } |
| 498 | |
| 499 | for _, tc := range cases { |
| 500 | True(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, "Expected %V and %V to have a relative difference of %v", tc.a, tc.b, tc.epsilon)) |
| 501 | } |
| 502 | |
| 503 | cases = []struct { |
| 504 | a, b interface{} |
| 505 | epsilon float64 |
| 506 | }{ |
| 507 | {uint8(2), int16(-2), .001}, |
| 508 | {uint64(100), uint8(102), 0.01}, |
| 509 | {2.1, 2.2, 0.001}, |
| 510 | {2.2, 2.1, 0.001}, |
| 511 | {2.1, -2.2, 1}, |
| 512 | {2.1, "bla-bla", 0}, |
| 513 | {0.1, -0.1, 1.99}, |
| 514 | } |
| 515 | |
| 516 | for _, tc := range cases { |
| 517 | False(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, "Expected %V and %V to have a relative difference of %v", tc.a, tc.b, tc.epsilon)) |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | func TestRegexpWrapper(t *testing.T) { |
| 522 | |