summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2019-04-27 23:19:55 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-07 13:20:57 +0000
commitcc72cc45a49b13b0c5147a7af21c083e47ca73f5 (patch)
tree7223813047542b5e2a27011e99a12fe50be25efb /tests
parentaa98c481fa7888e2bcd9d5c9ae1993744ee47f33 (diff)
add osmo_stat_item_inc/osmo_stat_item_dec to set it relative
Change-Id: Id2462c4866bd22bc2338c9c8f69b775f88ae7511
Diffstat (limited to 'tests')
-rw-r--r--tests/stats/stats_test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stats/stats_test.c b/tests/stats/stats_test.c
index 6ef88418..71f710a9 100644
--- a/tests/stats/stats_test.c
+++ b/tests/stats/stats_test.c
@@ -147,6 +147,22 @@ static void stat_test(void)
OSMO_ASSERT(value == 1000 + i);
}
+ /* check if dec & inc is working */
+ osmo_stat_item_set(statg->items[TEST_A_ITEM], 42);
+ rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
+ OSMO_ASSERT(rc > 0);
+ OSMO_ASSERT(value == 42);
+
+ osmo_stat_item_dec(statg->items[TEST_A_ITEM], 21);
+ rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
+ OSMO_ASSERT(rc > 0);
+ OSMO_ASSERT(value == 21);
+
+ osmo_stat_item_inc(statg->items[TEST_A_ITEM], 21);
+ rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
+ OSMO_ASSERT(rc > 0);
+ OSMO_ASSERT(value == 42);
+
/* Keep 2 in FIFO */
osmo_stat_item_set(statg->items[TEST_A_ITEM], 33);
osmo_stat_item_set(statg->items[TEST_B_ITEM], 1000 + 33);