Skip to content

Commit

Permalink
chore: format integration tests (#3257)
Browse files Browse the repository at this point in the history
Co-authored-by: jfecher <[email protected]>
  • Loading branch information
kek kek kek and jfecher authored Oct 27, 2023
1 parent cb5a15b commit 5b2b1a8
Show file tree
Hide file tree
Showing 96 changed files with 279 additions and 406 deletions.
10 changes: 2 additions & 8 deletions compiler/integration-tests/circuits/recursion/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ fn main(
public_inputs : [Field; 1],
key_hash : Field,
input_aggregation_object : [Field; 16],
) -> pub [Field;16]{
) -> pub [Field; 16] {
let vk : [Field] = verification_key;
let p : [Field] = proof;
let pi : [Field] = public_inputs;
std::verify_proof(
vk,
p,
pi,
key_hash,
input_aggregation_object
)
std::verify_proof(vk, p, pi, key_hash, input_aggregation_object)
}
2 changes: 1 addition & 1 deletion compiler/wasm/fixtures/simple/noir-script/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main(x : u64, y : pub u64) {
assert(x < y);
assert(x < y);
}
9 changes: 1 addition & 8 deletions noir_stdlib/src/eddsa.nr
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub fn eddsa_poseidon_verify(
) -> bool {
// Verifies by testing:
// S * B8 = R8 + H(R8, A, m) * A8

let bjj = baby_jubjub();

let pub_key = TEPoint::new(pub_key_x, pub_key_y);
Expand All @@ -46,13 +45,7 @@ pub fn eddsa_poseidon_verify(
assert(lt_bytes32(signature_s, bjj.suborder));

// Calculate the h = H(R, A, msg)
let hash: Field = poseidon::bn254::hash_5([
signature_r8_x,
signature_r8_y,
pub_key_x,
pub_key_y,
message,
]);
let hash: Field = poseidon::bn254::hash_5([signature_r8_x, signature_r8_y, pub_key_x, pub_key_y, message]);

// Calculate second part of the right side: right2 = h*8*A

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is using assert on brillig
fn main(x: Field) {
fn main(x: Field) {
assert(1 == conditional(x as bool));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ use dep::std;
fn main() {
let a: Field = 3 / 0;
std::println(a);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fn main() {
let a: u32 = 6;
let b = 3;
let c = 0;
let res = (a*b) % c;
assert(res != 5);
}
let b = 3;
let c = 0;
let res = (a * b) % c;
assert(res != 5);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ mod module1;
mod module2;
mod module3;

fn main() {
}
fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ mod module2;
mod module3;
mod module4;

fn main() {
}
fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ fn hello(x : Field) -> Field {

fn hello(x : Field) -> Field {
x
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ struct Foo {

fn main(mut x : [Foo; 3], y : pub Field) {
assert(x[y + 2].a == 5);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ fn main(mut x: [u32; 5], z: Field) {
// }
// }
// assert(x[idx] != 0);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

fn main(x: Field) -> pub Field {
x % 2
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
let x:u8 = -1;
let y:u8 = 300;
assert(x!=y);
assert(x != y);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ fn main(x : Field, y : pub Field) {
}

slice = slice.insert(10, 100);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ fn main(x : Field, y : pub Field) {
}

let (removed_slice, removed_elem) = slice.remove(10);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ contract Foo {

#[contract_library_method]
fn has_mut(_context : &mut PlaceholderStruct) {}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

fn main() {
another_func()
}

#[aztec(private)]
#[internal]
fn another_func() {}
fn another_func() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

fn main() {
let a = &mut &mut &mut [1, 2, 3];
assert(a[0] == 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Tests arithmetic operations on fields
fn main() {
fn main() {
let x = 4;
let y = 2;
assert((x + y) == add(x, y));
Expand All @@ -22,4 +22,4 @@ unconstrained fn mul(x : Field, y : Field) -> Field {

unconstrained fn div(x : Field, y : Field) -> Field {
x / y
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ unconstrained fn main() {
let le_bit = le_bits_x[3-i];
assert(be_bit == le_bit);
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

fn ret_normal_lambda1() -> fn() -> Field {
|| 10
}
Expand Down Expand Up @@ -70,10 +69,10 @@ fn main() {
assert(accepts_closure3(|| y as u64 + z) == 70);

let w = 50;
assert(add_results(|| 100, || x ) == 150);
assert(add_results(|| x + 100, || w + x ) == 250);
assert(add_results(|| 100, || x) == 150);
assert(add_results(|| x + 100, || w + x) == 250);

let arr = [1,2,3,4];
let arr = [1, 2, 3, 4];

assert(map(arr, |n| n + 1) == [2, 3, 4, 5]);
assert(map(arr, |n| n + x) == [51, 52, 53, 54]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

fn main() {
let unsorted: [u8; 3] = [3,1,2];
let unsorted: [u8; 3] = [3, 1, 2];
let sorted = unsorted.sort();
assert(sorted[0] == 1);
assert(sorted[1] == 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,5 @@ fn main(x: Field) -> pub Field {
}

fn safe_inverse(n: Field) -> Field {
if n == 0 {
0
}
else {
1 / n
}
if n == 0 { 0 } else { 1 / n }
}
Loading

0 comments on commit 5b2b1a8

Please sign in to comment.