Commit f4134a5

Richard Luby <richluby@gmail.com>
2017-01-26 15:02:01
removed empty file
1 parent ed4b62b
Changed files (1)
structures_test.go
@@ -1,58 +0,0 @@
-package main
-
-// tests the structures available to the program
-import "testing"
-
-// TestTreeLinkage ensures that the correct parent category is returned
-func TestTreeLinkage(t *testing.T) {
-	catPath := []string{"Cyber", "linux", "shell", "bash"}
-	for i, str := range catPath {
-		categories = append(categories, Category{Parent: i - 1,
-			Value: str})
-	}
-	t.Run("Checking ancestry...", func(t *testing.T) {
-		cat := getNearestParentCategory(catPath)
-		if cat < 0 {
-			t.Errorf("Improper parent index return: %d", cat)
-			t.FailNow()
-		}
-		if categories[cat].FullCategoryPath() != "Cyber:linux:shell" {
-			t.Errorf("Cannot find parent. Recevied: %+v for: %v", categories[cat].FullCategoryPath(),
-				catPath[0:len(catPath)])
-		}
-		if len(categories[cat].Children) != 1 {
-			t.Errorf("Wrong children: %v", categories[cat].Children)
-		} else if categories[cat].Children[0] != 3 {
-			t.Errorf("Wrong child: %v", categories[cat].Children[0])
-		}
-	})
-}
-
-// TestBuildTree tests the functions necessary for building the tag tree
-func TestBuildTree(t *testing.T) {
-	categories = []Category{}
-	catPath := []string{"Cyber", "linux", "shell", "bash"}
-	for i, _ := range catPath {
-		catIndex := buildTagPath(catPath[0 : i+1])
-		if catIndex != i {
-			t.Errorf("Catindex wrong: %d should be %d", catIndex, i)
-		}
-	}
-	catPath = []string{"Winderp", "proc", "reg", "keys"}
-	for i, _ := range catPath {
-		catIndex := buildTagPath(catPath[0 : i+1])
-		if catIndex != i+len(catPath) {
-			t.Errorf("Catindex wrong: %d should be %d", catIndex, i+len(catPath))
-		}
-	}
-	if len(categories) != 2*len(catPath) {
-		t.Errorf("Categories wrong len: %d\t%+v", len(categories), categories)
-		t.FailNow()
-	}
-	for i := len(catPath); i < len(categories); i++ {
-		if i >= len(categories) || categories[i].Value != catPath[i-len(catPath)] {
-			t.Errorf("Improper category: %s for index %d\n%+v", categories[i].Value, i, categories)
-			t.FailNow()
-		}
-	}
-}