Fixed test
This commit is contained in:
parent
9bcb3d2216
commit
5883446b21
@ -2,8 +2,6 @@ package ethutil
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
@ -63,7 +61,7 @@ func TestEncode(t *testing.T) {
|
|||||||
|
|
||||||
str := string(bytes)
|
str := string(bytes)
|
||||||
if str != strRes {
|
if str != strRes {
|
||||||
t.Error(fmt.Sprintf("Expected %q, got %q", strRes, str))
|
t.Errorf("Expected %q, got %q", strRes, str)
|
||||||
}
|
}
|
||||||
|
|
||||||
sliceRes := "\xcc\x83dog\x83god\x83cat"
|
sliceRes := "\xcc\x83dog\x83god\x83cat"
|
||||||
@ -71,7 +69,7 @@ func TestEncode(t *testing.T) {
|
|||||||
bytes = Encode(strs)
|
bytes = Encode(strs)
|
||||||
slice := string(bytes)
|
slice := string(bytes)
|
||||||
if slice != sliceRes {
|
if slice != sliceRes {
|
||||||
t.Error(fmt.Sprintf("Expected %q, got %q", sliceRes, slice))
|
t.Error("Expected %q, got %q", sliceRes, slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
intRes := "\x82\x04\x00"
|
intRes := "\x82\x04\x00"
|
||||||
@ -108,13 +106,9 @@ func TestEncodeDecodeBigInt(t *testing.T) {
|
|||||||
encoded := Encode(bigInt)
|
encoded := Encode(bigInt)
|
||||||
|
|
||||||
value := NewValueFromBytes(encoded)
|
value := NewValueFromBytes(encoded)
|
||||||
fmt.Println(value.BigInt(), bigInt)
|
|
||||||
if value.BigInt().Cmp(bigInt) != 0 {
|
if value.BigInt().Cmp(bigInt) != 0 {
|
||||||
t.Errorf("Expected %v, got %v", bigInt, value.BigInt())
|
t.Errorf("Expected %v, got %v", bigInt, value.BigInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
dec, _ := hex.DecodeString("52f4fc1e")
|
|
||||||
fmt.Println(NewValueFromBytes(dec).BigInt())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEncodeDecodeBytes(t *testing.T) {
|
func TestEncodeDecodeBytes(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user