From 5b68c294af70a1d24708ac151daaf8ea309800c1 Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 11 Jan 2016 23:40:52 +0100 Subject: [PATCH] bring back removed tests, removed build warnings --- src/evm/jit.rs | 33 +++++++++++++++++++++++++++++++++ src/evm/tests.rs | 4 ++-- src/executive.rs | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/evm/jit.rs b/src/evm/jit.rs index 3fb3bb40c..fb71f3363 100644 --- a/src/evm/jit.rs +++ b/src/evm/jit.rs @@ -356,3 +356,36 @@ impl evm::Evm for JitEvm { } } +#[test] +fn test_to_and_from_u256() { + let u = U256::from_str("d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3").unwrap(); + let j = u.into_jit(); + let u2 = U256::from_jit(&j); + assert_eq!(u, u2); +} + +#[test] +fn test_to_and_from_h256() { + let h = H256::from_str("d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3").unwrap(); + let j: ::evmjit::I256 = h.clone().into_jit(); + let h2 = H256::from_jit(&j); + + assert_eq!(h, h2); + + let j: ::evmjit::H256 = h.clone().into_jit(); + let h2 = H256::from_jit(&j); + assert_eq!(h, h2); +} + +#[test] +fn test_to_and_from_address() { + let a = Address::from_str("2adc25665018aa1fe0e6bc666dac8fc2697ff9ba").unwrap(); + let j: ::evmjit::I256 = a.clone().into_jit(); + let a2 = Address::from_jit(&j); + + assert_eq!(a, a2); + + let j: ::evmjit::H256 = a.clone().into_jit(); + let a2 = Address::from_jit(&j); + assert_eq!(a, a2); +} diff --git a/src/evm/tests.rs b/src/evm/tests.rs index 7ee64e4cc..e3f81dd93 100644 --- a/src/evm/tests.rs +++ b/src/evm/tests.rs @@ -13,11 +13,11 @@ struct FakeLogEntry { #[derive(Default)] struct FakeExt { store: HashMap, - balances: HashMap, + _balances: HashMap, blockhashes: HashMap, codes: HashMap, logs: Vec, - suicide: HashSet
, + _suicides: HashSet
, info: EnvInfo } diff --git a/src/executive.rs b/src/executive.rs index d5ee4e701..c98191050 100644 --- a/src/executive.rs +++ b/src/executive.rs @@ -45,7 +45,7 @@ pub struct Executed { pub refunded: U256, /// Cumulative gas used in current block so far. /// - /// cumulative_gas_used = gas_used(t0) + gas_used(t1) + ... gas_used(tn) + /// `cumulative_gas_used = gas_used(t0) + gas_used(t1) + ... gas_used(tn)` /// /// where `tn` is current transaction. pub cumulative_gas_used: U256,