Skip to content

Commit

Permalink
test(plonky2_prove): Add tests for casts from lower signed type bit l…
Browse files Browse the repository at this point in the history
…ength to higher
  • Loading branch information
Syndamia committed Sep 17, 2024
1 parent 8efef27 commit bedd2d3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test_programs/plonky2_prove_failure/signed_casts/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "signed_casts"
type = "bin"
authors = [""]
compiler_version = ">=0.27.0"

[dependencies]

3 changes: 3 additions & 0 deletions test_programs/plonky2_prove_failure/signed_casts/Prover.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x = [ -128, 127 ]
y = [ -128, 127 ]
z = [ -128, 127 ]
10 changes: 10 additions & 0 deletions test_programs/plonky2_prove_failure/signed_casts/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn main(x: [i8; 2], y: [i16; 2], z: [i32; 2]) {
for i in 0..1 {
// i8 -> i16
assert(x[i] as i16 == y[i]);
// i8 -> i32
assert(x[i] as i32 == z[i]);
// i16 -> i32
assert(y[i] as i32 == z[i]);
}
}

0 comments on commit bedd2d3

Please sign in to comment.