From ad43079fdc31e9f3f481f9ef7dcc439abc3b5b97 Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 6 Jan 2016 10:37:21 +0100 Subject: [PATCH] test balance --- src/evm/jit.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/evm/jit.rs b/src/evm/jit.rs index c55c6d532..f236e4d22 100644 --- a/src/evm/jit.rs +++ b/src/evm/jit.rs @@ -364,4 +364,22 @@ mod tests { assert_eq!(state.storage_at(&caller, &H256::new()), H256::from_str("6005600055000000000000000000000000000000000000000000000000000000").unwrap()); } + + #[test] + fn test_balance() { + let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); + let mut data = RuntimeData::new(); + data.address = address.clone(); + data.caller = address.clone(); + data.gas = 0x174876e800; + data.code = "3331600055".from_hex().unwrap(); + + let mut state = State::new_temp(); + state.add_balance(&address, &U256::from(0x10)); + let mut env = Env::new(state, address.clone()); + let evm = JitEvm; + assert_eq!(evm.exec(data, &mut env), ReturnCode::Stop); + let state = env.state(); + assert_eq!(state.storage_at(&address, &H256::new()), H256::from(&U256::from(0x10))); + } }