You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
384 B

package search
import (
"fmt"
"testing"
)
type mockItem struct {
path string
data any
}
func TestNewTree(t *testing.T) {
tree := NewTree()
list := []mockItem{
{"/", 1},
{"/api", 2},
{"/api/v1/:name", 3},
}
for _, v := range list {
if err := tree.Add(v.path, v.data); err != nil {
t.Error(err)
}
}
fmt.Println(list)
fmt.Println(tree.Search("/api/v1/tom"))
}