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 19, 2024
1 parent 240c5ea commit eb22a17
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/accumulator/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,20 @@ 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())];

assert_eq!(Proof::get_next(&computed, &provided, 0, 0), Some(true));
assert_eq!(Proof::get_next(&computed, &provided, 1, 0), Some(false));
assert_eq!(Proof::get_next(&computed, &provided, 1, 1), Some(true));
assert_eq!(Proof::get_next(&computed, &provided, 1, 2), Some(true));
assert_eq!(Proof::get_next(&computed, &provided, 2, 2), None);
}

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

0 comments on commit eb22a17

Please sign in to comment.