Moved ptrie => trie. Removed old trie

This commit is contained in:
obscuren
2015-01-08 11:47:04 +01:00
parent 982c812e81
commit db4aaedcbd
19 changed files with 558 additions and 1744 deletions

33
trie/iterator_test.go Normal file
View File

@ -0,0 +1,33 @@
package trie
import "testing"
func TestIterator(t *testing.T) {
trie := NewEmpty()
vals := []struct{ k, v string }{
{"do", "verb"},
{"ether", "wookiedoo"},
{"horse", "stallion"},
{"shaman", "horse"},
{"doge", "coin"},
{"dog", "puppy"},
{"somethingveryoddindeedthis is", "myothernodedata"},
}
v := make(map[string]bool)
for _, val := range vals {
v[val.k] = false
trie.UpdateString(val.k, val.v)
}
trie.Commit()
it := trie.Iterator()
for it.Next() {
v[string(it.Key)] = true
}
for k, found := range v {
if !found {
t.Error("iterator didn't find", k)
}
}
}