aboutsummaryrefslogtreecommitdiffstats
path: root/common/math/integer_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-23 23:36:38 +0800
committerGitHub <noreply@github.com>2017-03-23 23:36:38 +0800
commit8771c3061f340451d0966adcc547338a25f2231f (patch)
treec566cab81cf95a39f85fbe2c98a932af9495eb68 /common/math/integer_test.go
parent11e7a712f469fb24ddb88ecebcefab6ed8880eb8 (diff)
parent37dd9086ec491900311fc39837f4a62ef5fd3a4a (diff)
downloaddexon-8771c3061f340451d0966adcc547338a25f2231f.tar
dexon-8771c3061f340451d0966adcc547338a25f2231f.tar.gz
dexon-8771c3061f340451d0966adcc547338a25f2231f.tar.bz2
dexon-8771c3061f340451d0966adcc547338a25f2231f.tar.lz
dexon-8771c3061f340451d0966adcc547338a25f2231f.tar.xz
dexon-8771c3061f340451d0966adcc547338a25f2231f.tar.zst
dexon-8771c3061f340451d0966adcc547338a25f2231f.zip
Merge pull request #3794 from fjl/core-genesis-refactor
core: refactor genesis handling
Diffstat (limited to 'common/math/integer_test.go')
-rw-r--r--common/math/integer_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/math/integer_test.go b/common/math/integer_test.go
index 05bba221f..b31c7c26c 100644
--- a/common/math/integer_test.go
+++ b/common/math/integer_test.go
@@ -65,7 +65,7 @@ func TestOverflow(t *testing.T) {
}
}
-func TestParseUint64(t *testing.T) {
+func TestHexOrDecimal64(t *testing.T) {
tests := []struct {
input string
num uint64
@@ -88,12 +88,13 @@ func TestParseUint64(t *testing.T) {
{"18446744073709551617", 0, false},
}
for _, test := range tests {
- num, ok := ParseUint64(test.input)
- if ok != test.ok {
- t.Errorf("ParseUint64(%q) -> ok = %t, want %t", test.input, ok, test.ok)
+ var num HexOrDecimal64
+ err := num.UnmarshalText([]byte(test.input))
+ if (err == nil) != test.ok {
+ t.Errorf("ParseUint64(%q) -> (err == nil) = %t, want %t", test.input, err == nil, test.ok)
continue
}
- if ok && num != test.num {
+ if err == nil && uint64(num) != test.num {
t.Errorf("ParseUint64(%q) -> %d, want %d", test.input, num, test.num)
}
}