1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

test: extend calendarspec test a bit

This commit is contained in:
Lennart Poettering 2012-11-23 21:50:51 +01:00
parent 3062c15117
commit aaa870928f

View File

@ -26,7 +26,7 @@
static void test_one(const char *input, const char *output) {
CalendarSpec *c;
char *p;
_cleanup_free_ char *p = NULL, *q = NULL;
usec_t u;
char buf[FORMAT_TIMESTAMP_MAX];
int r;
@ -37,13 +37,17 @@ static void test_one(const char *input, const char *output) {
printf("\"%s\"\"%s\"\n", input, p);
assert_se(streq(p, output));
free(p);
u = now(CLOCK_REALTIME);
r = calendar_spec_next_usec(c, u, &u);
printf("Next: %s\n", r < 0 ? strerror(-r) : format_timestamp(buf, sizeof(buf), u));
calendar_spec_free(c);
assert_se(calendar_spec_from_string(p, &c) >= 0);
assert_se(calendar_spec_to_string(c, &q) >= 0);
calendar_spec_free(c);
assert_se(streq(q, p));
}
int main(int argc, char* argv[]) {