summaryrefslogtreecommitdiffstats
path: root/src/test/test-calendarspec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-calendarspec.c')
-rw-r--r--src/test/test-calendarspec.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/test/test-calendarspec.c b/src/test/test-calendarspec.c
index 18a0f8f..7cda114 100644
--- a/src/test/test-calendarspec.c
+++ b/src/test/test-calendarspec.c
@@ -16,24 +16,24 @@ static void _test_one(int line, const char *input, const char *output) {
r = calendar_spec_from_string(input, &c);
if (r < 0)
log_error_errno(r, "Failed to parse \"%s\": %m", input);
- assert_se(r >= 0);
+ ASSERT_OK(r);
- assert_se(calendar_spec_to_string(c, &p) >= 0);
+ ASSERT_OK(calendar_spec_to_string(c, &p));
log_info("line %d: \"%s\" → \"%s\"%s%s", line, input, p,
!streq(p, output) ? " expected:" : "",
!streq(p, output) ? output : "");
- assert_se(streq(p, output));
+ ASSERT_STREQ(p, output);
u = now(CLOCK_REALTIME);
r = calendar_spec_next_usec(c, u, &u);
log_info("Next: %s", r < 0 ? STRERROR(r) : FORMAT_TIMESTAMP(u));
c = calendar_spec_free(c);
- assert_se(calendar_spec_from_string(p, &c) >= 0);
- assert_se(calendar_spec_to_string(c, &q) >= 0);
+ ASSERT_OK(calendar_spec_from_string(p, &c));
+ ASSERT_OK(calendar_spec_to_string(c, &q));
- assert_se(streq(q, p));
+ ASSERT_STREQ(q, p);
}
#define test_one(input, output) _test_one(__LINE__, input, output)
@@ -53,7 +53,7 @@ static void _test_next(int line, const char *input, const char *new_tz, usec_t a
assert_se(set_unset_env("TZ", new_tz, true) == 0);
tzset();
- assert_se(calendar_spec_from_string(input, &c) >= 0);
+ ASSERT_OK(calendar_spec_from_string(input, &c));
log_info("line %d: \"%s\" new_tz=%s", line, input, strnull(new_tz));
@@ -82,11 +82,11 @@ TEST(timestamp) {
assert_se(format_timestamp_style(buf, sizeof buf, x, TIMESTAMP_US));
log_info("%s", buf);
- assert_se(calendar_spec_from_string(buf, &c) >= 0);
- assert_se(calendar_spec_to_string(c, &t) >= 0);
+ ASSERT_OK(calendar_spec_from_string(buf, &c));
+ ASSERT_OK(calendar_spec_to_string(c, &t));
log_info("%s", t);
- assert_se(parse_timestamp(t, &y) >= 0);
+ ASSERT_OK(parse_timestamp(t, &y));
assert_se(y == x);
}
@@ -95,9 +95,9 @@ TEST(hourly_bug_4031) {
usec_t n, u, w;
int r;
- assert_se(calendar_spec_from_string("hourly", &c) >= 0);
+ ASSERT_OK(calendar_spec_from_string("hourly", &c));
n = now(CLOCK_REALTIME);
- assert_se((r = calendar_spec_next_usec(c, n, &u)) >= 0);
+ ASSERT_OK((r = calendar_spec_next_usec(c, n, &u)));
log_info("Now: %s (%"PRIu64")", FORMAT_TIMESTAMP_STYLE(n, TIMESTAMP_US), n);
log_info("Next hourly: %s (%"PRIu64")", r < 0 ? STRERROR(r) : FORMAT_TIMESTAMP_STYLE(u, TIMESTAMP_US), u);
@@ -256,7 +256,7 @@ TEST(calendar_spec_from_string) {
static int intro(void) {
/* Tests have hard-coded results that do not expect a specific timezone to be set by the caller */
- assert_se(unsetenv("TZ") >= 0);
+ ASSERT_OK(unsetenv("TZ"));
return EXIT_SUCCESS;
}