Skip to content

Commit

Permalink
tests: add a test to the new get_next func
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidson-Souza committed Jul 30, 2024
1 parent 1d5acbe commit 7e39fb5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/accumulator/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,37 @@ mod tests {
assert_eq!(cached_hashes, expected_cached_hashes);
}
}

#[test]
fn test_get_next() {
use super::Proof;
let computed = vec![(1, NodeHash::empty()), (3, NodeHash::empty())];
let provided = vec![(2, NodeHash::empty()), (4, NodeHash::empty())];
let mut computed_pos = 0;
let mut provided_pos = 0;

assert_eq!(
Proof::get_next(&computed, &provided, &mut computed_pos, &mut provided_pos),
Some((1, NodeHash::empty()))
);
assert_eq!(
Proof::get_next(&computed, &provided, &mut computed_pos, &mut provided_pos),
Some((2, NodeHash::empty()))
);
assert_eq!(
Proof::get_next(&computed, &provided, &mut computed_pos, &mut provided_pos),
Some((3, NodeHash::empty()))
);
assert_eq!(
Proof::get_next(&computed, &provided, &mut computed_pos, &mut provided_pos),
Some((4, NodeHash::empty()))
);
assert_eq!(
Proof::get_next(&computed, &provided, &mut computed_pos, &mut provided_pos),
None
);
}

#[test]
fn test_calc_next_positions() {
use super::Proof;
Expand Down

0 comments on commit 7e39fb5

Please sign in to comment.