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

Function TestAll

parser_test.go:80–99  ·  parser_test.go::TestAll
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestAll(t *testing.T) {
81 allBits := []struct {
82 r bounds
83 expected uint64
84 }{
85 {minutes, 0xfffffffffffffff}, // 0-59: 60 ones
86 {hours, 0xffffff}, // 0-23: 24 ones
87 {dom, 0xfffffffe}, // 1-31: 31 ones, 1 zero
88 {months, 0x1ffe}, // 1-12: 12 ones, 1 zero
89 {dow, 0x7f}, // 0-6: 7 ones
90 }
91
92 for _, c := range allBits {
93 actual := all(c.r) // all() adds the starBit, so compensate for that..
94 if c.expected|starBit != actual {
95 t.Errorf("%d-%d/%d => expected %b, got %b",
96 c.r.min, c.r.max, 1, c.expected|starBit, actual)
97 }
98 }
99}
100
101func TestBits(t *testing.T) {
102 bits := []struct {

Callers

nothing calls this directly

Calls 1

allFunction · 0.85

Tested by

no test coverage detected