From 86369e1f3e5f3c7038a8be32e2e4368b68b459df Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Fri, 27 Sep 2024 15:12:58 +0300 Subject: [PATCH] test: Add right bitshift tests --- .../right_shift_signed_const/Nargo.toml | 8 ++++++++ .../right_shift_signed_const/Prover.toml | 2 ++ .../right_shift_signed_const/src/main.nr | 6 ++++++ .../right_shift_const_unsigned/Nargo.toml | 8 ++++++++ .../right_shift_const_unsigned/Prover.toml | 2 ++ .../right_shift_const_unsigned/src/main.nr | 6 ++++++ .../right_shift_signed_unsigned/Nargo.toml | 8 ++++++++ .../right_shift_signed_unsigned/Prover.toml | 3 +++ .../right_shift_signed_unsigned/src/main.nr | 7 +++++++ .../right_shift_unsigned_unsigned/Nargo.toml | 8 ++++++++ .../right_shift_unsigned_unsigned/Prover.toml | 3 +++ .../right_shift_unsigned_unsigned/src/main.nr | 7 +++++++ .../right_shift_unsigned_const/Nargo.toml | 8 ++++++++ .../right_shift_unsigned_const/Prover.toml | 2 ++ .../right_shift_unsigned_const/src/main.nr | 6 ++++++ 15 files changed, 84 insertions(+) create mode 100644 test_programs/plonky2_prove_crash/right_shift_signed_const/Nargo.toml create mode 100644 test_programs/plonky2_prove_crash/right_shift_signed_const/Prover.toml create mode 100644 test_programs/plonky2_prove_crash/right_shift_signed_const/src/main.nr create mode 100644 test_programs/plonky2_prove_failure/right_shift_const_unsigned/Nargo.toml create mode 100644 test_programs/plonky2_prove_failure/right_shift_const_unsigned/Prover.toml create mode 100644 test_programs/plonky2_prove_failure/right_shift_const_unsigned/src/main.nr create mode 100644 test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Nargo.toml create mode 100644 test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Prover.toml create mode 100644 test_programs/plonky2_prove_failure/right_shift_signed_unsigned/src/main.nr create mode 100644 test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Nargo.toml create mode 100644 test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Prover.toml create mode 100644 test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/src/main.nr create mode 100644 test_programs/plonky2_prove_success/right_shift_unsigned_const/Nargo.toml create mode 100644 test_programs/plonky2_prove_success/right_shift_unsigned_const/Prover.toml create mode 100644 test_programs/plonky2_prove_success/right_shift_unsigned_const/src/main.nr diff --git a/test_programs/plonky2_prove_crash/right_shift_signed_const/Nargo.toml b/test_programs/plonky2_prove_crash/right_shift_signed_const/Nargo.toml new file mode 100644 index 00000000000..7bddf97c893 --- /dev/null +++ b/test_programs/plonky2_prove_crash/right_shift_signed_const/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "right_shift_signed_const" +type = "bin" +authors = [""] +compiler_version = ">=0.22.0" +version = "1.0.0" + +[dependencies] diff --git a/test_programs/plonky2_prove_crash/right_shift_signed_const/Prover.toml b/test_programs/plonky2_prove_crash/right_shift_signed_const/Prover.toml new file mode 100644 index 00000000000..55311988c30 --- /dev/null +++ b/test_programs/plonky2_prove_crash/right_shift_signed_const/Prover.toml @@ -0,0 +1,2 @@ +a = "-760" +b = "-95" diff --git a/test_programs/plonky2_prove_crash/right_shift_signed_const/src/main.nr b/test_programs/plonky2_prove_crash/right_shift_signed_const/src/main.nr new file mode 100644 index 00000000000..06453eaa6f6 --- /dev/null +++ b/test_programs/plonky2_prove_crash/right_shift_signed_const/src/main.nr @@ -0,0 +1,6 @@ +fn main( + a: i16, + b: i16, +) { + assert((a >> 3) == b); +} diff --git a/test_programs/plonky2_prove_failure/right_shift_const_unsigned/Nargo.toml b/test_programs/plonky2_prove_failure/right_shift_const_unsigned/Nargo.toml new file mode 100644 index 00000000000..7d24b87125c --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_const_unsigned/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "right_shift_const_unsigned" +type = "bin" +authors = [""] +compiler_version = ">=0.22.0" +version = "1.0.0" + +[dependencies] diff --git a/test_programs/plonky2_prove_failure/right_shift_const_unsigned/Prover.toml b/test_programs/plonky2_prove_failure/right_shift_const_unsigned/Prover.toml new file mode 100644 index 00000000000..19707ea4329 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_const_unsigned/Prover.toml @@ -0,0 +1,2 @@ +a = "3" +b = "71" diff --git a/test_programs/plonky2_prove_failure/right_shift_const_unsigned/src/main.nr b/test_programs/plonky2_prove_failure/right_shift_const_unsigned/src/main.nr new file mode 100644 index 00000000000..3feac7fc012 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_const_unsigned/src/main.nr @@ -0,0 +1,6 @@ +fn main( + a: u8, + b: u16, +) { + assert((568 >> a) == b); +} diff --git a/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Nargo.toml b/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Nargo.toml new file mode 100644 index 00000000000..06eb7e9a362 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "right_shift_signed_unsigned" +type = "bin" +authors = [""] +compiler_version = ">=0.22.0" +version = "1.0.0" + +[dependencies] diff --git a/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Prover.toml b/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Prover.toml new file mode 100644 index 00000000000..355a3b68e08 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/Prover.toml @@ -0,0 +1,3 @@ +a = "-760" +b = "3" +c = "-95" diff --git a/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/src/main.nr b/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/src/main.nr new file mode 100644 index 00000000000..fefbd2f7af3 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_signed_unsigned/src/main.nr @@ -0,0 +1,7 @@ +fn main( + a: i16, + b: u8, + c: i16, +) { + assert((a >> b) == c); +} diff --git a/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Nargo.toml b/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Nargo.toml new file mode 100644 index 00000000000..c88b32473e2 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "right_shift_unsigned_unsigned" +type = "bin" +authors = [""] +compiler_version = ">=0.22.0" +version = "1.0.0" + +[dependencies] diff --git a/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Prover.toml b/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Prover.toml new file mode 100644 index 00000000000..d83c9e96029 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/Prover.toml @@ -0,0 +1,3 @@ +a = "568" +b = "3" +c = "71" diff --git a/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/src/main.nr b/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/src/main.nr new file mode 100644 index 00000000000..cf41eb359a2 --- /dev/null +++ b/test_programs/plonky2_prove_failure/right_shift_unsigned_unsigned/src/main.nr @@ -0,0 +1,7 @@ +fn main( + a: u16, + b: u8, + c: u16, +) { + assert((a >> b) == c); +} diff --git a/test_programs/plonky2_prove_success/right_shift_unsigned_const/Nargo.toml b/test_programs/plonky2_prove_success/right_shift_unsigned_const/Nargo.toml new file mode 100644 index 00000000000..98f93b94343 --- /dev/null +++ b/test_programs/plonky2_prove_success/right_shift_unsigned_const/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "right_shift_unsigned_const" +type = "bin" +authors = [""] +compiler_version = ">=0.22.0" +version = "1.0.0" + +[dependencies] diff --git a/test_programs/plonky2_prove_success/right_shift_unsigned_const/Prover.toml b/test_programs/plonky2_prove_success/right_shift_unsigned_const/Prover.toml new file mode 100644 index 00000000000..fa86a5e3e2f --- /dev/null +++ b/test_programs/plonky2_prove_success/right_shift_unsigned_const/Prover.toml @@ -0,0 +1,2 @@ +a = "568" +b = "71" diff --git a/test_programs/plonky2_prove_success/right_shift_unsigned_const/src/main.nr b/test_programs/plonky2_prove_success/right_shift_unsigned_const/src/main.nr new file mode 100644 index 00000000000..ba1ec5a6eec --- /dev/null +++ b/test_programs/plonky2_prove_success/right_shift_unsigned_const/src/main.nr @@ -0,0 +1,6 @@ +fn main( + a: u16, + b: u16, +) { + assert((a >> 3) == b); +}