rlp: fix test_object_serialization

This commit is contained in:
andri lim 2020-04-09 18:59:30 +07:00 committed by zah
parent 3f1d6e2922
commit fb6e27d698
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import
type type
Transaction = object Transaction = object
amount: int amount: int
time: DateTime time: Time
sender: string sender: string
receiver: string receiver: string
@ -52,13 +52,13 @@ test "encoding and decoding an object":
check: check:
originalBar == restoredBar originalBar == restoredBar
var t1 = Transaction(time: now(), amount: 1000, sender: "Alice", receiver: "Bob") var t1 = Transaction(time: getTime(), amount: 1000, sender: "Alice", receiver: "Bob")
bytes = encode(t1) bytes = encode(t1)
var t2 = bytes.decode(Transaction) var t2 = bytes.decode(Transaction)
check: check:
bytes.hexRepr == "cd85416c69636583426f628203e8" # verifies that Alice comes first bytes.hexRepr == "cd85416c69636583426f628203e8" # verifies that Alice comes first
t2.time == default(DateTime) t2.time == default(Time)
t2.sender == "Alice" t2.sender == "Alice"
t2.receiver == "Bob" t2.receiver == "Bob"
t2.amount == 1000 t2.amount == 1000