Add simple test for dds_time
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
This commit is contained in:
parent
2e2224daea
commit
4b627fd9aa
1 changed files with 17 additions and 0 deletions
17
src/core/ddsc/tests/time.c
Normal file
17
src/core/ddsc/tests/time.c
Normal 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);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue