From ea22e1cc3c456936d4b2fc5a470ec7957d57c0f4 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Sun, 29 Jan 2023 09:03:27 +0000 Subject: update unit test to track adjusted timing --- slobrok/src/tests/backoff/testbackoff.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'slobrok') diff --git a/slobrok/src/tests/backoff/testbackoff.cpp b/slobrok/src/tests/backoff/testbackoff.cpp index 8125d8625a8..50d68b72adf 100644 --- a/slobrok/src/tests/backoff/testbackoff.cpp +++ b/slobrok/src/tests/backoff/testbackoff.cpp @@ -17,9 +17,14 @@ Test::Main() TEST_INIT("backoff_test"); BackOff one; - EXPECT_TRUE(one.shouldWarn()); + EXPECT_FALSE(one.shouldWarn()); EXPECT_EQUAL(0.500, one.get()); - for (int i = 2; i < 41; i++) { + EXPECT_FALSE(one.shouldWarn()); + EXPECT_EQUAL(1.000, one.get()); + EXPECT_FALSE(one.shouldWarn()); + EXPECT_EQUAL(1.500, one.get()); + EXPECT_TRUE(one.shouldWarn()); + for (int i = 4; i < 41; i++) { EXPECT_EQUAL(0.5 * i, one.get()); } for (int i = 1; i < 1000; i++) { @@ -28,22 +33,24 @@ Test::Main() TEST_FLUSH(); BackOff two; + EXPECT_FALSE(two.shouldWarn()); for (int i = 1; i < 50; i++) { double expect = 0.5 * i; if (expect > 20.0) expect = 20.0; EXPECT_EQUAL(expect, two.get()); - if (i == 1 || i == 7 || i == 18) { + if (i == 3 || i == 8 || i == 18) { EXPECT_TRUE(two.shouldWarn()); } else { EXPECT_FALSE(two.shouldWarn()); } } two.reset(); + EXPECT_FALSE(two.shouldWarn()); for (int i = 1; i < 50; i++) { double expect = 0.5 * i; if (expect > 20.0) expect = 20.0; EXPECT_EQUAL(expect, two.get()); - if (i == 1 || i == 7 || i == 18) { + if (i == 3 || i == 8 || i == 18) { EXPECT_TRUE(two.shouldWarn()); } else { EXPECT_FALSE(two.shouldWarn()); -- cgit v1.2.3