add timespec_empty() unit test

This commit is contained in:
Pim van Pelt
2018-11-04 19:56:08 +01:00
parent 8c6b2f399b
commit 8149a6cd10

View File

@ -100,12 +100,14 @@ static void test_timespec_state(void) {
ASSERT(ts, "Created timespec");
timespec_get_spec(ts, buf, sizeof(buf)-1);
ASSERT(0 == strcmp(buf, ""), "timespec_get_spec() didn't match input spec(s)");
ASSERT(true == timespec_empty(ts), "timespec_empty() wasn't true");
ASSERT(timespec_add_spec(ts, "08-10"), "Added timespec");
ASSERT(timespec_add_spec(ts, "12:00-13:00"), "Added timespec");
ASSERT(timespec_add_spec(ts, "14:11:05-14:59:52"), "Added timespec");
ASSERT(timespec_add_spec(ts, "23:01:02-01:02:03"), "Added timespec");
ASSERT(!timespec_add_spec(ts, "14:60-15:01"), "Illegal timespec");
ASSERT(false == timespec_empty(ts), "timespec_empty() was't false");
target.tm_sec = 59; target.tm_min = 59; target.tm_hour = 7;
ASSERT(!timespec_match(ts, &target), "No match at 07:59:59");