(t *testing.T)
| 58 | } |
| 59 | |
| 60 | func 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 | |
| 80 | func TestAll(t *testing.T) { |
| 81 | allBits := []struct { |
nothing calls this directly
no test coverage detected