Skip to content

Commit

Permalink
chore(brillig): added tests for all field binary operations (#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirasistant authored Jun 7, 2023
1 parent 06543b5 commit 3c9f106
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Tests arithmetic operations on fields
fn main() {
let x = 4;
let y = 2;
assert((x + y) == add(x, y));
assert((x - y) == sub(x, y));
assert((x * y) == mul(x, y));
assert((x / y) == div(x, y));
}

unconstrained fn add(x : Field, y : Field) -> Field {
x + y
}

unconstrained fn sub(x : Field, y : Field) -> Field {
x - y
}

unconstrained fn mul(x : Field, y : Field) -> Field {
x * y
}

unconstrained fn div(x : Field, y : Field) -> Field {
x / y
}

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

0 comments on commit 3c9f106

Please sign in to comment.