-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split runtime and comptime bitshift tests
- Loading branch information
1 parent
01be5d5
commit f5e5dd1
Showing
8 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
crates/nargo_cli/tests/test_data/bit_shifts_comptime/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x = 64 |
13 changes: 13 additions & 0 deletions
13
crates/nargo_cli/tests/test_data/bit_shifts_comptime/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn main(x: u64) { | ||
let two: u64 = 2; | ||
let three: u64 = 3; | ||
|
||
// comptime shifts on comptime values | ||
constrain two << 2 == 8; | ||
constrain (two << 3) / 8 == two; | ||
constrain (three >> 1) == 1; | ||
|
||
// comptime shifts on runtime values | ||
constrain x << 1 == 128; | ||
constrain x >> 2 == 16; | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data/bit_shifts_runtime/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
crates/nargo_cli/tests/test_data/bit_shifts_runtime/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
fn main(x: u64, y: u64) { | ||
// These are currently unimplemented and panic with "ShiftLeft and ShiftRight operations with shifts which are only known at runtime are not yet implemented." | ||
// See: https://github.com/noir-lang/noir/issues/1265 | ||
|
||
// runtime shifts on comptime values | ||
constrain 64 << y == 128; | ||
constrain 64 >> y == 32; | ||
|
||
// runtime shifts on runtime values | ||
constrain x << y == 128; | ||
constrain x >> y == 32; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters