4 #ifdef GLK_MODULE_DATETIME
6 #define EXPECTED_DATETIME_GESTALT_VALUE 1
13 #define TEST_SECOND 53
14 #define TEST_WEEKDAY 2
15 #define TEST_MICROSEC 123456
16 #define TEST_HI_YEAR 2118
17 #define TEST_HI_MONTH 1
18 #define TEST_HI_DAY 22
19 #define TEST_HI_HOUR 1
20 #define TEST_HI_MINUTE 37
21 #define TEST_HI_SECOND 9
22 #define TEST_HI_WEEKDAY 6
23 static glktimeval_t TEST_TIMEVAL = { 0, 377291333, TEST_MICROSEC };
24 static glktimeval_t TEST_HIGH_TIMEVAL = { 1, 377291333, TEST_MICROSEC };
25 static glkdate_t TEST_DATE = {
36 /* Date for normalizing components */
37 #define TEST_NORM_YEAR 1999
38 #define TEST_NORM_MONTH 12
39 #define TEST_NORM_DAY 31
40 #define TEST_NORM_WEEKDAY 5
41 #define TEST_NORM_HOUR 23
42 #define TEST_NORM_MINUTE 59
43 #define TEST_NORM_SECOND 59
44 #define TEST_NORM_MICROSEC 999999
45 static glkdate_t TEST_NORM_DATE = {
56 /* Leap second occurred on this date */
57 #define TEST_LEAPSEC_YEAR 2012
58 #define TEST_LEAPSEC_MONTH 6
59 #define TEST_LEAPSEC_DAY 30
60 #define TEST_LEAPSEC_WEEKDAY 6
61 #define TEST_LEAPSEC_HOUR 23
62 #define TEST_LEAPSEC_MINUTE 59
63 #define TEST_LEAPSEC_SECOND 60
64 #define TEST_LEAPSEC_MICROSEC 0
65 static glkdate_t TEST_LEAPSEC_DATE = {
75 /* Note that this Unix timestamp refers to the above second AND the second
77 static glktimeval_t TEST_LEAPSEC_TIMEVAL = { 0, 1341100800, 0 };
80 test_current_time_equals_current_simple_time(void)
84 /* This test will fail if the following two operations do not occur within
85 a second of each other. That is not a robust test, but you could argue that
86 there is a serious bug if either operation takes more than one second. */
87 glk_current_time(&timeval);
88 glsi32 simple_time = glk_current_simple_time(1);
89 ASSERT_EQUAL(simple_time, timeval.low_sec);
91 glk_current_time(&timeval);
92 glsi32 simple_time_high_bits = glk_current_simple_time(0xFFFFFFFF);
93 ASSERT_EQUAL(simple_time_high_bits, timeval.high_sec);
99 test_time_to_date_utc_returns_utc(void)
103 glk_time_to_date_utc(&TEST_TIMEVAL, &date);
104 ASSERT_EQUAL(TEST_HOUR, date.hour);
110 test_time_to_date_utc_converts_correctly(void)
114 glk_time_to_date_utc(&TEST_TIMEVAL, &date);
115 ASSERT_EQUAL(TEST_YEAR, date.year);
116 ASSERT_EQUAL(TEST_MONTH, date.month);
117 ASSERT_EQUAL(TEST_DAY, date.day);
118 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
119 ASSERT_EQUAL(TEST_HOUR, date.hour);
120 ASSERT_EQUAL(TEST_MINUTE, date.minute);
121 ASSERT_EQUAL(TEST_SECOND, date.second);
122 ASSERT_EQUAL(TEST_MICROSEC, date.microsec);
128 test_time_to_date_utc_converts_high_bits_correctly(void)
132 glk_time_to_date_utc(&TEST_HIGH_TIMEVAL, &date);
133 ASSERT_EQUAL(TEST_HI_YEAR, date.year);
134 ASSERT_EQUAL(TEST_HI_MONTH, date.month);
135 ASSERT_EQUAL(TEST_HI_DAY, date.day);
136 ASSERT_EQUAL(TEST_HI_WEEKDAY, date.weekday);
137 ASSERT_EQUAL(TEST_HI_HOUR, date.hour);
138 ASSERT_EQUAL(TEST_HI_MINUTE, date.minute);
139 ASSERT_EQUAL(TEST_HI_SECOND, date.second);
140 ASSERT_EQUAL(TEST_MICROSEC, date.microsec);
146 test_time_to_date_local_returns_something_reasonable(void)
150 /* All over the world, the given date should be on the 15th or 16th */
151 glk_time_to_date_utc(&TEST_TIMEVAL, &date);
152 ASSERT_EQUAL(TEST_YEAR, date.year);
153 ASSERT_EQUAL(TEST_MONTH, date.month);
154 ASSERT(date.day >= TEST_DAY && date.day <= TEST_DAY + 1);
155 ASSERT_EQUAL(TEST_SECOND, date.second);
156 ASSERT_EQUAL(TEST_MICROSEC, date.microsec);
162 test_simple_time_to_date_utc_converts_correctly(void)
166 glk_simple_time_to_date_utc(TEST_TIMEVAL.low_sec, 1, &date);
167 ASSERT_EQUAL(TEST_YEAR, date.year);
168 ASSERT_EQUAL(TEST_MONTH, date.month);
169 ASSERT_EQUAL(TEST_DAY, date.day);
170 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
171 ASSERT_EQUAL(TEST_HOUR, date.hour);
172 ASSERT_EQUAL(TEST_MINUTE, date.minute);
173 ASSERT_EQUAL(TEST_SECOND, date.second);
174 ASSERT_EQUAL(0, date.microsec);
180 test_simple_time_to_date_utc_converts_correctly_with_factor(void)
184 glk_simple_time_to_date_utc(TEST_TIMEVAL.low_sec >> 1, 2, &date);
185 ASSERT_EQUAL(TEST_YEAR, date.year);
186 ASSERT_EQUAL(TEST_MONTH, date.month);
187 ASSERT_EQUAL(TEST_DAY, date.day);
188 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
189 ASSERT_EQUAL(TEST_HOUR, date.hour);
190 ASSERT_EQUAL(TEST_MINUTE, date.minute);
191 ASSERT_EQUAL((TEST_SECOND / 2) * 2, date.second);
192 ASSERT_EQUAL(0, date.microsec);
198 test_simple_time_to_date_local_returns_something_reasonable(void)
202 glk_simple_time_to_date_local(TEST_TIMEVAL.low_sec, 1, &date);
203 ASSERT(date.day >= TEST_DAY && date.day <= TEST_DAY + 1);
209 test_simple_time_to_date_local_returns_something_reasonable_with_factor(void)
213 glk_simple_time_to_date_local(TEST_TIMEVAL.low_sec >> 1, 2, &date);
214 ASSERT(date.day >= TEST_DAY && date.day <= TEST_DAY + 1);
220 test_date_to_time_utc_converts_correctly(void)
222 glktimeval_t timeval;
224 glk_date_to_time_utc(&TEST_DATE, &timeval);
225 ASSERT_EQUAL(TEST_TIMEVAL.high_sec, timeval.high_sec);
226 ASSERT_EQUAL(TEST_TIMEVAL.low_sec, timeval.low_sec);
227 ASSERT_EQUAL(TEST_TIMEVAL.microsec, timeval.microsec);
233 test_date_to_time_utc_converts_leap_second(void)
235 glktimeval_t timeval;
237 glk_date_to_time_utc(&TEST_LEAPSEC_DATE, &timeval);
238 ASSERT_EQUAL(TEST_LEAPSEC_TIMEVAL.high_sec, timeval.high_sec);
239 ASSERT_EQUAL(TEST_LEAPSEC_TIMEVAL.low_sec, timeval.low_sec);
240 ASSERT_EQUAL(TEST_LEAPSEC_TIMEVAL.microsec, timeval.microsec);
246 test_date_to_time_utc_ignores_weekday(void)
248 glktimeval_t timeval1, timeval2;
249 glkdate_t date2 = TEST_DATE;
251 date2.weekday = (TEST_WEEKDAY + 1) % 7;
253 glk_date_to_time_utc(&TEST_DATE, &timeval1);
254 glk_date_to_time_utc(&date2, &timeval2);
255 ASSERT_EQUAL(timeval1.high_sec, timeval2.high_sec);
256 ASSERT_EQUAL(timeval1.low_sec, timeval2.low_sec);
257 ASSERT_EQUAL(timeval1.microsec, timeval2.microsec);
263 test_date_to_time_local_returns_something_reasonable(void)
265 /* Any time on earth should be within 13 hours of UTC time? */
266 glktimeval_t timeval;
267 glsi32 thirteen_hours = 13 * 60 * 60;
269 glk_date_to_time_utc(&TEST_DATE, &timeval);
270 ASSERT_EQUAL(TEST_TIMEVAL.high_sec, timeval.high_sec);
271 ASSERT(timeval.low_sec > TEST_TIMEVAL.low_sec - thirteen_hours);
272 ASSERT(timeval.low_sec < TEST_TIMEVAL.low_sec + thirteen_hours);
273 ASSERT_EQUAL(TEST_TIMEVAL.microsec, timeval.microsec);
279 test_date_to_time_local_ignores_weekday(void)
281 glktimeval_t timeval1, timeval2;
282 glkdate_t date2 = TEST_DATE;
284 date2.weekday = (TEST_WEEKDAY + 1) % 7;
286 glk_date_to_time_local(&TEST_DATE, &timeval1);
287 glk_date_to_time_local(&date2, &timeval2);
288 ASSERT_EQUAL(timeval1.high_sec, timeval2.high_sec);
289 ASSERT_EQUAL(timeval1.low_sec, timeval2.low_sec);
290 ASSERT_EQUAL(timeval1.microsec, timeval2.microsec);
296 test_date_to_simple_time_utc_converts_correctly(void)
298 glsi32 timestamp = glk_date_to_simple_time_utc(&TEST_DATE, 1);
299 ASSERT_EQUAL(TEST_TIMEVAL.low_sec, timestamp);
305 test_date_to_simple_time_utc_converts_leap_second(void)
307 glsi32 timestamp = glk_date_to_simple_time_utc(&TEST_LEAPSEC_DATE, 1);
308 ASSERT_EQUAL(TEST_LEAPSEC_TIMEVAL.low_sec, timestamp);
314 test_date_to_simple_time_utc_converts_correctly_with_factor(void)
316 glsi32 timestamp = glk_date_to_simple_time_utc(&TEST_DATE, 2);
317 ASSERT_EQUAL(TEST_TIMEVAL.low_sec >> 1, timestamp);
323 test_date_to_simple_time_utc_ignores_weekday(void)
325 glkdate_t date2 = TEST_DATE;
327 date2.weekday = (TEST_WEEKDAY + 1) % 7;
329 glsi32 stamp1 = glk_date_to_simple_time_utc(&TEST_DATE, 1);
330 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
331 ASSERT_EQUAL(stamp1, stamp2);
337 test_date_to_simple_time_utc_ignores_weekday_with_factor(void)
339 glkdate_t date2 = TEST_DATE;
341 date2.weekday = (TEST_WEEKDAY + 1) % 7;
343 glsi32 stamp1 = glk_date_to_simple_time_utc(&TEST_DATE, 2);
344 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 2);
345 ASSERT_EQUAL(stamp1, stamp2);
351 test_date_to_simple_time_utc_normalizes_month(void)
353 glkdate_t date1 = TEST_NORM_DATE;
354 glkdate_t date2 = TEST_NORM_DATE;
360 glsi32 stamp1 = glk_date_to_simple_time_utc(&date1, 1);
361 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
362 ASSERT_EQUAL(stamp1, stamp2);
368 test_date_to_simple_time_utc_normalizes_day(void)
370 glkdate_t date1 = TEST_NORM_DATE;
371 glkdate_t date2 = TEST_NORM_DATE;
377 glsi32 stamp1 = glk_date_to_simple_time_utc(&date1, 1);
378 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
379 ASSERT_EQUAL(stamp1, stamp2);
385 test_date_to_simple_time_utc_normalizes_hour(void)
387 glkdate_t date1 = TEST_NORM_DATE;
388 glkdate_t date2 = TEST_NORM_DATE;
394 glsi32 stamp1 = glk_date_to_simple_time_utc(&date1, 1);
395 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
396 ASSERT_EQUAL(stamp1, stamp2);
402 test_date_to_simple_time_utc_normalizes_minute(void)
404 glkdate_t date1 = TEST_NORM_DATE;
405 glkdate_t date2 = TEST_NORM_DATE;
411 glsi32 stamp1 = glk_date_to_simple_time_utc(&date1, 1);
412 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
413 ASSERT_EQUAL(stamp1, stamp2);
419 test_date_to_simple_time_utc_normalizes_second(void)
421 glkdate_t date1 = TEST_NORM_DATE;
422 glkdate_t date2 = TEST_NORM_DATE;
426 date2.second += 2; /* set second to 61, not 60 */
428 glsi32 stamp1 = glk_date_to_simple_time_utc(&date1, 1);
429 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
430 ASSERT_EQUAL(stamp1, stamp2);
436 test_date_to_simple_time_utc_normalizes_microsec(void)
438 glkdate_t date1 = TEST_NORM_DATE;
439 glkdate_t date2 = TEST_NORM_DATE;
445 glsi32 stamp1 = glk_date_to_simple_time_utc(&date1, 1);
446 glsi32 stamp2 = glk_date_to_simple_time_utc(&date2, 1);
447 ASSERT_EQUAL(stamp1, stamp2);
453 test_date_to_simple_time_local_returns_something_reasonable(void)
455 /* Any time on earth should be within 13 hours of UTC time? */
456 glsi32 thirteen_hours = 13 * 60 * 60;
458 glsi32 timestamp = glk_date_to_simple_time_local(&TEST_DATE, 1);
459 ASSERT(timestamp > TEST_TIMEVAL.low_sec - thirteen_hours);
460 ASSERT(timestamp < TEST_TIMEVAL.low_sec + thirteen_hours);
466 test_date_to_simple_time_local_ignores_weekday(void)
468 glkdate_t date2 = TEST_DATE;
470 date2.weekday = (TEST_WEEKDAY + 1) % 7;
472 glsi32 stamp1 = glk_date_to_simple_time_local(&TEST_DATE, 1);
473 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
474 ASSERT_EQUAL(stamp1, stamp2);
480 test_date_to_simple_time_local_ignores_weekday_with_factor(void)
482 glkdate_t date2 = TEST_DATE;
484 date2.weekday = (TEST_WEEKDAY + 1) % 7;
486 glsi32 stamp1 = glk_date_to_simple_time_local(&TEST_DATE, 2);
487 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 2);
488 ASSERT_EQUAL(stamp1, stamp2);
494 test_date_to_simple_time_local_normalizes_month(void)
496 glkdate_t date1 = TEST_NORM_DATE;
497 glkdate_t date2 = TEST_NORM_DATE;
503 glsi32 stamp1 = glk_date_to_simple_time_local(&date1, 1);
504 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
505 ASSERT_EQUAL(stamp1, stamp2);
511 test_date_to_simple_time_local_normalizes_day(void)
513 glkdate_t date1 = TEST_NORM_DATE;
514 glkdate_t date2 = TEST_NORM_DATE;
520 glsi32 stamp1 = glk_date_to_simple_time_local(&date1, 1);
521 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
522 ASSERT_EQUAL(stamp1, stamp2);
528 test_date_to_simple_time_local_normalizes_hour(void)
530 glkdate_t date1 = TEST_NORM_DATE;
531 glkdate_t date2 = TEST_NORM_DATE;
537 glsi32 stamp1 = glk_date_to_simple_time_local(&date1, 1);
538 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
539 ASSERT_EQUAL(stamp1, stamp2);
545 test_date_to_simple_time_local_normalizes_minute(void)
547 glkdate_t date1 = TEST_NORM_DATE;
548 glkdate_t date2 = TEST_NORM_DATE;
554 glsi32 stamp1 = glk_date_to_simple_time_local(&date1, 1);
555 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
556 ASSERT_EQUAL(stamp1, stamp2);
562 test_date_to_simple_time_local_normalizes_second(void)
564 glkdate_t date1 = TEST_NORM_DATE;
565 glkdate_t date2 = TEST_NORM_DATE;
569 date2.second += 2; /* set second to 61, not 60 */
571 glsi32 stamp1 = glk_date_to_simple_time_local(&date1, 1);
572 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
573 ASSERT_EQUAL(stamp1, stamp2);
579 test_date_to_simple_time_local_normalizes_microsec(void)
581 glkdate_t date1 = TEST_NORM_DATE;
582 glkdate_t date2 = TEST_NORM_DATE;
588 glsi32 stamp1 = glk_date_to_simple_time_local(&date1, 1);
589 glsi32 stamp2 = glk_date_to_simple_time_local(&date2, 1);
590 ASSERT_EQUAL(stamp1, stamp2);
596 test_date_to_time_to_date_utc(void)
598 glktimeval_t intermediate;
601 glk_date_to_time_utc(&TEST_DATE, &intermediate);
602 glk_time_to_date_utc(&intermediate, &date);
603 ASSERT_EQUAL(TEST_YEAR, date.year);
604 ASSERT_EQUAL(TEST_MONTH, date.month);
605 ASSERT_EQUAL(TEST_DAY, date.day);
606 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
607 ASSERT_EQUAL(TEST_HOUR, date.hour);
608 ASSERT_EQUAL(TEST_MINUTE, date.minute);
609 ASSERT_EQUAL(TEST_SECOND, date.second);
610 ASSERT_EQUAL(TEST_MICROSEC, date.microsec);
616 test_date_to_time_to_date_utc_fails_on_leap_second(void)
618 glktimeval_t intermediate;
621 glk_date_to_time_utc(&TEST_LEAPSEC_DATE, &intermediate);
622 glk_time_to_date_utc(&intermediate, &date);
623 ASSERT_EQUAL(TEST_LEAPSEC_YEAR, date.year);
624 ASSERT_NOT_EQUAL(TEST_LEAPSEC_MONTH, date.month);
625 ASSERT_NOT_EQUAL(TEST_LEAPSEC_DAY, date.day);
626 ASSERT_NOT_EQUAL(TEST_LEAPSEC_WEEKDAY, date.weekday);
627 ASSERT_NOT_EQUAL(TEST_LEAPSEC_HOUR, date.hour);
628 ASSERT_NOT_EQUAL(TEST_LEAPSEC_MINUTE, date.minute);
629 ASSERT_NOT_EQUAL(TEST_LEAPSEC_SECOND, date.second);
630 ASSERT_EQUAL(TEST_LEAPSEC_MICROSEC, date.microsec);
636 test_date_to_time_to_date_local(void)
638 glktimeval_t intermediate;
641 glk_date_to_time_local(&TEST_DATE, &intermediate);
642 glk_time_to_date_local(&intermediate, &date);
643 ASSERT_EQUAL(TEST_YEAR, date.year);
644 ASSERT_EQUAL(TEST_MONTH, date.month);
645 ASSERT_EQUAL(TEST_DAY, date.day);
646 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
647 ASSERT_EQUAL(TEST_HOUR, date.hour);
648 ASSERT_EQUAL(TEST_MINUTE, date.minute);
649 ASSERT_EQUAL(TEST_SECOND, date.second);
650 ASSERT_EQUAL(TEST_MICROSEC, date.microsec);
656 test_date_to_simple_time_to_date_utc(void)
660 glsi32 intermediate = glk_date_to_simple_time_utc(&TEST_DATE, 1);
661 glk_simple_time_to_date_utc(intermediate, 1, &date);
662 ASSERT_EQUAL(TEST_YEAR, date.year);
663 ASSERT_EQUAL(TEST_MONTH, date.month);
664 ASSERT_EQUAL(TEST_DAY, date.day);
665 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
666 ASSERT_EQUAL(TEST_HOUR, date.hour);
667 ASSERT_EQUAL(TEST_MINUTE, date.minute);
668 ASSERT_EQUAL(TEST_SECOND, date.second);
669 ASSERT_EQUAL(0, date.microsec);
675 test_date_to_simple_time_to_date_local(void)
679 glsi32 intermediate = glk_date_to_simple_time_local(&TEST_DATE, 1);
680 glk_simple_time_to_date_local(intermediate, 1, &date);
681 ASSERT_EQUAL(TEST_YEAR, date.year);
682 ASSERT_EQUAL(TEST_MONTH, date.month);
683 ASSERT_EQUAL(TEST_DAY, date.day);
684 ASSERT_EQUAL(TEST_WEEKDAY, date.weekday);
685 ASSERT_EQUAL(TEST_HOUR, date.hour);
686 ASSERT_EQUAL(TEST_MINUTE, date.minute);
687 ASSERT_EQUAL(TEST_SECOND, date.second);
688 ASSERT_EQUAL(0, date.microsec);
694 test_time_to_date_to_time_utc(void)
696 glktimeval_t timeval;
697 glkdate_t intermediate;
699 glk_time_to_date_utc(&TEST_TIMEVAL, &intermediate);
700 glk_date_to_time_utc(&intermediate, &timeval);
701 ASSERT_EQUAL(TEST_TIMEVAL.high_sec, timeval.high_sec);
702 ASSERT_EQUAL(TEST_TIMEVAL.low_sec, timeval.low_sec);
703 ASSERT_EQUAL(TEST_TIMEVAL.microsec, timeval.microsec);
709 test_time_to_date_to_time_local(void)
711 glktimeval_t timeval;
712 glkdate_t intermediate;
714 glk_time_to_date_local(&TEST_TIMEVAL, &intermediate);
715 glk_date_to_time_local(&intermediate, &timeval);
716 ASSERT_EQUAL(TEST_TIMEVAL.high_sec, timeval.high_sec);
717 ASSERT_EQUAL(TEST_TIMEVAL.low_sec, timeval.low_sec);
718 ASSERT_EQUAL(TEST_TIMEVAL.microsec, timeval.microsec);
724 test_simple_time_to_date_to_simple_time_utc(void)
726 glkdate_t intermediate;
728 glk_simple_time_to_date_utc(TEST_TIMEVAL.low_sec, 1, &intermediate);
729 glsi32 timestamp = glk_date_to_simple_time_utc(&intermediate, 1);
730 ASSERT_EQUAL(TEST_TIMEVAL.low_sec, timestamp);
736 test_simple_time_to_date_to_simple_time_local(void)
738 glkdate_t intermediate;
740 glk_simple_time_to_date_local(TEST_TIMEVAL.low_sec, 1, &intermediate);
741 glsi32 timestamp = glk_date_to_simple_time_local(&intermediate, 1);
742 ASSERT_EQUAL(TEST_TIMEVAL.low_sec, timestamp);
747 #else /* GLK_MODULE_DATETIME is not defined */
749 #define EXPECTED_DATETIME_GESTALT_VALUE 0
751 #endif /* GLK_MODULE_DATETIME defined */
754 test_date_time_supported(void)
756 /* If GLK_MODULE_DATETIME is defined in an implemenation, then the gestalt
757 system should indicate that it is supported. If the preprocessor symbol is
758 not defined, then it should not. */
759 glui32 res = glk_gestalt(gestalt_DateTime, 0);
760 ASSERT_EQUAL(EXPECTED_DATETIME_GESTALT_VALUE, res);
764 struct TestDescription tests[] = {
765 { "date and time functions are supported",
766 test_date_time_supported },
767 #ifdef GLK_MODULE_DATETIME
768 { "current time equals simple time",
769 test_current_time_equals_current_simple_time },
770 { "glk_time_to_date_utc() returns UTC time",
771 test_time_to_date_utc_returns_utc },
772 { "glk_time_to_date_utc() converts correctly",
773 test_time_to_date_utc_converts_correctly },
774 { "glk_time_to_date_utc() converts high bits correctly",
775 test_time_to_date_utc_converts_high_bits_correctly },
776 { "glk_time_to_date_local() returns something reasonable",
777 test_time_to_date_local_returns_something_reasonable },
778 { "glk_simple_time_to_date_utc() converts correctly",
779 test_simple_time_to_date_utc_converts_correctly },
780 { "glk_simple_time_to_date_utc() converts correctly with factor",
781 test_simple_time_to_date_utc_converts_correctly_with_factor },
782 { "glk_simple_time_to_date_local() returns something reasonable",
783 test_simple_time_to_date_local_returns_something_reasonable },
784 { "glk_simple_time_to_date_local() returns something reasonable with factor",
785 test_simple_time_to_date_local_returns_something_reasonable_with_factor },
786 { "glk_date_to_time_utc() converts correctly",
787 test_date_to_time_utc_converts_correctly },
788 { "glk_date_to_time_utc() converts a leap second correctly",
789 test_date_to_time_utc_converts_leap_second },
790 { "glk_date_to_time_utc() ignores the weekday value",
791 test_date_to_time_utc_ignores_weekday },
792 { "glk_date_to_time_local() returns something reasonable",
793 test_date_to_time_local_returns_something_reasonable },
794 { "glk_date_to_time_local() ignores the weekday value",
795 test_date_to_time_local_ignores_weekday },
796 { "glk_date_to_simple_time_utc() converts correctly",
797 test_date_to_simple_time_utc_converts_correctly },
798 { "glk_date_to_simple_time_utc() converts a leap second correctly",
799 test_date_to_simple_time_utc_converts_leap_second },
800 { "glk_date_to_simple_time_utc() converts correctly with factor",
801 test_date_to_simple_time_utc_converts_correctly_with_factor },
802 { "glk_date_to_simple_time_utc() ignores the weekday value",
803 test_date_to_simple_time_utc_ignores_weekday },
804 { "glk_date_to_simple_time_utc() ignores the weekday value with factor",
805 test_date_to_simple_time_utc_ignores_weekday_with_factor },
806 { "glk_date_to_simple_time_utc() normalizes an illegal month value",
807 test_date_to_simple_time_utc_normalizes_month },
808 { "glk_date_to_simple_time_utc() normalizes an illegal day value",
809 test_date_to_simple_time_utc_normalizes_day },
810 { "glk_date_to_simple_time_utc() normalizes an illegal hour value",
811 test_date_to_simple_time_utc_normalizes_hour },
812 { "glk_date_to_simple_time_utc() normalizes an illegal minute value",
813 test_date_to_simple_time_utc_normalizes_minute },
814 { "glk_date_to_simple_time_utc() normalizes an illegal second value",
815 test_date_to_simple_time_utc_normalizes_second },
816 { "glk_date_to_simple_time_utc() normalizes an illegal microsecond value",
817 test_date_to_simple_time_utc_normalizes_microsec },
818 { "glk_date_to_simple_time_local() returns something reasonable",
819 test_date_to_simple_time_local_returns_something_reasonable },
820 { "glk_date_to_simple_time_local() ignores the weekday value",
821 test_date_to_simple_time_local_ignores_weekday },
822 { "glk_date_to_simple_time_local() ignores the weekday value with factor",
823 test_date_to_simple_time_local_ignores_weekday_with_factor },
824 { "glk_date_to_simple_time_local() normalizes an illegal month value",
825 test_date_to_simple_time_local_normalizes_month },
826 { "glk_date_to_simple_time_local() normalizes an illegal day value",
827 test_date_to_simple_time_local_normalizes_day },
828 { "glk_date_to_simple_time_local() normalizes an illegal hour value",
829 test_date_to_simple_time_local_normalizes_hour },
830 { "glk_date_to_simple_time_local() normalizes an illegal minute value",
831 test_date_to_simple_time_local_normalizes_minute },
832 { "glk_date_to_simple_time_local() normalizes an illegal second value",
833 test_date_to_simple_time_local_normalizes_second },
834 { "glk_date_to_simple_time_local() normalizes an illegal microsecond value",
835 test_date_to_simple_time_local_normalizes_microsec },
836 { "converting date to time and back works in UTC",
837 test_date_to_time_to_date_utc },
838 { "converting date to time and back in UTC fails on a leap second",
839 test_date_to_time_to_date_utc_fails_on_leap_second },
840 { "converting date to time and back in local time",
841 test_date_to_time_to_date_local },
842 { "converting date to simple time and back works in UTC",
843 test_date_to_simple_time_to_date_utc },
844 { "converting date to simple time and back works in local time",
845 test_date_to_simple_time_to_date_local },
846 { "converting time to date and back works in UTC",
847 test_time_to_date_to_time_utc },
848 { "converting time to date and back works in local time",
849 test_time_to_date_to_time_local },
850 { "converting simple time to date and back works in UTC",
851 test_simple_time_to_date_to_simple_time_utc },
852 { "converting simple time to date and back works in local time",
853 test_simple_time_to_date_to_simple_time_local },
854 #endif /* GLK_MODULE_DATETIME defined */