Skip to content

Commit

Permalink
add test for rust
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega committed Sep 10, 2024
1 parent 3d7762d commit 98f8721
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions rust/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ mod tests {
depth_limited_spec.min_depth = 2;
depth_limited_spec.max_depth = 4;


let mut max_prefix_length_too_large_spec = api::iavl_spec();
let inner_spec = max_prefix_length_too_large_spec.inner_spec.as_mut().unwrap();
inner_spec.max_prefix_length = 100;

let cases: HashMap<&'static str, ExistenceCase> = [
(
"empty proof fails",
Expand Down Expand Up @@ -616,19 +621,32 @@ mod tests {
proof: ExistenceProof {
key: b"foo".to_vec(),
value: b"bar".to_vec(),
leaf: Some(leaf),
leaf: Some(leaf.clone()),
path: vec![
valid_inner.clone(),
valid_inner.clone(),
valid_inner.clone(),
valid_inner.clone(),
valid_inner,
valid_inner.clone(),
],
},
spec: depth_limited_spec,
valid: false,
},
),
(
"rejects inner spec with max prefix length >= min prefix lenght + child size",
ExistenceCase {
proof: ExistenceProof {
key: b"foo".to_vec(),
value: b"bar".to_vec(),
leaf: Some(leaf),
path: vec![valid_inner],
},
spec: max_prefix_length_too_large_spec,
valid: false,
},
),
]
.into_iter()
.collect();
Expand Down

0 comments on commit 98f8721

Please sign in to comment.