-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Divide by zero should fail to satisfy constraints for
Field
an…
…d ints (#2475)
- Loading branch information
Showing
12 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
crates/nargo_cli/tests/compile_failure/div_by_zero_constants/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,7 @@ | ||
[package] | ||
name = "divide_by_zero" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.10.3" | ||
|
||
[dependencies] |
Empty file.
6 changes: 6 additions & 0 deletions
6
crates/nargo_cli/tests/compile_failure/div_by_zero_constants/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,6 @@ | ||
use dep::std; | ||
|
||
fn main() { | ||
let a: Field = 3 / 0; | ||
std::println(a); | ||
} |
7 changes: 7 additions & 0 deletions
7
crates/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/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,7 @@ | ||
[package] | ||
name = "div_by_zero_numerator_witness" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.10.3" | ||
|
||
[dependencies] |
1 change: 1 addition & 0 deletions
1
crates/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/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 = "3" |
6 changes: 6 additions & 0 deletions
6
crates/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/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,6 @@ | ||
use dep::std; | ||
|
||
fn main(x: Field) { | ||
let a: Field = x / 0; | ||
std::println(a); | ||
} |
7 changes: 7 additions & 0 deletions
7
crates/nargo_cli/tests/compile_failure/div_by_zero_witness/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,7 @@ | ||
[package] | ||
name = "div_by_zero_witness" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.10.3" | ||
|
||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
crates/nargo_cli/tests/compile_failure/div_by_zero_witness/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,2 @@ | ||
x = "3" | ||
y = "0" |
7 changes: 7 additions & 0 deletions
7
crates/nargo_cli/tests/compile_failure/div_by_zero_witness/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,7 @@ | ||
use dep::std; | ||
|
||
// It is expected that `y` must be equal to 0. | ||
fn main(x : Field, y : pub Field) { | ||
let a: Field = x / y; | ||
std::println(a); | ||
} |
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
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
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