Skip to content

Commit

Permalink
Don't ignore results in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle committed Nov 15, 2023
1 parent 02533dc commit 603f8c6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions firewood/tests/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ fn merkle_build_test<K: AsRef<[u8]> + std::cmp::Ord + Clone, V: AsRef<[u8]> + Cl
}

#[test]
#[allow(unused_must_use)]
fn test_root_hash_simple_insertions() {
fn test_root_hash_simple_insertions() -> Result<(), DataStoreError> {
let items = vec![
("do", "verb"),
("doe", "reindeer"),
Expand All @@ -40,13 +39,15 @@ fn test_root_hash_simple_insertions() {
("horse", "stallion"),
("ddd", "ok"),
];
let merkle = merkle_build_test(items, 0x10000, 0x10000).unwrap();
merkle.dump();
let merkle = merkle_build_test(items, 0x10000, 0x10000)?;

merkle.dump()?;

Ok(())
}

#[test]
#[allow(unused_must_use)]
fn test_root_hash_fuzz_insertions() {
fn test_root_hash_fuzz_insertions() -> Result<(), DataStoreError> {
use rand::{rngs::StdRng, Rng, SeedableRng};
let rng = std::cell::RefCell::new(StdRng::seed_from_u64(42));
let max_len0 = 8;
Expand All @@ -65,14 +66,17 @@ fn test_root_hash_fuzz_insertions() {
.collect();
key
};

for _ in 0..10 {
let mut items = Vec::new();
for _ in 0..10 {
let val: Vec<u8> = (0..8).map(|_| rng.borrow_mut().gen()).collect();
items.push((keygen(), val));
}
merkle_build_test(items, 0x1000000, 0x1000000);
merkle_build_test(items, 0x1000000, 0x1000000)?;
}

Ok(())
}

#[test]
Expand Down

0 comments on commit 603f8c6

Please sign in to comment.