document the change in prompt timeout handling
[vlock.git] / tests / test_util.c
blobfe7713507d51ae9ee032226d190782a0af1f231a
1 #include <stdlib.h>
2 #include <time.h>
4 #include <CUnit/CUnit.h>
6 #include "util.h"
8 #include "test_util.h"
10 void test_parse_timespec(void)
12 struct timespec *t = parse_seconds("123");
14 CU_ASSERT_PTR_NOT_NULL(t);
15 CU_ASSERT(t->tv_sec == 123);
16 CU_ASSERT(t->tv_nsec == 0);
18 free(t);
20 #if 0
21 /* Fractions are not supported, yet. */
22 t = parse_seconds("123.4");
24 CU_ASSERT_PTR_NOT_NULL(t);
25 CU_ASSERT(t->tv_sec == 123);
26 CU_ASSERT(t->tv_nsec == 400000);
28 free(t);
29 #else
30 CU_ASSERT_PTR_NULL(parse_seconds("123.4"));
31 #endif
33 CU_ASSERT_PTR_NULL(parse_seconds("-1"));
34 CU_ASSERT_PTR_NULL(parse_seconds("hello"));
37 CU_TestInfo util_tests[] = {
38 { "test_parse_timespec", test_parse_timespec },
39 CU_TEST_INFO_NULL,