Commit cabf6c4

Richard Luby <richluby@gmail.com>
2016-12-21 10:30:15
actually test building path now
1 parent a090cdb
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)