Skip to content

Commit

Permalink
Remove test macro
Browse files Browse the repository at this point in the history
Going above 20 was quickly becoming too slow anyway, so no real point in adding an extra dependency and more indirection.
  • Loading branch information
theodorebugnet committed Sep 1, 2024
1 parent 36ac9dd commit 879a827
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ borsh = { version = "1" }
serde_json = "1.0.96"
postcard = { version = "1.0.4", features = ["use-std"] }
tendermint = { version = "0.35.0" }
paste = "1.0.15"

[features]
default = ["std"]
Expand Down
26 changes: 9 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ mod tests {
simple_merkle::db::MemDb,
NamespaceMerkleTree, NamespacedHash, RangeProofType, CELESTIA_NS_ID_SIZE,
};
use paste::paste;

type DefaultNmt<const NS_ID_SIZE: usize> = NamespaceMerkleTree<
MemDb<NamespacedHash<NS_ID_SIZE>>,
Expand Down Expand Up @@ -649,24 +648,17 @@ mod tests {
test_min_and_max_ns_against(&mut tree)
}

macro_rules! make_narrowing_test {
($($x:literal),*) => {
$(
paste! {
#[test]
fn [<test_range_proof_narrowing_ $x>]() {
test_range_proof_narrowing_with_n_leaves::<8>($x);
test_range_proof_narrowing_with_n_leaves::<17>($x);
test_range_proof_narrowing_with_n_leaves::<24>($x);
test_range_proof_narrowing_with_n_leaves::<CELESTIA_NS_ID_SIZE>($x);
test_range_proof_narrowing_with_n_leaves::<32>($x);
}
})*
};
#[test]
fn test_range_proof_narrowing() {
for x in 0..20 {
test_range_proof_narrowing_with_n_leaves::<8>(x);
test_range_proof_narrowing_with_n_leaves::<17>(x);
test_range_proof_narrowing_with_n_leaves::<24>(x);
test_range_proof_narrowing_with_n_leaves::<CELESTIA_NS_ID_SIZE>(x);
test_range_proof_narrowing_with_n_leaves::<32>(x);
}
}

make_narrowing_test!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 40);

fn test_completeness_check_impl<const NS_ID_SIZE: usize>() {
// Build a tree with 32 leaves spread evenly across 8 namespaces
let mut tree = DefaultNmt::<NS_ID_SIZE>::new();
Expand Down

0 comments on commit 879a827

Please sign in to comment.