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

Function InDelta

require/require.go:883–891  ·  view source on GitHub ↗

InDelta asserts that the two numerals are within delta of each other. require.InDelta(t, math.Pi, 22/7.0, 0.01)

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

Source from the content-addressed store, hash-verified

881//
882// require.InDelta(t, math.Pi, 22/7.0, 0.01)
883func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
884 if h, ok := t.(tHelper); ok {
885 h.Helper()
886 }
887 if assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
888 return
889 }
890 t.FailNow()
891}
892
893// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
894func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {

Callers 2

InDeltaMethod · 0.70
TestInDeltaFunction · 0.70

Calls 3

InDeltaFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by 1

TestInDeltaFunction · 0.56