diff options
author | obscuren <geffobscura@gmail.com> | 2014-01-11 05:44:53 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-01-11 05:44:53 +0800 |
commit | 8bbf879cb31e9cb28700773ed788421f9935ac36 (patch) | |
tree | ea2ab662a0577aa6238b084eda7ec9644ee35995 /trie_test.go | |
parent | f6fa4f88797030b8e83066cb262a68958953974e (diff) | |
download | go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.tar go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.tar.gz go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.tar.bz2 go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.tar.lz go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.tar.xz go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.tar.zst go-tangerine-8bbf879cb31e9cb28700773ed788421f9935ac36.zip |
Moving the ethgo to individual packages
Diffstat (limited to 'trie_test.go')
-rw-r--r-- | trie_test.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/trie_test.go b/trie_test.go deleted file mode 100644 index 599a5f47c..000000000 --- a/trie_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package main - -import ( - "testing" - "encoding/hex" - _"fmt" -) - -func TestTriePut(t *testing.T) { - db, err := NewMemDatabase() - trie := NewTrie(db, "") - - if err != nil { - t.Error("Error starting db") - } - - key := trie.Put([]byte("testing node")) - - data, err := db.Get(key) - if err != nil { - t.Error("Nothing at node") - } - - s, _ := Decode(data, 0) - if str, ok := s.([]byte); ok { - if string(str) != "testing node" { - t.Error("Wrong value node", str) - } - } else { - t.Error("Invalid return type") - } -} - -func TestTrieUpdate(t *testing.T) { - db, err := NewMemDatabase() - trie := NewTrie(db, "") - - if err != nil { - t.Error("Error starting db") - } - - - trie.Update("doe", "reindeer") - trie.Update("dog", "puppy") - /* - data, _ := db.Get([]byte(trie.root)) - data, _ = db.Get([]byte(DecodeNode(data)[1])) - data, _ = db.Get([]byte(DecodeNode(data)[7])) - PrintSlice(DecodeNode(data)) - */ - - trie.Update("dogglesworth", "cat") - root := hex.EncodeToString([]byte(trie.root)) - req := "e378927bfc1bd4f01a2e8d9f59bd18db8a208bb493ac0b00f93ce51d4d2af76c" - if root != req { - t.Error("trie.root do not match, expected", req, "got", root) - } -} - |