diff options
-rw-r--r-- | pkg/bst/bst.go | 1 | ||||
-rw-r--r-- | pkg/bst/bst_test.go | 12 |
2 files changed, 6 insertions, 7 deletions
diff --git a/pkg/bst/bst.go b/pkg/bst/bst.go index bbff91f4..664937ba 100644 --- a/pkg/bst/bst.go +++ b/pkg/bst/bst.go @@ -82,7 +82,6 @@ func (b *BST) removeHelper(uuid string, topic string, parent *BST) { //nolint:go parent = curr curr = curr.right } else { - // if more than 1 topic - remove only topic, do not remove the whole vertex if len(curr.uuids) > 1 { if _, ok := curr.uuids[uuid]; ok { diff --git a/pkg/bst/bst_test.go b/pkg/bst/bst_test.go index f7db68af..4ac9d82f 100644 --- a/pkg/bst/bst_test.go +++ b/pkg/bst/bst_test.go @@ -64,7 +64,7 @@ func BenchmarkBigSearch(b *testing.B) { g2 := NewBST() g3 := NewBST() - var predefinedSlice []string + predefinedSlice := make([]string, 0, 1000) for i := 0; i < 1000; i++ { predefinedSlice = append(predefinedSlice, uuid.NewString()) } @@ -122,7 +122,7 @@ func BenchmarkBigSearchWithRemoves(b *testing.B) { g2 := NewBST() g3 := NewBST() - var predefinedSlice []string + predefinedSlice := make([]string, 0, 1000) for i := 0; i < 1000; i++ { predefinedSlice = append(predefinedSlice, uuid.NewString()) } @@ -157,7 +157,7 @@ func BenchmarkBigSearchWithRemoves(b *testing.B) { for { select { case <-tt.C: - num := rand.Intn(333) + num := rand.Intn(333) //nolint:gosec values := g1.Get(predefinedSlice[num]) for k := range values { g1.Remove(k, predefinedSlice[num]) @@ -275,7 +275,7 @@ func TestBigSearch(t *testing.T) { g2 := NewBST() g3 := NewBST() - var predefinedSlice []string + predefinedSlice := make([]string, 0, 1000) for i := 0; i < 1000; i++ { predefinedSlice = append(predefinedSlice, uuid.NewString()) } @@ -329,7 +329,7 @@ func TestBigSearchWithRemoves(t *testing.T) { g2 := NewBST() g3 := NewBST() - var predefinedSlice []string + predefinedSlice := make([]string, 0, 1000) for i := 0; i < 1000; i++ { predefinedSlice = append(predefinedSlice, uuid.NewString()) } @@ -365,7 +365,7 @@ func TestBigSearchWithRemoves(t *testing.T) { for { select { case <-tt.C: - num := rand.Intn(333) + num := rand.Intn(333) //nolint:gosec values := g1.Get(predefinedSlice[num]) for k := range values { g1.Remove(k, predefinedSlice[num]) |