From 165d37d5319a61a8dc56f3959d0fa219bcfa14ad Mon Sep 17 00:00:00 2001 From: armink Date: Sun, 5 Jul 2020 17:01:21 +0800 Subject: [PATCH] [tsdb] update the fdb_tsl_iter_by_time testcase. --- tests/fdb_tsdb_tc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/fdb_tsdb_tc.c b/tests/fdb_tsdb_tc.c index 6db16ad..3d85e46 100644 --- a/tests/fdb_tsdb_tc.c +++ b/tests/fdb_tsdb_tc.c @@ -60,7 +60,12 @@ static bool test_fdb_tsl_iter_cb(fdb_tsl_t tsl, void *arg) read_len = fdb_blob_read((fdb_db_t) &test_tsdb, fdb_tsl_to_blob(tsl, &blob)); data[read_len] = '\0'; - uassert_true(tsl->time == atoi(data)); + + if (arg == NULL) { + uassert_true(tsl->time == atoi(data)); + } else { + uassert_true(tsl->time == *((fdb_time_t *)arg)); + } return false; } @@ -74,6 +79,9 @@ static void test_fdb_tsl_iter_by_time(void) { fdb_time_t from = 0, to = TEST_TS_COUNT -1; + for (fdb_time_t cur = from; cur <= to; cur ++) { + fdb_tsl_iter_by_time(&test_tsdb, cur, cur, test_fdb_tsl_iter_cb, &cur); + } fdb_tsl_iter_by_time(&test_tsdb, from, to, test_fdb_tsl_iter_cb, NULL); }