MCPcopy Index your code
hub / github.com/expr-lang/expr / InEpsilonSlice

Function InEpsilonSlice

internal/testify/assert/assertions.go:1504–1532  ·  view source on GitHub ↗

InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.

(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

1502
1503// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
1504func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
1505 if h, ok := t.(tHelper); ok {
1506 h.Helper()
1507 }
1508
1509 if expected == nil || actual == nil {
1510 return Fail(t, "Parameters must be slice", msgAndArgs...)
1511 }
1512
1513 expectedSlice := reflect.ValueOf(expected)
1514 actualSlice := reflect.ValueOf(actual)
1515
1516 if expectedSlice.Type().Kind() != reflect.Slice {
1517 return Fail(t, "Expected value must be slice", msgAndArgs...)
1518 }
1519
1520 expectedLen := expectedSlice.Len()
1521 if !IsType(t, expected, actual) || !Len(t, actual, expectedLen) {
1522 return false
1523 }
1524
1525 for i := 0; i < expectedLen; i++ {
1526 if !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, "at index %d", i) {
1527 return false
1528 }
1529 }
1530
1531 return true
1532}
1533
1534/*
1535 Errors

Callers 4

InEpsilonSliceFunction · 0.92
InEpsilonSlicefFunction · 0.70
TestInEpsilonSliceFunction · 0.70
InEpsilonSliceMethod · 0.70

Calls 7

FailFunction · 0.70
IsTypeFunction · 0.70
LenFunction · 0.70
InEpsilonFunction · 0.70
TypeMethod · 0.65
HelperMethod · 0.45
LenMethod · 0.45

Tested by 1

TestInEpsilonSliceFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…