actually assert something
This commit is contained in:
parent
acf430356a
commit
c742569bd0
2 changed files with 14 additions and 13 deletions
|
@ -1,13 +1,13 @@
|
||||||
package huff
|
package huff
|
||||||
|
|
||||||
import (
|
import "testing"
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestNode(t *testing.T) {
|
func TestNode(t *testing.T) {
|
||||||
// Paths defined in words_test.go
|
// Paths defined in words_test.go
|
||||||
w := GetWeights(Paths, "/")
|
w := GetWeights(Paths, "/")
|
||||||
pt := NewWordTree(w.Sorted())
|
pt := NewWordTree(w.Sorted())
|
||||||
fmt.Printf("%#v\n", pt)
|
t.Logf("%#v\n", pt)
|
||||||
|
if pt == nil {
|
||||||
|
t.Error("Failed to build trie")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package huff
|
package huff
|
||||||
|
|
||||||
import (
|
import "testing"
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Paths = []string{
|
var Paths = []string{
|
||||||
"/content/dist/rhel/server/6/$releasever/$relarch/os",
|
"/content/dist/rhel/server/6/$releasever/$relarch/os",
|
||||||
|
@ -15,7 +12,11 @@ var Paths = []string{
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWords(t *testing.T) {
|
func TestWords(t *testing.T) {
|
||||||
|
expected := 12
|
||||||
w := GetWeights(Paths, "/")
|
w := GetWeights(Paths, "/")
|
||||||
fmt.Printf("%#v\n", w)
|
t.Logf("%#v\n", w)
|
||||||
fmt.Printf("%#v\n", w.Sorted())
|
t.Logf("%#v\n", w.Sorted())
|
||||||
|
if len(w) != expected {
|
||||||
|
t.Errorf("expected %d, got %d", expected, len(w))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue