MCPcopy Create free account
hub / github.com/chain/txvm / TestDurationMillis

Function TestDurationMillis

protocol/bc/time_test.go:32–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestDurationMillis(t *testing.T) {
33 cases := []struct {
34 d time.Duration
35 m uint64
36 }{
37 {d: time.Second, m: 1000},
38 {d: time.Minute, m: 60000},
39 {d: time.Hour, m: 3600000},
40 {d: time.Hour * 24, m: 86400000},
41 }
42
43 for _, c := range cases {
44 gotM := DurationMillis(c.d)
45 if gotM != c.m {
46 t.Errorf("Millis(%v) = %d want %d", c.d, gotM, c.m)
47 }
48
49 gotD := MillisDuration(c.m)
50 if gotD != c.d {
51 t.Errorf("FromMillis(%d) = %v want %v", c.m, gotD, c.d)
52 }
53 }
54}

Callers

nothing calls this directly

Calls 2

DurationMillisFunction · 0.85
MillisDurationFunction · 0.85

Tested by

no test coverage detected