From 4b627fd9aac36fde2dfd74e22e9c51baa315b068 Mon Sep 17 00:00:00 2001 From: Firas Sahli Date: Thu, 22 Nov 2018 16:41:38 +0100 Subject: [PATCH] Add simple test for dds_time Signed-off-by: Firas Sahli --- src/core/ddsc/tests/time.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/core/ddsc/tests/time.c diff --git a/src/core/ddsc/tests/time.c b/src/core/ddsc/tests/time.c new file mode 100644 index 0000000..5aceb37 --- /dev/null +++ b/src/core/ddsc/tests/time.c @@ -0,0 +1,17 @@ +#include +#include + +#include "ddsc/dds.h" + +Test(ddsc_time, request_time) +{ + dds_time_t now, then; + dds_duration_t pause = 1 * DDS_NSECS_IN_SEC; + + now = dds_time(); + cr_assert_gt(now, 0); + /* Sleep for 1 second, every platform should (hopefully) support that */ + dds_sleepfor(pause); + then = dds_time(); + cr_assert_geq(then, now + pause); +}