mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 21:34:33 +00:00
Included tests for EthAddressStr
This commit is contained in:
parent
e4d1c6817a
commit
6aab8b05c5
@ -97,3 +97,28 @@ proc doHexStrTests* =
|
||||
source = "0x0123"
|
||||
x = hexDataStr source
|
||||
check %x == %source
|
||||
|
||||
suite "[RPC] Eth address strings":
|
||||
test "Valid address":
|
||||
let
|
||||
e = "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
|
||||
e_addr = e.ethAddressStr
|
||||
check e == e_addr.string
|
||||
let
|
||||
short_e = "0x0f572e5295c57f"
|
||||
short_e_addr = short_e.ethAddressStr
|
||||
check short_e == short_e_addr.string
|
||||
test "Too long":
|
||||
expect ValueError:
|
||||
let
|
||||
# too long
|
||||
e = "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec66"
|
||||
e_addr = e.ethAddressStr
|
||||
check e == e_addr.string
|
||||
test "Wrong format":
|
||||
expect ValueError:
|
||||
let
|
||||
# too long
|
||||
e = "000f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
|
||||
e_addr = e.ethAddressStr
|
||||
check e == e_addr.string
|
||||
|
Loading…
x
Reference in New Issue
Block a user