summaryrefslogtreecommitdiff
path: root/plugins/broadcast/memory/bst/bst_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-20 22:46:19 +0300
committerValery Piashchynski <[email protected]>2021-05-20 22:46:19 +0300
commitd2e9d8320857f5768c54843a43ad16f59d6a3e8f (patch)
treef6f46e688b6005b2b0ea10c7238e925c0b58f25a /plugins/broadcast/memory/bst/bst_test.go
parentf85172106b4723b705aa75c3c310e8cebd050a8d (diff)
- Update linters
- Implement base interfaces - Implement BST search algo for the in-memory storage Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/broadcast/memory/bst/bst_test.go')
-rw-r--r--plugins/broadcast/memory/bst/bst_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/broadcast/memory/bst/bst_test.go b/plugins/broadcast/memory/bst/bst_test.go
new file mode 100644
index 00000000..b5ad6c10
--- /dev/null
+++ b/plugins/broadcast/memory/bst/bst_test.go
@@ -0,0 +1,33 @@
+package bst
+
+import (
+ "testing"
+
+ "github.com/google/uuid"
+ "github.com/stretchr/testify/assert"
+)
+
+func TestNewBST(t *testing.T) {
+ 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")
+ }
+
+ exist := g.Get("comments")
+ assert.Len(t, exist, 100)
+
+ exist2 := g.Get("comments2")
+ assert.Len(t, exist2, 100)
+
+ exist3 := g.Get("comments3")
+ assert.Len(t, exist3, 100)
+}