Fix decay tests to all adapt to nstime_monotonic().
diff --git a/test/unit/decay.c b/test/unit/decay.c
index b7e4e25..e169ae2 100644
--- a/test/unit/decay.c
+++ b/test/unit/decay.c
@@ -7,13 +7,13 @@
static unsigned nupdates_mock;
static nstime_t time_mock;
-static bool nonmonotonic_mock;
+static bool monotonic_mock;
static bool
nstime_monotonic_mock(void)
{
- return (false);
+ return (monotonic_mock);
}
static bool
@@ -21,9 +21,9 @@
{
nupdates_mock++;
- if (!nonmonotonic_mock)
+ if (monotonic_mock)
nstime_copy(time, &time_mock);
- return (nonmonotonic_mock);
+ return (!monotonic_mock);
}
TEST_BEGIN(test_decay_ticks)
@@ -253,9 +253,11 @@
nupdates_mock = 0;
nstime_init(&time_mock, 0);
nstime_update(&time_mock);
- nonmonotonic_mock = false;
+ monotonic_mock = true;
+ nstime_monotonic_orig = nstime_monotonic;
nstime_update_orig = nstime_update;
+ nstime_monotonic = nstime_monotonic_mock;
nstime_update = nstime_update_mock;
for (i = 0; i < NPS; i++) {
@@ -267,6 +269,7 @@
"Expected nstime_update() to be called");
}
+ nstime_monotonic = nstime_monotonic_orig;
nstime_update = nstime_update_orig;
nstime_init(&time, 0);
@@ -324,7 +327,7 @@
nupdates_mock = 0;
nstime_init(&time_mock, 0);
nstime_update(&time_mock);
- nonmonotonic_mock = true;
+ monotonic_mock = false;
nstime_monotonic_orig = nstime_monotonic;
nstime_update_orig = nstime_update;