From 2f05287e152add6f263b805b8e99d2b9808d97bf Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 18 Oct 2021 12:25:47 +0200 Subject: [PATCH] test: improve clientlog unit test Test also timestamp maps with smaller maximum sizes. --- test/unit/clientlog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/unit/clientlog.c b/test/unit/clientlog.c index 9d1066c..b7aed36 100644 --- a/test/unit/clientlog.c +++ b/test/unit/clientlog.c @@ -109,6 +109,9 @@ test_unit(void) max_step = (1ULL << (i % 50)); ts64 = 0ULL - 100 * max_step; + if (i > 150) + ntp_ts_map.max_size = 1U << (i % 8); + assert(ntp_ts_map.max_size <= 128); ntp_ts_map.first = i % ntp_ts_map.max_size; ntp_ts_map.size = 0; ntp_ts_map.cached_rx_ts = 0ULL; @@ -215,7 +218,7 @@ test_unit(void) if ((int64_t)(prev_last_ts64 - ts64) <= NTPTS_FUTURE_LIMIT) { TEST_CHECK(prev_size + 1 >= ntp_ts_map.size); if (index2 + NTPTS_INSERT_LIMIT + 1 >= ntp_ts_map.size && - !(index2 == 0 && + !(index2 == 0 && NTPTS_INSERT_LIMIT < ntp_ts_map.max_size && ((NTPTS_INSERT_LIMIT == prev_size && (int64_t)(ts64 - prev_first_ts64) > 0) || (NTPTS_INSERT_LIMIT + 1 == prev_size && (int64_t)(ts64 - prev_first_ts64) < 0)))) TEST_CHECK((prev_first + prev_size + 1) % ntp_ts_map.max_size ==