From af81088cf938f388dac201a90b8ef221ee82aef6 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 6 Oct 2016 17:42:41 +0200 Subject: change timer functionality to use clock_monotonic_raw --- tests/src/test_gensvm_timer.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/src/test_gensvm_timer.c (limited to 'tests/src/test_gensvm_timer.c') diff --git a/tests/src/test_gensvm_timer.c b/tests/src/test_gensvm_timer.c new file mode 100644 index 0000000..78e968f --- /dev/null +++ b/tests/src/test_gensvm_timer.c @@ -0,0 +1,34 @@ +/** + * @file test_gensvm_timer.c + * @author Gertjan van den Burg + * @date October, 2016 + * @brief Unit tests for gensvm_timer.c functions + * + */ + +#include "minunit.h" +#include "gensvm_timer.h" + +char *test_timer() +{ + struct timespec start, stop; + Timer(start); + + stop.tv_sec = start.tv_sec + 1; + stop.tv_nsec = start.tv_nsec; + + mu_assert(gensvm_elapsed_time(&start, &stop) == 1.0, + "Incorrect time computed"); + + return NULL; +} + +char *all_tests() +{ + mu_suite_start(); + mu_run_test(test_timer); + + return NULL; +} + +RUN_TESTS(all_tests); -- cgit v1.2.3