Add simple test for dds_time

Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
This commit is contained in:
Firas Sahli 2018-11-22 16:41:38 +01:00
parent 2e2224daea
commit 4b627fd9aa
No known key found for this signature in database
GPG key ID: C19E9D4A9279539F

View file

@ -0,0 +1,17 @@
#include <criterion/criterion.h>
#include <criterion/logging.h>
#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);
}