(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func TestStepRangeToIntervals(t *testing.T) { |
| 48 | tc := []struct { |
| 49 | start, end, step uint64 |
| 50 | instant bool |
| 51 | expected int |
| 52 | }{ |
| 53 | { |
| 54 | start: 10, |
| 55 | end: 11, |
| 56 | step: 1, |
| 57 | instant: false, |
| 58 | expected: 1, |
| 59 | }, |
| 60 | { |
| 61 | start: 0, |
| 62 | end: 3, |
| 63 | step: 1, |
| 64 | instant: false, |
| 65 | expected: 3, // 1, 2, 3 |
| 66 | }, |
| 67 | { |
| 68 | start: 0, |
| 69 | end: 10, |
| 70 | step: 3, |
| 71 | instant: false, |
| 72 | expected: 4, // 3, 6, 9, 12 |
| 73 | }, |
| 74 | { |
| 75 | start: 0, |
| 76 | end: 10, |
| 77 | step: 3, |
| 78 | instant: true, |
| 79 | expected: 1, // for instant queries, always only one interval |
| 80 | }, |
| 81 | } |
| 82 | |
| 83 | for _, c := range tc { |
| 84 | mapper := NewIntervalMapper(c.start, c.end, c.step, c.instant) |
| 85 | require.Equal(t, c.expected, mapper.IntervalCount()) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | func TestTimestampOf(t *testing.T) { |
| 90 | tc := []struct { |
nothing calls this directly
no test coverage detected