MCPcopy
hub / github.com/expr-lang/expr / TestInEpsilonWrapper

Function TestInEpsilonWrapper

internal/testify/assert/forward_assertions_test.go:483–519  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

481}
482
483func 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
521func TestRegexpWrapper(t *testing.T) {
522

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
TrueFunction · 0.70
FalseFunction · 0.70
InEpsilonMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…