summaryrefslogtreecommitdiffstats
path: root/src/test/test-macro.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-09-19 11:38:47 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-09-19 11:38:47 +0200
commit1d8a81eb4ea8e8c1fc82e839cb9f2a65da5346ad (patch)
treeee28ffec6cdf9d8fa71580d5b2cddbaab66626a4 /src/test/test-macro.c
parentnsresourced: fix build without libbpf (diff)
downloadsystemd-1d8a81eb4ea8e8c1fc82e839cb9f2a65da5346ad.tar.xz
systemd-1d8a81eb4ea8e8c1fc82e839cb9f2a65da5346ad.zip
Add ASSERT_OK_ZERO_ERRNO() and ASSERT_OK_EQ_ERRNO()
Diffstat (limited to 'src/test/test-macro.c')
-rw-r--r--src/test/test-macro.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/test-macro.c b/src/test/test-macro.c
index 69df6bc567..c4c533777d 100644
--- a/src/test/test-macro.c
+++ b/src/test/test-macro.c
@@ -1141,6 +1141,18 @@ TEST(ASSERT) {
ASSERT_SIGNAL(ASSERT_OK_ERRNO(-1), SIGABRT);
ASSERT_SIGNAL(ASSERT_OK_ERRNO(-ENOANO), SIGABRT);
+ ASSERT_OK_ZERO_ERRNO(0);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO_ERRNO(1), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO_ERRNO(255), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO_ERRNO(-1), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO_ERRNO(-ENOANO), SIGABRT);
+
+ ASSERT_OK_EQ_ERRNO(0, 0);
+ ASSERT_SIGNAL(ASSERT_OK_EQ_ERRNO(1, 0), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_EQ_ERRNO(255, 5), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_EQ_ERRNO(-1, 0), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_EQ_ERRNO(-ENOANO, 0), SIGABRT);
+
ASSERT_FAIL(-ENOENT);
ASSERT_FAIL(-EPERM);
ASSERT_SIGNAL(ASSERT_FAIL(0), SIGABRT);