Commit cabf6c4
Changed files (1)
structures_test.go
@@ -27,9 +27,11 @@ func TestTreeLinkage(t *testing.T) {
func TestBuildTree(t *testing.T) {
categories = []Category{}
catPath := []string{"Cyber", "linux", "shell", "bash"}
- catIndex := buildTagPath(catPath, -1, 0)
- if catIndex != len(catPath)-1 {
- t.Errorf("Catindex wrong: %d", catIndex)
+ for i, _ := range catPath {
+ catIndex := buildTagPath(catPath[0:i+1], -1, 0)
+ if catIndex != i {
+ t.Errorf("Catindex wrong: %d should be %d", catIndex, i)
+ }
}
if len(categories) != len(catPath) {
t.Errorf("Categories wrong len: %d\t%+v", len(categories), categories)