@@ -305,7 +305,7 @@ func constructSingleDimensionQueryTestTree() (
305
305
306
306
it := newTree (1 )
307
307
308
- iv1 := constructSingleDimensionInterval (5 , 10 , 0 )
308
+ iv1 := constructSingleDimensionInterval (6 , 10 , 0 )
309
309
it .Add (iv1 )
310
310
311
311
iv2 := constructSingleDimensionInterval (4 , 5 , 1 )
@@ -329,7 +329,7 @@ func TestSimpleQuery(t *testing.T) {
329
329
func TestRightQuery (t * testing.T ) {
330
330
it , iv1 , _ , iv3 := constructSingleDimensionQueryTestTree ()
331
331
332
- result := it .Query (constructSingleDimensionInterval (5 , 8 , 0 ))
332
+ result := it .Query (constructSingleDimensionInterval (6 , 8 , 0 ))
333
333
334
334
expected := Intervals {iv1 , iv3 }
335
335
assert .Equal (t , expected , result )
@@ -356,7 +356,7 @@ func TestMatchingQuery(t *testing.T) {
356
356
func TestNoMatchLeft (t * testing.T ) {
357
357
it , _ , _ , _ := constructSingleDimensionQueryTestTree ()
358
358
359
- result := it .Query (constructSingleDimensionInterval (1 , 4 , 0 ))
359
+ result := it .Query (constructSingleDimensionInterval (1 , 3 , 0 ))
360
360
361
361
expected := Intervals {}
362
362
assert .Equal (t , expected , result )
@@ -365,7 +365,7 @@ func TestNoMatchLeft(t *testing.T) {
365
365
func TestNoMatchRight (t * testing.T ) {
366
366
it , _ , _ , _ := constructSingleDimensionQueryTestTree ()
367
367
368
- result := it .Query (constructSingleDimensionInterval (12 , 13 , 0 ))
368
+ result := it .Query (constructSingleDimensionInterval (13 , 13 , 0 ))
369
369
370
370
expected := Intervals {}
371
371
assert .Equal (t , expected , result )
@@ -601,11 +601,11 @@ func TestAddDeleteDuplicatesRebalanceRandomOrder(t *testing.T) {
601
601
func TestInsertSingleAtDimension (t * testing.T ) {
602
602
tree , ivs := constructSingleDimensionTestTree (3 )
603
603
604
- modified , deleted := tree .Insert (1 , 10 , 1 )
604
+ modified , deleted := tree .Insert (1 , 11 , 1 )
605
605
assert .Len (t , deleted , 0 )
606
606
assert .Equal (t , ivs [1 :], modified )
607
607
608
- result := tree .Query (constructSingleDimensionInterval (10 , 20 , 0 ))
608
+ result := tree .Query (constructSingleDimensionInterval (11 , 20 , 0 ))
609
609
assert .Equal (t , ivs [1 :], result )
610
610
checkRedBlack (t , tree .root , 1 )
611
611
@@ -616,7 +616,7 @@ func TestInsertSingleAtDimension(t *testing.T) {
616
616
func TestInsertMultipleAtDimension (t * testing.T ) {
617
617
tree , ivs := constructSingleDimensionTestTree (3 )
618
618
619
- modified , deleted := tree .Insert (1 , 10 , 2 )
619
+ modified , deleted := tree .Insert (1 , 11 , 2 )
620
620
assert .Len (t , deleted , 0 )
621
621
assert .Equal (t , ivs [1 :], modified )
622
622
@@ -635,7 +635,7 @@ func TestInsertAtLowestIndex(t *testing.T) {
635
635
assert .Equal (t , ivs [0 :], modified )
636
636
assert .Len (t , deleted , 0 )
637
637
638
- result := tree .Query (constructSingleDimensionInterval (0 , 1 , 0 ))
638
+ result := tree .Query (constructSingleDimensionInterval (0 , 0 , 0 ))
639
639
assert .Len (t , result , 0 )
640
640
641
641
result = tree .Query (constructSingleDimensionInterval (1 , 4 , 0 ))
@@ -650,12 +650,12 @@ func TestInsertAtLowestIndex(t *testing.T) {
650
650
func TestDeleteSingleAtDimension (t * testing.T ) {
651
651
tree , ivs := constructSingleDimensionTestTree (3 )
652
652
653
- modified , deleted := tree .Insert (1 , 10 , - 1 )
653
+ modified , deleted := tree .Insert (1 , 11 , - 1 )
654
654
assert .Equal (t , ivs [1 :], modified )
655
655
assert .Len (t , deleted , 0 )
656
656
657
- result := tree .Query (constructSingleDimensionInterval (10 , 20 , 0 ))
658
- assert .Equal (t , ivs [2 :], result )
657
+ result := tree .Query (constructSingleDimensionInterval (11 , 20 , 0 ))
658
+ assert .Equal (t , ivs [1 :], result )
659
659
660
660
result = tree .Query (constructSingleDimensionInterval (9 , 20 , 0 ))
661
661
assert .Equal (t , ivs , result )
@@ -681,7 +681,7 @@ func TestDeleteBelowLowestIndex(t *testing.T) {
681
681
assert .Equal (t , ivs , modified )
682
682
assert .Len (t , deleted , 0 )
683
683
684
- result := tree .Query (constructSingleDimensionInterval (0 , 1 , 0 ))
684
+ result := tree .Query (constructSingleDimensionInterval (0 , 0 , 0 ))
685
685
assert .Equal (t , ivs [:1 ], result )
686
686
687
687
result = tree .Query (constructSingleDimensionInterval (0 , 10 , 0 ))
@@ -695,11 +695,11 @@ func TestDeleteBelowLowestIndex(t *testing.T) {
695
695
func TestInsertDeletesInterval (t * testing.T ) {
696
696
tree , ivs := constructSingleDimensionTestTree (3 )
697
697
698
- modified , deleted := tree .Insert (1 , 0 , - 10 )
698
+ modified , deleted := tree .Insert (1 , 0 , - 11 )
699
699
assert .Equal (t , ivs [1 :], modified )
700
700
assert .Equal (t , ivs [:1 ], deleted )
701
701
702
- result := tree .Query (constructSingleDimensionInterval (2 , 10 , 0 ))
702
+ result := tree .Query (constructSingleDimensionInterval (3 , 10 , 0 ))
703
703
assert .Len (t , result , 0 )
704
704
705
705
result = tree .Query (constructSingleDimensionInterval (0 , 2 , 0 ))
@@ -708,7 +708,7 @@ func TestInsertDeletesInterval(t *testing.T) {
708
708
checkRedBlack (t , tree .root , 1 )
709
709
assert .Equal (t , uint64 (2 ), tree .Len ())
710
710
assert .Equal (t , int64 (0 ), tree .root .min )
711
- assert .Equal (t , int64 (2 ), tree .root .max )
711
+ assert .Equal (t , int64 (1 ), tree .root .max )
712
712
}
713
713
714
714
func TestDeleteMiddleOfRange (t * testing.T ) {
0 commit comments