MCPcopy
hub / github.com/TheAlgorithms/Go / TestBTreeDeleteEverything

Function TestBTreeDeleteEverything

structure/tree/btree_test.go:116–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestBTreeDeleteEverything(t *testing.T) {
117 tree := bt.NewBTree[int](4)
118 size := 128
119 for i := 0; i < size; i++ {
120 tree.Insert(i)
121 }
122 for i := 0; i < size; i++ {
123 tree.Delete(i)
124 }
125 tree.Delete(-1)
126 tree.Delete(1000)
127
128 for i := 0; i < size; i++ {
129 if tree.Search(i) {
130 t.Errorf("Tree not expected to contain %d", i)
131 }
132 }
133}

Callers

nothing calls this directly

Calls 3

InsertMethod · 0.65
DeleteMethod · 0.65
SearchMethod · 0.45

Tested by

no test coverage detected