update unit test to track adjusted timing
@@ -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());
