From 22bbccffdc00eb15b14e9219e34183d467e2833d Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 8 Dec 2023 22:27:47 +0000 Subject: [PATCH 1/2] Add maxims failure test case Co-authored-by: Maxim Vezenov --- .../execution_success/unexpected_panic/Nargo.toml | 7 +++++++ .../execution_success/unexpected_panic/Prover.toml | 1 + .../execution_success/unexpected_panic/src/main.nr | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 test_programs/execution_success/unexpected_panic/Nargo.toml create mode 100644 test_programs/execution_success/unexpected_panic/Prover.toml create mode 100644 test_programs/execution_success/unexpected_panic/src/main.nr diff --git a/test_programs/execution_success/unexpected_panic/Nargo.toml b/test_programs/execution_success/unexpected_panic/Nargo.toml new file mode 100644 index 00000000000..f400bd9dad6 --- /dev/null +++ b/test_programs/execution_success/unexpected_panic/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "unexpected_panic" +version = "0.1.0" +type = "bin" +authors = [""] + +[dependencies] diff --git a/test_programs/execution_success/unexpected_panic/Prover.toml b/test_programs/execution_success/unexpected_panic/Prover.toml new file mode 100644 index 00000000000..bde6a61ff65 --- /dev/null +++ b/test_programs/execution_success/unexpected_panic/Prover.toml @@ -0,0 +1 @@ +y = "4" diff --git a/test_programs/execution_success/unexpected_panic/src/main.nr b/test_programs/execution_success/unexpected_panic/src/main.nr new file mode 100644 index 00000000000..09e0eae9494 --- /dev/null +++ b/test_programs/execution_success/unexpected_panic/src/main.nr @@ -0,0 +1,10 @@ +struct Bar { + inner: [Field; 3], +} + +fn main(y: pub u32) { + let bar = Bar { inner: [100, 101, 102] }; + if y < 10 { + assert(bar.inner == [100, 101, 102]); + } +} From d671977c66721ec6906adef01a3062bdd94b06ec Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 8 Dec 2023 22:44:34 +0000 Subject: [PATCH 2/2] Update main.nr --- .../unexpected_panic/src/main.nr | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test_programs/execution_success/unexpected_panic/src/main.nr b/test_programs/execution_success/unexpected_panic/src/main.nr index 09e0eae9494..567ea7935b5 100644 --- a/test_programs/execution_success/unexpected_panic/src/main.nr +++ b/test_programs/execution_success/unexpected_panic/src/main.nr @@ -1,10 +1,17 @@ struct Bar { - inner: [Field; 3], -} + inner: [Field; 3], + } -fn main(y: pub u32) { - let bar = Bar { inner: [100, 101, 102] }; - if y < 10 { - assert(bar.inner == [100, 101, 102]); - } -} + fn main(y: pub u32) { + let bar = Bar { inner: [100, 101, 102] }; + + // The assert inside the if should be hit + if y < 10 { + assert(bar.inner == [100, 101, 102]); + } + + // The assert inside the if should not be hit + if y > 10 { + assert(bar.inner == [0, 1, 2]); + } + }