decaying hashset unit test fixes

pull/1561/head
Jeff Becker 3 years ago
parent 5fd15fa044
commit 4cf0f1ee35
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -23,17 +23,17 @@ TEST_CASE("DecayingHashSet test decay static time", "[decaying-hashset]")
TEST_CASE("DecayingHashSet test decay dynamic time", "[decaying-hashset]") TEST_CASE("DecayingHashSet test decay dynamic time", "[decaying-hashset]")
{ {
static constexpr llarp_time_t timeout = 5s; static constexpr llarp_time_t timeout = 5s;
constexpr auto now = llarp::time_now_ms; const auto now = llarp::time_now_ms();
llarp::util::DecayingHashSet<llarp::RouterID> hashset{timeout}; llarp::util::DecayingHashSet<llarp::RouterID> hashset{timeout};
const llarp::RouterID zero{}; const llarp::RouterID zero{};
REQUIRE(zero.IsZero()); REQUIRE(zero.IsZero());
REQUIRE(not hashset.Contains(zero)); REQUIRE(not hashset.Contains(zero));
REQUIRE(hashset.Insert(zero)); REQUIRE(hashset.Insert(zero, now));
REQUIRE(hashset.Contains(zero)); REQUIRE(hashset.Contains(zero));
hashset.Decay(now() + 1s); hashset.Decay(now + 1s);
REQUIRE(hashset.Contains(zero)); REQUIRE(hashset.Contains(zero));
hashset.Decay(now() + timeout); hashset.Decay(now + timeout);
REQUIRE(not hashset.Contains(zero)); REQUIRE(not hashset.Contains(zero));
hashset.Decay(now() + timeout + 1s); hashset.Decay(now + timeout + 1s);
REQUIRE(not hashset.Contains(zero)); REQUIRE(not hashset.Contains(zero));
} }

Loading…
Cancel
Save