summaryrefslogtreecommitdiff
path: root/plugins/memory/bst/bst_test.go
blob: e8a1376028c6b20a46e3848cc3b6cd2eac4548db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)
}