From 1517d0426192aa43d70d1a41cbc42f3deeb0af92 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 31 Jan 2024 13:53:14 +0100 Subject: [PATCH] src/daemon/utils_cache_test.c: Add a test case for decreasing gauges. --- src/daemon/utils_cache_test.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/daemon/utils_cache_test.c b/src/daemon/utils_cache_test.c index 6792c3250..29d640b8d 100644 --- a/src/daemon/utils_cache_test.c +++ b/src/daemon/utils_cache_test.c @@ -50,6 +50,15 @@ DEF_TEST(uc_get_rate) { .type = METRIC_TYPE_GAUGE, .want = 2.0, }, + { + .name = "decreasing gauge", + .first_value = (value_t){.gauge = 100.0}, + .second_value = (value_t){.gauge = 21.5}, + .first_time = TIME_T_TO_CDTIME_T(100), + .second_time = TIME_T_TO_CDTIME_T(110), + .type = METRIC_TYPE_GAUGE, + .want = 21.5, + }, { .name = "counter", .first_value = (value_t){.counter = 42}, -- 2.47.2