diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-04-08 19:22:31 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-04-20 03:57:49 +0800 |
commit | c4b7d4d3f77160fba1ab3d8366cb2657a90e2282 (patch) | |
tree | 34f15cad05c00f2ab60f8e0084a1a869030b9a13 /common/resolver/resolver_test.go | |
parent | b46e15217131e4ebe64e1ee55594c3ab0620395c (diff) | |
download | dexon-c4b7d4d3f77160fba1ab3d8366cb2657a90e2282.tar.gz dexon-c4b7d4d3f77160fba1ab3d8366cb2657a90e2282.tar.zst dexon-c4b7d4d3f77160fba1ab3d8366cb2657a90e2282.zip |
NatSpec cli option, resolver tests passing
Diffstat (limited to 'common/resolver/resolver_test.go')
-rw-r--r-- | common/resolver/resolver_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/common/resolver/resolver_test.go b/common/resolver/resolver_test.go index 17a1c4f94..7d570cbc6 100644 --- a/common/resolver/resolver_test.go +++ b/common/resolver/resolver_test.go @@ -14,7 +14,7 @@ type testBackend struct { var ( text = "test" - codehash = common.RightPadString("1234", 64) + codehash = "1234" //common.RightPadString("1234", 64) hash = common.Bytes2Hex(crypto.Sha3([]byte(text))) url = "bzz://bzzhash/my/path/contr.act" ) @@ -23,13 +23,13 @@ func NewTestBackend() *testBackend { self := &testBackend{} self.contracts = make(map[string](map[string]string)) - self.contracts[HashRegContractAddress] = make(map[string]string) - key := storageAddress(1, common.Hex2Bytes(codehash)) - self.contracts[HashRegContractAddress][key] = hash + self.contracts["0x"+HashRegContractAddress] = make(map[string]string) + key := storageAddress(1, common.Hex2BytesFixed(codehash, 32)) + self.contracts["0x"+HashRegContractAddress][key] = "0x" + hash - self.contracts[URLHintContractAddress] = make(map[string]string) - key = storageAddress(1, common.Hex2Bytes(hash)) - self.contracts[URLHintContractAddress][key] = url + self.contracts["0x"+URLHintContractAddress] = make(map[string]string) + key = storageAddress(1, common.Hex2BytesFixed(hash, 32)) + self.contracts["0x"+URLHintContractAddress][key] = "0x" + common.Bytes2Hex([]byte(url)) return self } @@ -48,6 +48,7 @@ func TestKeyToContentHash(t *testing.T) { res := New(b, URLHintContractAddress, HashRegContractAddress) chash := common.Hash{} copy(chash[:], common.Hex2BytesFixed(codehash, 32)) + got, err := res.KeyToContentHash(chash) if err != nil { t.Errorf("expected no error, got %v", err) @@ -62,7 +63,7 @@ func TestContentHashToUrl(t *testing.T) { b := NewTestBackend() res := New(b, URLHintContractAddress, HashRegContractAddress) chash := common.Hash{} - copy(chash[:], common.Hex2Bytes(hash)) + copy(chash[:], common.Hex2BytesFixed(hash, 32)) got, err := res.ContentHashToUrl(chash) if err != nil { t.Errorf("expected no error, got %v", err) |