Skip to content

Commit

Permalink
Add recursive test for clock
Browse files Browse the repository at this point in the history
  • Loading branch information
sgdxbc committed Mar 22, 2024
1 parent 78868a5 commit 30f7d35
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crates/boson/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ mod tests {
static GENESIS_AND_CIRCUIT: OnceLock<(Clock<S>, ClockCircuit<S>)> = OnceLock::new();

#[test]
#[ignore]
fn malformed_counters() -> anyhow::Result<()> {
let (genesis, circuit) = GENESIS_AND_CIRCUIT.get_or_init(genesis_and_circuit);
genesis.verify(circuit)?;
Expand Down Expand Up @@ -394,4 +393,19 @@ mod tests {
let (genesis, circuit) = GENESIS_AND_CIRCUIT.get_or_init(genesis_and_circuit);
genesis.increment(0, index_secret(1), circuit).unwrap();
}

#[test]
#[should_panic]
fn malformed_counters_recursive() {
let (genesis, circuit) = GENESIS_AND_CIRCUIT.get_or_init(genesis_and_circuit);
let clock1 = genesis.increment(0, index_secret(0), circuit);
let Ok(mut clock1) = clock1 else {
return; // to trigger `should_panic` failure
};
clock1
.proof
.public_inputs
.clone_from(&genesis.proof.public_inputs);
clock1.merge(&clock1, circuit).unwrap();
}
}

0 comments on commit 30f7d35

Please sign in to comment.