chore: add more tests (#3338)

This commit is contained in:
Kevin Wan
2023-06-12 01:22:20 +08:00
committed by GitHub
parent efa6940001
commit f6bdb6e1de
11 changed files with 99 additions and 46 deletions

View File

@@ -11,7 +11,7 @@ import (
type mockedRoute struct {
route string
value int
value any
}
func TestSearch(t *testing.T) {
@@ -187,6 +187,12 @@ func TestSearchInvalidItem(t *testing.T) {
assert.Equal(t, errEmptyItem, err)
}
func TestSearchInvalidState(t *testing.T) {
nd := newNode("0")
nd.children[0]["1"] = nil
assert.Error(t, add(nd, "1/2", "2"))
}
func BenchmarkSearchTree(b *testing.B) {
const (
avgLen = 1000