(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestIntervalTree_Insert(t *testing.T) { |
| 25 | tree := NewIntervalTree() |
| 26 | |
| 27 | i1 := makeTestInterval(100, 200) |
| 28 | i2 := makeTestInterval(150, 250) |
| 29 | i3 := makeTestInterval(50, 75) |
| 30 | |
| 31 | // Insert first interval |
| 32 | if !tree.Insert(i1) { |
| 33 | t.Error("Expected first insert to succeed") |
| 34 | } |
| 35 | if tree.Size() != 1 { |
| 36 | t.Errorf("Expected size 1, got %d", tree.Size()) |
| 37 | } |
| 38 | |
| 39 | // Insert duplicate |
| 40 | if tree.Insert(i1) { |
| 41 | t.Error("Expected duplicate insert to fail") |
| 42 | } |
| 43 | if tree.Size() != 1 { |
| 44 | t.Errorf("Expected size still 1 after duplicate, got %d", tree.Size()) |
| 45 | } |
| 46 | |
| 47 | // Insert different intervals |
| 48 | if !tree.Insert(i2) { |
| 49 | t.Error("Expected second insert to succeed") |
| 50 | } |
| 51 | if !tree.Insert(i3) { |
| 52 | t.Error("Expected third insert to succeed") |
| 53 | } |
| 54 | if tree.Size() != 3 { |
| 55 | t.Errorf("Expected size 3, got %d", tree.Size()) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestIntervalTree_QueryPoint(t *testing.T) { |
| 60 | tree := NewIntervalTree() |
nothing calls this directly
no test coverage detected