From e94a575f6c2585522566a28115c68095ba834ebb Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 13 Jan 2016 16:30:19 +0100 Subject: [PATCH] fixed code, added nonce and storage executive tests --- src/tests/executive.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tests/executive.rs b/src/tests/executive.rs index e76daa29e..0a345fe1b 100644 --- a/src/tests/executive.rs +++ b/src/tests/executive.rs @@ -237,8 +237,16 @@ fn do_json_test(json_data: &[u8]) -> Vec { let address = address_from_str(addr); //let balance = u256_from_json(&s["balance"]); - fail_unless(state.code(&address) == Some(bytes_from_json(&s["code"])), "code is incorrect"); + fail_unless(state.code(&address).unwrap_or(vec![]) == bytes_from_json(&s["code"]), "code is incorrect"); fail_unless(state.balance(&address) == u256_from_json(&s["balance"]), "balance is incorrect"); + fail_unless(state.nonce(&address) == u256_from_json(&s["nonce"]), "nonce is incorrect"); + + for (k, v) in s["storage"].as_object().unwrap() { + let key = H256::from(&u256_from_str(k)); + let val = H256::from(&u256_from_json(v)); + + fail_unless(state.storage_at(&address, &key) == val, "storage is incorrect"); + } }); }