test: add tests for proof & verify API

This commit is contained in:
Magamedrasul Ibragimov 2022-11-08 15:36:17 +03:00
parent ef4d821d3c
commit ccb66c61fb
2 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,10 @@ fn insert_delete() -> Result<()> {
assert_eq!(mt.root(), MyFr(roots[i])); assert_eq!(mt.root(), MyFr(roots[i]));
} }
for (i, &leaf) in leaves.iter().enumerate() {
assert!(mt.verify(&MyFr(leaf), &mt.proof(i)?));
}
for i in (0..leaves.len()).rev() { for i in (0..leaves.len()).rev() {
mt.delete(i)?; mt.delete(i)?;
} }

View File

@ -106,6 +106,10 @@ fn insert_delete() -> Result<()> {
assert_eq!(mt.root(), MyFr(roots[i])); assert_eq!(mt.root(), MyFr(roots[i]));
} }
for (i, &leaf) in leaves.iter().enumerate() {
assert!(mt.verify(&MyFr(leaf), &mt.proof(i)?));
}
for i in (0..leaves.len()).rev() { for i in (0..leaves.len()).rev() {
mt.delete(i)?; mt.delete(i)?;
} }