Skip to content

Commit

Permalink
test: print error of failing assert_vector
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Oct 9, 2023
1 parent 8a0b667 commit 9bcdac2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions triton-vm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ impl Display for InstructionError {
let failing_index_lhs: usize = failing_position_lhs.into();
let failing_index_rhs = failing_index_lhs + DIGEST_LENGTH;
write!(f, "Vector assertion failed: ")?;
write!(f, "op_stack[{failing_index_lhs}] = {lhs} != ")?;
write!(f, "{rhs} = op_stack[{failing_index_rhs}]. ")?;
write!(f, "op_stack[{failing_index_lhs}] == {lhs} != ")?;
write!(f, "{rhs} == op_stack[{failing_index_rhs}]. ")?;
write!(f, "ip: {ip}, clk: {clk}")
}
InverseOfZero => write!(f, "0 does not have a multiplicative inverse"),
Expand Down Expand Up @@ -97,6 +97,17 @@ mod tests {
program.run([].into(), [].into()).unwrap();
}

#[test]
#[should_panic(expected = "op_stack[1] == 10 != 1 == op_stack[6]")]
fn print_unequal_vec_assert_error() {
let program = triton_program! {
push 4 push 3 push 2 push 1 push 0
push 4 push 3 push 2 push 10 push 0
assert_vector halt
};
program.run([].into(), [].into()).unwrap();
}

proptest! {
#[test]
fn assert_unequal_vec(
Expand Down

0 comments on commit 9bcdac2

Please sign in to comment.