Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tooling/ast_fuzzer/src/compare/compiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ impl Comparable for InputValue {

impl std::fmt::Display for NargoErrorWithTypes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
if let Some(msg) = self.user_defined_failure_message() {
write!(f, "{}: {}", self.0, msg)
} else {
std::fmt::Display::fmt(&self.0, f)
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion tooling/ast_fuzzer/src/compare/interpreted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ impl Comparable for ssa::interpreter::errors::InterpreterError {
BinaryOp::Add { unchecked: false } => msg == "attempt to add with overflow",
BinaryOp::Sub { unchecked: false } => msg == "attempt to subtract with overflow",
BinaryOp::Mul { unchecked: false } => msg == "attempt to multiply with overflow",
BinaryOp::Shl | BinaryOp::Shr => msg == "attempt to bit-shift with overflow",
BinaryOp::Shl | BinaryOp::Shr => {
msg == "attempt to bit-shift with overflow"
|| msg == "attempt to shift right with overflow"
|| msg == "attempt to shift left with overflow"
}
_ => false,
},
(
Expand Down
4 changes: 2 additions & 2 deletions tooling/ast_fuzzer/src/compare/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ where
}
CompareResult::LeftFailed(e, _) => {
let e = &e.error;
bail!("first program failed: {e}\n{e:?}")
bail!("first program failed: {e}\n\n{e:?}")
}
CompareResult::RightFailed(_, e) => {
let e = &e.error;
bail!("second program failed: {e}\n{e:?}")
bail!("second program failed: {e}\n\n{e:?}")
}
CompareResult::BothPassed(o1, o2) => match (&o1.return_value, &o2.return_value) {
(Some(r1), Some(r2)) if !Comparable::equivalent(r1, r2) => {
Expand Down
4 changes: 2 additions & 2 deletions tooling/ast_fuzzer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Default for Config {
("assign", 30),
("if", 10),
("match", 10),
("for", 25),
("for", 30),
("let", 25),
("call", 5),
("constrain", 4),
Expand All @@ -120,7 +120,7 @@ impl Default for Config {
("let", 20),
("call", 5),
("print", 15),
("constrain", 10),
("constrain", 15),
]);
Self {
max_globals: 3,
Expand Down
Loading