Skip to content

Commit

Permalink
refactor: minor test cleanup (#9339)
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan authored Oct 22, 2024
1 parent e6db535 commit a2ed567
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
5 changes: 1 addition & 4 deletions noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ mod test {
127, 182, 227, 75, 192, 197, 54, 47, 168, 134, 233, 148, 251, 46, 86, 12, 73, 50, 238, 50, 31, 174, 27, 202, 110, 77, 161, 197, 244, 124, 17, 100, 143, 150, 232, 14, 156, 248, 43, 177, 16, 82, 244, 103, 88, 74, 84, 200, 15, 65, 187, 14, 163, 60, 91, 22, 104, 31, 211, 190, 124, 121, 79, 92, 239, 65, 185, 106, 51, 178, 168, 137, 84, 43, 79, 158, 151, 152, 83, 42, 170, 13, 106, 209, 254, 74, 39, 145, 73, 215, 17, 234, 196, 89, 30, 58, 120, 127, 88, 69, 121, 61, 18, 206, 89, 118, 243, 238, 177, 71, 73, 47, 147, 4, 155, 25, 173, 248, 206, 52, 17, 180, 122, 186, 106, 191, 252, 102, 197, 91, 16, 39, 94, 91, 224, 30, 168, 177, 26, 144, 5, 124, 128, 6
];

for i in 0..outgoing_body_ciphertext_from_typescript.len() {
assert_eq(ciphertext[i], outgoing_body_ciphertext_from_typescript[i]);
}
assert_eq(outgoing_body_ciphertext_from_typescript.len(), ciphertext.len());
assert_eq(outgoing_body_ciphertext_from_typescript, ciphertext);
}
}
11 changes: 2 additions & 9 deletions noir-projects/aztec-nr/aztec/src/utils/point.nr
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ mod test {
let expected_compressed_point_positive_sign = [
154, 244, 31, 93, 233, 100, 70, 220, 55, 118, 161, 235, 45, 152, 187, 149, 107, 122, 205, 153, 121, 166, 120, 84, 190, 198, 250, 124, 41, 115, 189, 115
];

assert_eq(expected_compressed_point_positive_sign.len(), compressed_point.len());
for i in 0..expected_compressed_point_positive_sign.len() {
assert_eq(compressed_point[i], expected_compressed_point_positive_sign[i]);
}
assert_eq(expected_compressed_point_positive_sign, compressed_point);
}

#[test]
Expand All @@ -68,9 +64,6 @@ mod test {
36, 115, 113, 101, 46, 85, 221, 116, 201, 175, 141, 190, 159, 180, 73, 49, 186, 41, 169, 34, 153, 148, 56, 75, 215, 7, 119, 150, 193, 78, 226, 181
];

assert_eq(expected_compressed_point_negative_sign.len(), compressed_point.len());
for i in 0..expected_compressed_point_negative_sign.len() {
assert_eq(compressed_point[i], expected_compressed_point_negative_sign[i]);
}
assert_eq(expected_compressed_point_negative_sign, compressed_point);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,15 @@ unconstrained fn bytes_field_test() {
];
let field = field_from_bytes(inputs, true);
let return_bytes: [u8; 31] = field.to_be_bytes();
for i in 0..31 {
assert_eq(inputs[i], return_bytes[i]);
}
assert_eq(inputs, return_bytes);
// 32 bytes - we remove the final byte, and check it matches the field
let inputs2 = [
84, 62, 10, 102, 66, 255, 235, 128, 57, 41, 104, 97, 118, 90, 83, 64, 123, 186, 98, 189, 28, 151, 202, 67, 55, 77, 233, 80, 187, 224, 167, 158
];
let field2 = field_from_bytes_32_trunc(inputs2);
let return_bytes2: [u8; 31] = field.to_be_bytes();

for i in 0..31 {
assert_eq(return_bytes2[i], return_bytes[i]);
}
assert_eq(return_bytes2, return_bytes);
assert_eq(field2, field);
}

Expand Down

0 comments on commit a2ed567

Please sign in to comment.