@@ -179,8 +179,14 @@ func TestIndexItem_MatchRangeV1(t *testing.T) {
179
179
result5 := item .MatchRange (37 , 50 )
180
180
assert .Equal (t , []byte {16 , 17 , 18 , 19 , 20 , 21 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 }, result5 )
181
181
182
- result6 := item .MatchRange (37 , 51 )
182
+ result6 := item .MatchRange (19 , 28 )
183
183
assert .Nil (t , result6 )
184
+
185
+ result7 := item .MatchRange (37 , 51 )
186
+ assert .Nil (t , result7 )
187
+
188
+ result8 := item .MatchRange (0 , 0 )
189
+ assert .Nil (t , result8 )
184
190
}
185
191
186
192
func TestIndexItem_MatchRangeV2 (t * testing.T ) {
@@ -203,6 +209,31 @@ func TestIndexItem_MatchRangeV2(t *testing.T) {
203
209
204
210
result2 := item .MatchRange (0 , 9 )
205
211
assert .Equal (t , []byte {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }, result2 )
212
+
213
+ result3 := item .MatchRange (0 , 10 )
214
+ assert .Nil (t , result3 )
215
+ }
216
+
217
+ func TestIndexItem_MatchRangeV3 (t * testing.T ) {
218
+ item := indexItem {
219
+ sha512Hex : "test" ,
220
+ expiresAt : time .Now (),
221
+ sortIndex : 0 ,
222
+
223
+ dataItems : []dataContainer {
224
+ {
225
+ begins : 10 ,
226
+ ends : 19 ,
227
+ data : []byte {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 },
228
+ },
229
+ },
230
+ }
231
+
232
+ result1 := item .MatchRange (8 , 21 )
233
+ assert .Nil (t , result1 )
234
+
235
+ result2 := item .MatchRange (8 , 3 )
236
+ assert .Nil (t , result2 )
206
237
}
207
238
208
239
func TestIndexItem_MergeV1 (t * testing.T ) {
0 commit comments