Skip to content

Commit

Permalink
circuits: zk-circuits: valid-match-settle: Add match unit tests
Browse files Browse the repository at this point in the history
These tests are moved from the integration tests, they belong better
as unit tests for testing circuit boundary cases.
  • Loading branch information
joeykraut committed Nov 25, 2023
1 parent c711a92 commit e9a527e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions circuits/src/zk_circuits/valid_match_settle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,11 @@ mod tests {
fn test_valid_match__invalid_balance_mint() {
let (mut witness, statement) = dummy_witness_and_statement();

<<<<<<< HEAD
// Corrupt the mint
=======
// Switch the mint of the balance to be the wrong asset in the pair
>>>>>>> 1e36d44 (circuits: zk-circuits: valid-match-settle: Add match unit tests)
rand_branch!(witness.balance1.mint += 1u8, witness.balance2.mint += 1u8);
assert!(!check_constraint_satisfaction::<SizedValidMatchSettle>(
&witness, &statement
Expand Down Expand Up @@ -503,7 +507,11 @@ mod tests {
let mut rng = thread_rng();
let (mut witness, statement) = dummy_witness_and_statement();

<<<<<<< HEAD
// Change the max minus min amount
=======
// Add one to the max minus min amount
>>>>>>> 1e36d44 (circuits: zk-circuits: valid-match-settle: Add match unit tests)
witness.match_res.max_minus_min_amount = rng.next_u64();
assert!(!check_constraint_satisfaction::<SizedValidMatchSettle>(
&witness, &statement
Expand Down

0 comments on commit e9a527e

Please sign in to comment.