Fixed test

This commit is contained in:
obscuren 2014-11-21 10:48:07 -05:00
parent 9b8a12b4b5
commit 8cf9ed0ea5
2 changed files with 4 additions and 3 deletions

View File

@ -3,6 +3,7 @@ package ptrie
import ( import (
"bytes" "bytes"
"container/list" "container/list"
"fmt"
"sync" "sync"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
@ -198,7 +199,7 @@ func (self *Trie) get(node Node, key []byte) Node {
case *FullNode: case *FullNode:
return self.get(node.branch(key[0]), key[1:]) return self.get(node.branch(key[0]), key[1:])
default: default:
panic("Invalid node") panic(fmt.Sprintf("%T: invalid node: %v", node, node))
} }
} }

View File

@ -215,13 +215,13 @@ func TestOutput(t *testing.T) {
for i := 0; i < 50; i++ { for i := 0; i < 50; i++ {
trie.UpdateString(fmt.Sprintf("%s%d", base, i), "valueeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") trie.UpdateString(fmt.Sprintf("%s%d", base, i), "valueeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
} }
trie.Hash()
fmt.Println("############################## FULL ################################") fmt.Println("############################## FULL ################################")
fmt.Println(trie.root) fmt.Println(trie.root)
trie.Commit()
fmt.Println("############################## SMALL ################################")
trie2 := New(trie.roothash, trie.cache.backend) trie2 := New(trie.roothash, trie.cache.backend)
trie2.GetString(base + "20") trie2.GetString(base + "20")
fmt.Println("############################## SMALL ################################")
fmt.Println(trie2.root) fmt.Println(trie2.root)
} }