(t *testing.T)
| 113 | } |
| 114 | |
| 115 | func TestDataPointLessThan(t *testing.T) { |
| 116 | key := SeriesMapKey{{Name: "foo", Value: NewStaticString("bar").MapKey()}} |
| 117 | keyEarlier := SeriesMapKey{{Name: "aaa", Value: NewStaticString("bar").MapKey()}} |
| 118 | |
| 119 | tests := []struct { |
| 120 | name string |
| 121 | a seriesValue |
| 122 | b seriesValue |
| 123 | expected bool |
| 124 | }{ |
| 125 | { |
| 126 | name: "a value less than b", |
| 127 | a: seriesValue{key: key, value: 1.0}, |
| 128 | b: seriesValue{key: key, value: 5.0}, |
| 129 | expected: true, |
| 130 | }, |
| 131 | { |
| 132 | name: "a value greater than b", |
| 133 | a: seriesValue{key: key, value: 10.0}, |
| 134 | b: seriesValue{key: key, value: 5.0}, |
| 135 | expected: false, |
| 136 | }, |
| 137 | { |
| 138 | name: "equal values, equal keys", |
| 139 | a: seriesValue{key: key, value: 5.0}, |
| 140 | b: seriesValue{key: key, value: 5.0}, |
| 141 | expected: false, |
| 142 | }, |
| 143 | { |
| 144 | name: "equal values, a key alphabetically earlier than b", |
| 145 | a: seriesValue{key: keyEarlier, value: 5.0}, |
| 146 | b: seriesValue{key: key, value: 5.0}, |
| 147 | expected: false, // reversed: alphabetically earlier key now compares as greater, not less |
| 148 | }, |
| 149 | } |
| 150 | |
| 151 | for _, tt := range tests { |
| 152 | t.Run(tt.name, func(t *testing.T) { |
| 153 | result := dataPointLessThan(tt.a, tt.b) |
| 154 | require.Equal(t, tt.expected, result) |
| 155 | }) |
| 156 | } |
| 157 | } |
nothing calls this directly
no test coverage detected