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

Function TestWithinRange

assert/assertions_test.go:2253–2271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2251}
2252
2253func TestWithinRange(t *testing.T) {
2254 t.Parallel()
2255
2256 mockT := new(testing.T)
2257 n := time.Now()
2258 s := n.Add(-time.Second)
2259 e := n.Add(time.Second)
2260
2261 True(t, WithinRange(mockT, n, n, n), "Exact same actual, start, and end values return true")
2262
2263 True(t, WithinRange(mockT, n, s, e), "Time in range is within the time range")
2264 True(t, WithinRange(mockT, s, s, e), "The start time is within the time range")
2265 True(t, WithinRange(mockT, e, s, e), "The end time is within the time range")
2266
2267 False(t, WithinRange(mockT, s.Add(-time.Nanosecond), s, e, "Just before the start time is not within the time range"))
2268 False(t, WithinRange(mockT, e.Add(time.Nanosecond), s, e, "Just after the end time is not within the time range"))
2269
2270 False(t, WithinRange(mockT, n, e, s, "Just after the end time is not within the time range"))
2271}
2272
2273func TestInDelta(t *testing.T) {
2274 t.Parallel()

Callers

nothing calls this directly

Calls 3

TrueFunction · 0.70
WithinRangeFunction · 0.70
FalseFunction · 0.70

Tested by

no test coverage detected