591dc9f2349d993d8102d76df9f7160c0ca22acf
[projects/chimara/chimara.git] / tests / unit / datetime.c
1 #include "glk.h"
2 #include "glkunit.h"
3
4 static int
5 test_current_time_equals_current_simple_time(void)
6 {
7         glktimeval_t timeval;
8
9         /* This test will fail if the following two operations do not occur within
10         a second of each other. That is not a robust test, but you could argue that
11         there is a serious bug if either operation takes more than one second. */
12         glk_current_time(&timeval);
13         glsi32 simple_time = glk_current_simple_time(1);
14         ASSERT_EQUAL(simple_time, timeval.low_sec);
15
16         glk_current_time(&timeval);
17         glsi32 simple_time_high_bits = glk_current_simple_time(0xFFFFFFFF);
18         ASSERT_EQUAL(simple_time_high_bits, timeval.high_sec);
19
20         SUCCEED;
21 }
22
23 struct TestDescription tests[] = {
24         { "current time equals simple time", test_current_time_equals_current_simple_time },
25         { NULL, NULL }
26 };