MCPcopy Create free account
hub / github.com/prometheus/common / TestComparators

Function TestComparators

model/time_test.go:23–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestComparators(t *testing.T) {
24 t1a := TimeFromUnix(0)
25 t1b := TimeFromUnix(0)
26 t2 := TimeFromUnix(2*second - 1)
27
28 if !t1a.Equal(t1b) {
29 t.Fatalf("Expected %s to be equal to %s", t1a, t1b)
30 }
31 if t1a.Equal(t2) {
32 t.Fatalf("Expected %s to not be equal to %s", t1a, t2)
33 }
34
35 if !t1a.Before(t2) {
36 t.Fatalf("Expected %s to be before %s", t1a, t2)
37 }
38 if t1a.Before(t1b) {
39 t.Fatalf("Expected %s to not be before %s", t1a, t1b)
40 }
41
42 if !t2.After(t1a) {
43 t.Fatalf("Expected %s to be after %s", t2, t1a)
44 }
45 if t1b.After(t1a) {
46 t.Fatalf("Expected %s to not be after %s", t1b, t1a)
47 }
48}
49
50func TestTimeConversions(t *testing.T) {
51 unixSecs := int64(1136239445)

Callers

nothing calls this directly

Calls 4

TimeFromUnixFunction · 0.85
AfterMethod · 0.80
EqualMethod · 0.45
BeforeMethod · 0.45

Tested by

no test coverage detected