Skip to content

Commit

Permalink
fix brillig globals unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Feb 7, 2025
1 parent fa4db3e commit d05a3e8
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,10 @@ mod tests {
if func_id.to_u32() == 1 {
assert_eq!(
artifact.byte_code.len(),
2,
1,
"Expected just a `Return`, but got more than a single opcode"
);
// TODO: Bring this back (https://github.com/noir-lang/noir/issues/7306)
// assert!(matches!(&artifact.byte_code[0], Opcode::Return));
assert!(matches!(&artifact.byte_code[0], Opcode::Return));
} else if func_id.to_u32() == 2 {
assert_eq!(
artifact.byte_code.len(),
Expand Down Expand Up @@ -345,17 +344,16 @@ mod tests {
if func_id.to_u32() == 1 {
assert_eq!(
artifact.byte_code.len(),
30,
2,
"Expected enough opcodes to initialize the globals"
);
// TODO: Bring this back (https://github.com/noir-lang/noir/issues/7306)
// let Opcode::Const { destination, bit_size, value } = &artifact.byte_code[0] else {
// panic!("First opcode is expected to be `Const`");
// };
// assert_eq!(destination.unwrap_direct(), GlobalSpace::start());
// assert!(matches!(bit_size, BitSize::Field));
// assert_eq!(*value, FieldElement::from(1u128));
// assert!(matches!(&artifact.byte_code[1], Opcode::Return));
let Opcode::Const { destination, bit_size, value } = &artifact.byte_code[0] else {
panic!("First opcode is expected to be `Const`");
};
assert_eq!(destination.unwrap_direct(), GlobalSpace::start());
assert!(matches!(bit_size, BitSize::Field));
assert_eq!(*value, FieldElement::from(1u128));
assert!(matches!(&artifact.byte_code[1], Opcode::Return));
} else if func_id.to_u32() == 2 || func_id.to_u32() == 3 {
// We want the entry point which uses globals (f2) and the entry point which calls f2 function internally (f3 through f4)
// to have the same globals initialized.
Expand Down

0 comments on commit d05a3e8

Please sign in to comment.