Skip to content

Commit

Permalink
fix bug in parser's property test: generate only valid labels for call
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Jan 23, 2023
1 parent bbe4aa8 commit 9e4fcb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion triton-opcodes/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,12 @@ mod parser_tests {

fn label_gen(size: usize) -> String {
let mut rng = rand::thread_rng();
(0..size).map(|_| rng.gen_range('a'..='z')).collect()
let mut new_label = || -> String { (0..size).map(|_| rng.gen_range('a'..='z')).collect() };
let mut label = new_label();
while is_instruction_name(&label) {
label = new_label();
}
label
}

fn new_label_gen(labels: &mut Vec<String>) -> String {
Expand Down
3 changes: 1 addition & 2 deletions triton-vm/src/shared_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ pub fn parse_setup_simulate(
) -> (AlgebraicExecutionTrace, Vec<BFieldElement>, Program) {
let program = Program::from_code(code);

assert!(program.is_ok(), "program parses correctly");
let program = program.unwrap();
let program = program.expect("Program must parse.");

prof_start!(maybe_profiler, "simulate");
let (aet, stdout, err) = simulate(&program, input_symbols, secret_input_symbols);
Expand Down

0 comments on commit 9e4fcb7

Please sign in to comment.