tpop/datastructures_test.go

26 lines
393 B
Go

package main
import (
"testing"
)
func TestBuildingTree(t *testing.T) {
tree := NewStringyBTree("foo", 1).Insert("bar", 2).Insert("baz", 3).Insert("quuz", 4)
if tree.Get("foo") != 1 {
t.Fail()
}
if tree.Get("bar") != 2 {
t.Fail()
}
if tree.Get("baz") != 3 {
t.Fail()
}
if tree.Get("quuz") != 4 {
t.Fail()
}
tree.Insert("bar", 5)
if tree.Get("bar") != 5 {
t.Fail()
}
}