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

Function TestWithinDuration

internal/testify/assert/assertions_test.go:1729–1746  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1727}
1728
1729func TestWithinDuration(t *testing.T) {
1730
1731 mockT := new(testing.T)
1732 a := time.Now()
1733 b := a.Add(10 * time.Second)
1734
1735 True(t, WithinDuration(mockT, a, b, 10*time.Second), "A 10s difference is within a 10s time difference")
1736 True(t, WithinDuration(mockT, b, a, 10*time.Second), "A 10s difference is within a 10s time difference")
1737
1738 False(t, WithinDuration(mockT, a, b, 9*time.Second), "A 10s difference is not within a 9s time difference")
1739 False(t, WithinDuration(mockT, b, a, 9*time.Second), "A 10s difference is not within a 9s time difference")
1740
1741 False(t, WithinDuration(mockT, a, b, -9*time.Second), "A 10s difference is not within a 9s time difference")
1742 False(t, WithinDuration(mockT, b, a, -9*time.Second), "A 10s difference is not within a 9s time difference")
1743
1744 False(t, WithinDuration(mockT, a, b, -11*time.Second), "A 10s difference is not within a 9s time difference")
1745 False(t, WithinDuration(mockT, b, a, -11*time.Second), "A 10s difference is not within a 9s time difference")
1746}
1747
1748func TestWithinRange(t *testing.T) {
1749

Callers

nothing calls this directly

Calls 4

TrueFunction · 0.70
WithinDurationFunction · 0.70
FalseFunction · 0.70
AddMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…