diff options
Diffstat (limited to 'pkg/bst/bst_test.go')
-rw-r--r-- | pkg/bst/bst_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pkg/bst/bst_test.go b/pkg/bst/bst_test.go new file mode 100644 index 00000000..e8a13760 --- /dev/null +++ b/pkg/bst/bst_test.go @@ -0,0 +1,37 @@ +package bst + +import ( + "testing" + + "github.com/google/uuid" + "github.com/stretchr/testify/assert" +) + +func TestNewBST(t *testing.T) { + // create a new bst + g := NewBST() + + for i := 0; i < 100; i++ { + g.Insert(uuid.NewString(), "comments") + } + + for i := 0; i < 100; i++ { + g.Insert(uuid.NewString(), "comments2") + } + + for i := 0; i < 100; i++ { + g.Insert(uuid.NewString(), "comments3") + } + + // should be 100 + exist := g.Get("comments") + assert.Len(t, exist, 100) + + // should be 100 + exist2 := g.Get("comments2") + assert.Len(t, exist2, 100) + + // should be 100 + exist3 := g.Get("comments3") + assert.Len(t, exist3, 100) +} |