Skip to content

Commit

Permalink
chore: replace constrain with assert()
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed May 2, 2023
1 parent f5e5dd1 commit c96aa04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions crates/nargo_cli/tests/test_data/bit_shifts_comptime/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ fn main(x: u64) {
let three: u64 = 3;

// comptime shifts on comptime values
constrain two << 2 == 8;
constrain (two << 3) / 8 == two;
constrain (three >> 1) == 1;
assert(two << 2 == 8);
assert((two << 3) / 8 == two);
assert((three >> 1) == 1);

// comptime shifts on runtime values
constrain x << 1 == 128;
constrain x >> 2 == 16;
assert(x << 1 == 128);
assert(x >> 2 == 16);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ fn main(x: u64, y: u64) {
// See: https://github.com/noir-lang/noir/issues/1265

// runtime shifts on comptime values
constrain 64 << y == 128;
constrain 64 >> y == 32;
assert(64 << y == 128);
assert(64 >> y == 32);

// runtime shifts on runtime values
constrain x << y == 128;
constrain x >> y == 32;
assert(x << y == 128);
assert(x >> y == 32);
}

0 comments on commit c96aa04

Please sign in to comment.