mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
test: Updated test cases to include MaxInt64, MinInt64 and MaxUint64, also rename testcase to TestHas0xPrefix to cover Has0xPrefix public method in hexutil package
This commit is contained in:
parent
631be3cc04
commit
c14f2e17aa
2 changed files with 6 additions and 6 deletions
|
|
@ -141,7 +141,7 @@ var (
|
|||
}
|
||||
|
||||
hexStringValidityTest = []hexValidityTest{
|
||||
{"0x", false},
|
||||
{"0x", true},
|
||||
{"asdcc", false},
|
||||
{"0x00000102", true},
|
||||
}
|
||||
|
|
@ -213,9 +213,9 @@ func TestDecodeUint64(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestIsValidHexString(t *testing.T) {
|
||||
func TestHas0xPrefix(t *testing.T) {
|
||||
for _, test := range hexStringValidityTest {
|
||||
actual := IsValidHexString(test.input)
|
||||
actual := Has0xPrefix(test.input)
|
||||
if actual != test.want {
|
||||
t.Errorf("input %s: value mismatch: got %t, want %t", test.input, actual, test.want)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ func TestBlockNumberJSONUnmarshal(t *testing.T) {
|
|||
18: {``, true, BlockNumber(0)},
|
||||
19: {`88439993`, false, BlockNumber(88439993)},
|
||||
20: {`-1`, true, BlockNumber(0)},
|
||||
21: {`MaxInt64`, true, BlockNumber(0)},
|
||||
22: {`MinInt64`, true, BlockNumber(0)},
|
||||
23: {`MaxUint64`, true, BlockNumber(0)},
|
||||
21: {`9223372036854775807`, false, BlockNumber(9223372036854775807)},
|
||||
22: {`-9223372036854775808`, true, BlockNumber(0)},
|
||||
23: {`18446744073709551615`, true, BlockNumber(0)},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
|
|||
Loading…
Reference in a new issue