aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
commitb5234413611ce5984292f85a01de1f56c045b490 (patch)
treee6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /trie/trie_test.go
parent0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff)
downloaddexon-b5234413611ce5984292f85a01de1f56c045b490.tar
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.gz
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.bz2
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.lz
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.xz
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.zst
dexon-b5234413611ce5984292f85a01de1f56c045b490.zip
Moved ethutil => common
Diffstat (limited to 'trie/trie_test.go')
-rw-r--r--trie/trie_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/trie/trie_test.go b/trie/trie_test.go
index b6a260483..1393e0c97 100644
--- a/trie/trie_test.go
+++ b/trie/trie_test.go
@@ -6,7 +6,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
)
type Db map[string][]byte
@@ -26,7 +26,7 @@ func NewEmptySecure() *SecureTrie {
func TestEmptyTrie(t *testing.T) {
trie := NewEmpty()
res := trie.Hash()
- exp := crypto.Sha3(ethutil.Encode(""))
+ exp := crypto.Sha3(common.Encode(""))
if !bytes.Equal(res, exp) {
t.Errorf("expected %x got %x", exp, res)
}
@@ -39,7 +39,7 @@ func TestInsert(t *testing.T) {
trie.UpdateString("dog", "puppy")
trie.UpdateString("dogglesworth", "cat")
- exp := ethutil.Hex2Bytes("8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3")
+ exp := common.Hex2Bytes("8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3")
root := trie.Hash()
if !bytes.Equal(root, exp) {
t.Errorf("exp %x got %x", exp, root)
@@ -48,7 +48,7 @@ func TestInsert(t *testing.T) {
trie = NewEmpty()
trie.UpdateString("A", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
- exp = ethutil.Hex2Bytes("d23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab")
+ exp = common.Hex2Bytes("d23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab")
root = trie.Hash()
if !bytes.Equal(root, exp) {
t.Errorf("exp %x got %x", exp, root)
@@ -95,7 +95,7 @@ func TestDelete(t *testing.T) {
}
hash := trie.Hash()
- exp := ethutil.Hex2Bytes("5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84")
+ exp := common.Hex2Bytes("5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84")
if !bytes.Equal(hash, exp) {
t.Errorf("expected %x got %x", exp, hash)
}
@@ -119,7 +119,7 @@ func TestEmptyValues(t *testing.T) {
}
hash := trie.Hash()
- exp := ethutil.Hex2Bytes("5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84")
+ exp := common.Hex2Bytes("5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84")
if !bytes.Equal(hash, exp) {
t.Errorf("expected %x got %x", exp, hash)
}
@@ -168,7 +168,7 @@ func TestReset(t *testing.T) {
}
trie.Commit()
- before := ethutil.CopyBytes(trie.roothash)
+ before := common.CopyBytes(trie.roothash)
trie.UpdateString("should", "revert")
trie.Hash()
// Should have no effect
@@ -177,7 +177,7 @@ func TestReset(t *testing.T) {
// ###
trie.Reset()
- after := ethutil.CopyBytes(trie.roothash)
+ after := common.CopyBytes(trie.roothash)
if !bytes.Equal(before, after) {
t.Errorf("expected roots to be equal. %x - %x", before, after)
@@ -272,8 +272,8 @@ func TestLargeData(t *testing.T) {
vals := make(map[string]*kv)
for i := byte(0); i < 255; i++ {
- value := &kv{ethutil.LeftPadBytes([]byte{i}, 32), []byte{i}, false}
- value2 := &kv{ethutil.LeftPadBytes([]byte{10, i}, 32), []byte{i}, false}
+ value := &kv{common.LeftPadBytes([]byte{i}, 32), []byte{i}, false}
+ value2 := &kv{common.LeftPadBytes([]byte{10, i}, 32), []byte{i}, false}
trie.Update(value.k, value.v)
trie.Update(value2.k, value2.v)
vals[string(value.k)] = value
@@ -322,7 +322,7 @@ func TestSecureDelete(t *testing.T) {
}
hash := trie.Hash()
- exp := ethutil.Hex2Bytes("29b235a58c3c25ab83010c327d5932bcf05324b7d6b1185e650798034783ca9d")
+ exp := common.Hex2Bytes("29b235a58c3c25ab83010c327d5932bcf05324b7d6b1185e650798034783ca9d")
if !bytes.Equal(hash, exp) {
t.Errorf("expected %x got %x", exp, hash)
}