diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-03-27 11:20:20 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-03-27 13:13:23 -0400 |
commit | 25769288f62816d733004c9e8347c35dd0e4ce2a (patch) | |
tree | 9f4face40989e824c24cea08e02bd01c384d1778 /tests/xtime.c | |
parent | 0ad5c7edda2de25e47077d138d7c371f94590a22 (diff) | |
download | bfs-25769288f62816d733004c9e8347c35dd0e4ce2a.tar.xz |
tests: New bfs_pcheck() macro to report xstrerror(errno)
Diffstat (limited to 'tests/xtime.c')
-rw-r--r-- | tests/xtime.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/xtime.c b/tests/xtime.c index ec499d8..f85402e 100644 --- a/tests/xtime.c +++ b/tests/xtime.c @@ -29,9 +29,9 @@ static bool check_one_xgetdate(const char *str, int error, time_t expected) { int ret = xgetdate(str, &ts); if (error) { - return bfs_check(ret == -1 && errno == error, "xgetdate('%s'): %s", str, xstrerror(errno)); + return bfs_pcheck(ret == -1 && errno == error, "xgetdate('%s')", str); } else { - return bfs_check(ret == 0, "xgetdate('%s'): %s", str, xstrerror(errno)) + return bfs_pcheck(ret == 0, "xgetdate('%s')", str) && bfs_check(ts.tv_sec == expected && ts.tv_nsec == 0, "xgetdate('%s'): %jd.%09jd != %jd", str, (intmax_t)ts.tv_sec, (intmax_t)ts.tv_nsec, (intmax_t)expected); @@ -87,7 +87,7 @@ static bool check_one_xmktime(time_t expected) { } time_t actual; - return bfs_check(xmktime(&tm, &actual) == 0, "xmktime(" TM_FORMAT "): %s", TM_PRINTF(tm), xstrerror(errno)) + return bfs_pcheck(xmktime(&tm, &actual) == 0, "xmktime(" TM_FORMAT ")", TM_PRINTF(tm)) && bfs_check(actual == expected, "xmktime(" TM_FORMAT "): %jd != %jd", TM_PRINTF(tm), (intmax_t)actual, (intmax_t)expected); } |