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

Function TestField

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

Source from the content-addressed store, hash-verified

58}
59
60func TestField(t *testing.T) {
61 fields := []struct {
62 expr string
63 min, max uint
64 expected uint64
65 }{
66 {"5", 1, 7, 1 << 5},
67 {"5,6", 1, 7, 1<<5 | 1<<6},
68 {"5,6,7", 1, 7, 1<<5 | 1<<6 | 1<<7},
69 {"1,5-7/2,3", 1, 7, 1<<1 | 1<<5 | 1<<7 | 1<<3},
70 }
71
72 for _, c := range fields {
73 actual, _ := getField(c.expr, bounds{c.min, c.max, nil})
74 if actual != c.expected {
75 t.Errorf("%s => expected %d, got %d", c.expr, c.expected, actual)
76 }
77 }
78}
79
80func TestAll(t *testing.T) {
81 allBits := []struct {

Callers

nothing calls this directly

Calls 1

getFieldFunction · 0.85

Tested by

no test coverage detected