aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/trie_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-27 07:08:51 +0800
committerobscuren <geffobscura@gmail.com>2014-05-27 07:08:51 +0800
commit5cdfee51437532ccfb49e874fdbbea2702c3d13f (patch)
treefe7178f2c877da1fca17dc3529f8a9d934ea2617 /ethutil/trie_test.go
parent4c7bd75c1a4ccbed09a10c81dbfbbcffdc66c411 (diff)
downloaddexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.tar
dexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.tar.gz
dexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.tar.bz2
dexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.tar.lz
dexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.tar.xz
dexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.tar.zst
dexon-5cdfee51437532ccfb49e874fdbbea2702c3d13f.zip
New Trie iterator
Diffstat (limited to 'ethutil/trie_test.go')
-rw-r--r--ethutil/trie_test.go22
1 files changed, 10 insertions, 12 deletions
diff --git a/ethutil/trie_test.go b/ethutil/trie_test.go
index d74d129ac..c89f2fbb7 100644
--- a/ethutil/trie_test.go
+++ b/ethutil/trie_test.go
@@ -154,7 +154,7 @@ func TestTrieDeleteWithValue(t *testing.T) {
}
-func TestTrieIterator(t *testing.T) {
+func TestTriePurge(t *testing.T) {
_, trie := New()
trie.Update("c", LONG_WORD)
trie.Update("ca", LONG_WORD)
@@ -171,16 +171,14 @@ func TestTrieIterator(t *testing.T) {
}
}
-func TestHashes(t *testing.T) {
+func TestTrieIt(t *testing.T) {
_, trie := New()
- trie.Update("cat", "dog")
- trie.Update("ca", "dude")
- trie.Update("doge", "1234567890abcdefghijklmnopqrstuvwxxzABCEFGHIJKLMNOPQRSTUVWXYZ")
- trie.Update("dog", "test")
- trie.Update("test", "1234567890abcdefghijklmnopqrstuvwxxzABCEFGHIJKLMNOPQRSTUVWXYZ")
- fmt.Printf("%x\n", trie.Root)
- trie.Delete("dog")
- fmt.Printf("%x\n", trie.Root)
- trie.Delete("test")
- fmt.Printf("%x\n", trie.Root)
+ trie.Update("c", LONG_WORD)
+ trie.Update("ca", LONG_WORD)
+ trie.Update("cat", LONG_WORD)
+
+ it := trie.NewIterator()
+ it.Each(func(key string, node *Value) {
+ fmt.Println(key, ":", node.Str())
+ })
}