executive tests fixed

Conflicts:
	src/executive.rs
This commit is contained in:
debris
2016-01-16 04:59:53 +01:00
committed by Tomusdrw
parent a1a4c5a068
commit fa1f0d1cf4
4 changed files with 29 additions and 8 deletions

View File

@@ -97,3 +97,20 @@ macro_rules! evm_test(
}
}
);
#[macro_export]
macro_rules! evm_test_ignore(
($name_test: ident: $name_jit: ident, $name_int: ident) => {
#[test]
#[ignore]
#[cfg(feature = "jit")]
fn $name_jit() {
$name_test(Factory::new(VMType::Jit));
}
#[test]
#[ignore]
fn $name_int() {
$name_test(Factory::new(VMType::Interpreter));
}
}
);

View File

@@ -653,7 +653,7 @@ impl Interpreter {
let big_id = stack.pop_back();
let id = big_id.low_u64() as usize;
let max = id.wrapping_add(32);
let data = params.data.clone().unwrap();
let data = params.data.clone().unwrap_or(vec![]);
let bound = cmp::min(data.len(), max);
if id < bound && big_id < U256::from(data.len()) {
let mut v = data[id..bound].to_vec();
@@ -664,7 +664,7 @@ impl Interpreter {
}
},
instructions::CALLDATASIZE => {
stack.push(U256::from(params.data.clone().unwrap().len()));
stack.push(U256::from(params.data.clone().unwrap_or(vec![]).len()));
},
instructions::CODESIZE => {
stack.push(U256::from(code.len()));
@@ -675,10 +675,10 @@ impl Interpreter {
stack.push(U256::from(len));
},
instructions::CALLDATACOPY => {
self.copy_data_to_memory(mem, stack, &params.data.clone().unwrap());
self.copy_data_to_memory(mem, stack, &params.data.clone().unwrap_or(vec![]));
},
instructions::CODECOPY => {
self.copy_data_to_memory(mem, stack, &params.code.clone().unwrap());
self.copy_data_to_memory(mem, stack, &params.code.clone().unwrap_or(vec![]));
},
instructions::EXTCODECOPY => {
let address = u256_to_address(&stack.pop_back());