diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-08 18:47:04 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-08 18:47:04 +0800 |
commit | db4aaedcbdb409e17ea3de161e7b24a80ba0a58c (patch) | |
tree | 98a86ccc265ef05913b8e65a1ce2cae9c13ea788 /trie/iterator_test.go | |
parent | 982c812e81304cad835796d4fa3d67c8f08141b6 (diff) | |
download | dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.tar dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.tar.gz dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.tar.bz2 dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.tar.lz dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.tar.xz dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.tar.zst dexon-db4aaedcbdb409e17ea3de161e7b24a80ba0a58c.zip |
Moved ptrie => trie. Removed old trie
Diffstat (limited to 'trie/iterator_test.go')
-rw-r--r-- | trie/iterator_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/trie/iterator_test.go b/trie/iterator_test.go new file mode 100644 index 000000000..74d9e903c --- /dev/null +++ b/trie/iterator_test.go @@ -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) + } + } +} |