From 7bf1dba6c9762031ed9e1e60d1fc3cec291615a1 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 28 Sep 2023 07:56:42 -0400 Subject: [PATCH] add cache tests --- .../src/traits/networking/combined_network.rs | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/crates/hotshot/src/traits/networking/combined_network.rs b/crates/hotshot/src/traits/networking/combined_network.rs index 664467012d..287dd35baf 100644 --- a/crates/hotshot/src/traits/networking/combined_network.rs +++ b/crates/hotshot/src/traits/networking/combined_network.rs @@ -85,6 +85,12 @@ impl Cache { fn contains(&self, hash: u64) -> bool { self.cache.contains(&hash) } + + /// Get the number of items in the cache + #[cfg(test)] + fn len(&self) -> usize { + self.cache.len() + } } /// Helper function to calculate a hash of a type that implements Hash @@ -406,3 +412,76 @@ impl, MEMBERSHIP: Membership