Skip to content

Commit

Permalink
Adds messages to assertions in the execution tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Sep 23, 2023
1 parent 7d8ede8 commit 0ce8221
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ macro_rules! test_interpreter_and_jit {
None
);
let (instruction_count_interpreter, result) = vm.execute_program(&$executable, true);
assert_eq!(format!("{:?}", result), expected_result);
if result.is_ok() {
assert_eq!(
instruction_count_interpreter, expected_instruction_count,
"Instruction meter did not consume expected amount",
);
}
assert_eq!(
format!("{:?}", result),
expected_result,
"Unexpected result for Interpreter"
);
(
instruction_count_interpreter,
vm.context_object_pointer.clone(),
Expand All @@ -92,11 +90,14 @@ macro_rules! test_interpreter_and_jit {
None
);
match compilation_result {
Err(err) => assert_eq!(format!("{:?}", err), expected_result),
Err(err) => assert_eq!(
format!("{:?}", err),
expected_result,
"Unexpected result for JIT compilation"
),
Ok(()) => {
let (instruction_count_jit, result) = vm.execute_program(&$executable, false);
let tracer_jit = &vm.context_object_pointer;
assert_eq!(format!("{:?}", result), expected_result);
if !TestContextObject::compare_trace_log(&_tracer_interpreter, tracer_jit) {
let analysis = Analysis::from_executable(&$executable).unwrap();
let stdout = std::io::stdout();
Expand All @@ -111,6 +112,11 @@ macro_rules! test_interpreter_and_jit {
.unwrap();
panic!();
}
assert_eq!(
format!("{:?}", result),
expected_result,
"Unexpected result for JIT"
);
assert_eq!(
instruction_count_interpreter, instruction_count_jit,
"Interpreter and JIT instruction meter diverged",
Expand All @@ -119,7 +125,10 @@ macro_rules! test_interpreter_and_jit {
}
}
if $executable.get_config().enable_instruction_meter {
assert_eq!(instruction_count_interpreter, expected_instruction_count);
assert_eq!(
instruction_count_interpreter, expected_instruction_count,
"Instruction meter did not consume expected amount"
);
}
};
}
Expand Down

0 comments on commit 0ce8221

Please sign in to comment.