MCPcopy
hub / github.com/robfig/cron / TestBits

Function TestBits

parser_test.go:101–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

99}
100
101func TestBits(t *testing.T) {
102 bits := []struct {
103 min, max, step uint
104 expected uint64
105 }{
106 {0, 0, 1, 0x1},
107 {1, 1, 1, 0x2},
108 {1, 5, 2, 0x2a}, // 101010
109 {1, 4, 2, 0xa}, // 1010
110 }
111
112 for _, c := range bits {
113 actual := getBits(c.min, c.max, c.step)
114 if c.expected != actual {
115 t.Errorf("%d-%d/%d => expected %b, got %b",
116 c.min, c.max, c.step, c.expected, actual)
117 }
118 }
119}
120
121func TestParseScheduleErrors(t *testing.T) {
122 var tests = []struct{ expr, err string }{

Callers

nothing calls this directly

Calls 1

getBitsFunction · 0.85

Tested by

no test coverage detected