From ccb66c61fb5a6466795a755c7f439da291eac50c Mon Sep 17 00:00:00 2001 From: Magamedrasul Ibragimov Date: Tue, 8 Nov 2022 15:36:17 +0300 Subject: [PATCH] test: add tests for proof & verify API --- tests/memory_keccak.rs | 4 ++++ tests/sled_keccak.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/memory_keccak.rs b/tests/memory_keccak.rs index 9b5bd97..5fdd6fe 100644 --- a/tests/memory_keccak.rs +++ b/tests/memory_keccak.rs @@ -91,6 +91,10 @@ fn insert_delete() -> Result<()> { 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() { mt.delete(i)?; } diff --git a/tests/sled_keccak.rs b/tests/sled_keccak.rs index 61fa15b..6c9f18e 100644 --- a/tests/sled_keccak.rs +++ b/tests/sled_keccak.rs @@ -106,6 +106,10 @@ fn insert_delete() -> Result<()> { 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() { mt.delete(i)?; }