diff --git a/huffman_test.go b/huffman_test.go index d4a4916..5b65294 100644 --- a/huffman_test.go +++ b/huffman_test.go @@ -1,13 +1,13 @@ package huff -import ( - "fmt" - "testing" -) +import "testing" func TestNode(t *testing.T) { - // Paths defined in words_test.go + // Paths defined in words_test.go w := GetWeights(Paths, "/") - pt := NewWordTree(w.Sorted()) - fmt.Printf("%#v\n", pt) + pt := NewWordTree(w.Sorted()) + t.Logf("%#v\n", pt) + if pt == nil { + t.Error("Failed to build trie") + } } diff --git a/words_test.go b/words_test.go index 8d5fc5a..518a2a0 100644 --- a/words_test.go +++ b/words_test.go @@ -1,9 +1,6 @@ package huff -import ( - "fmt" - "testing" -) +import "testing" var Paths = []string{ "/content/dist/rhel/server/6/$releasever/$relarch/os", @@ -15,7 +12,11 @@ var Paths = []string{ } func TestWords(t *testing.T) { + expected := 12 w := GetWeights(Paths, "/") - fmt.Printf("%#v\n", w) - fmt.Printf("%#v\n", w.Sorted()) + t.Logf("%#v\n", w) + t.Logf("%#v\n", w.Sorted()) + if len(w) != expected { + t.Errorf("expected %d, got %d", expected, len(w)) + } }