| 78 | } |
| 79 | |
| 80 | func 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 | |
| 101 | func TestBits(t *testing.T) { |
| 102 | bits := []struct { |