(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestCumulativeBucketIterator(t *testing.T) { |
| 98 | cases := []struct { |
| 99 | histogram Histogram |
| 100 | expectedBuckets []Bucket[uint64] |
| 101 | }{ |
| 102 | { |
| 103 | histogram: Histogram{ |
| 104 | Schema: 0, |
| 105 | PositiveSpans: []Span{ |
| 106 | {Offset: 0, Length: 2}, |
| 107 | {Offset: 1, Length: 2}, |
| 108 | }, |
| 109 | PositiveBuckets: []int64{1, 1, -1, 0}, |
| 110 | }, |
| 111 | expectedBuckets: []Bucket[uint64]{ |
| 112 | {Lower: math.Inf(-1), Upper: 1, Count: 1, LowerInclusive: true, UpperInclusive: true, Index: 0}, |
| 113 | {Lower: math.Inf(-1), Upper: 2, Count: 3, LowerInclusive: true, UpperInclusive: true, Index: 1}, |
| 114 | |
| 115 | {Lower: math.Inf(-1), Upper: 4, Count: 3, LowerInclusive: true, UpperInclusive: true, Index: 2}, |
| 116 | |
| 117 | {Lower: math.Inf(-1), Upper: 8, Count: 4, LowerInclusive: true, UpperInclusive: true, Index: 3}, |
| 118 | {Lower: math.Inf(-1), Upper: 16, Count: 5, LowerInclusive: true, UpperInclusive: true, Index: 4}, |
| 119 | }, |
| 120 | }, |
| 121 | { |
| 122 | histogram: Histogram{ |
| 123 | Schema: 0, |
| 124 | PositiveSpans: []Span{ |
| 125 | {Offset: 0, Length: 5}, |
| 126 | {Offset: 1, Length: 1}, |
| 127 | }, |
| 128 | PositiveBuckets: []int64{1, 2, -2, 1, -1, 0}, |
| 129 | }, |
| 130 | expectedBuckets: []Bucket[uint64]{ |
| 131 | {Lower: math.Inf(-1), Upper: 1, Count: 1, LowerInclusive: true, UpperInclusive: true, Index: 0}, |
| 132 | {Lower: math.Inf(-1), Upper: 2, Count: 4, LowerInclusive: true, UpperInclusive: true, Index: 1}, |
| 133 | {Lower: math.Inf(-1), Upper: 4, Count: 5, LowerInclusive: true, UpperInclusive: true, Index: 2}, |
| 134 | {Lower: math.Inf(-1), Upper: 8, Count: 7, LowerInclusive: true, UpperInclusive: true, Index: 3}, |
| 135 | |
| 136 | {Lower: math.Inf(-1), Upper: 16, Count: 8, LowerInclusive: true, UpperInclusive: true, Index: 4}, |
| 137 | |
| 138 | {Lower: math.Inf(-1), Upper: 32, Count: 8, LowerInclusive: true, UpperInclusive: true, Index: 5}, |
| 139 | {Lower: math.Inf(-1), Upper: 64, Count: 9, LowerInclusive: true, UpperInclusive: true, Index: 6}, |
| 140 | }, |
| 141 | }, |
| 142 | { |
| 143 | histogram: Histogram{ |
| 144 | Schema: 0, |
| 145 | PositiveSpans: []Span{ |
| 146 | {Offset: 0, Length: 7}, |
| 147 | }, |
| 148 | PositiveBuckets: []int64{1, 2, -2, 1, -1, 0, 0}, |
| 149 | }, |
| 150 | expectedBuckets: []Bucket[uint64]{ |
| 151 | {Lower: math.Inf(-1), Upper: 1, Count: 1, LowerInclusive: true, UpperInclusive: true, Index: 0}, |
| 152 | {Lower: math.Inf(-1), Upper: 2, Count: 4, LowerInclusive: true, UpperInclusive: true, Index: 1}, |
| 153 | {Lower: math.Inf(-1), Upper: 4, Count: 5, LowerInclusive: true, UpperInclusive: true, Index: 2}, |
| 154 | {Lower: math.Inf(-1), Upper: 8, Count: 7, LowerInclusive: true, UpperInclusive: true, Index: 3}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…