summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-08-07 10:48:42 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-08-14 21:43:20 +0200
commit538766ddf47cfd457d9c69f108c035d4d97eaba1 (patch)
treeb3f1c9cff5e720580234fee7ae6e6096e2ef5ef1 /src/test
parentMerge pull request #33990 from yuwata/run-json-follow-ups (diff)
downloadsystemd-538766ddf47cfd457d9c69f108c035d4d97eaba1.tar.xz
systemd-538766ddf47cfd457d9c69f108c035d4d97eaba1.zip
test: add ASSERT_OK_POSITIVE() and ASSERT_OK_ZERO()
Diffstat (limited to 'src/test')
-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 3d5b0cfeed..b56f5b86e4 100644
--- a/src/test/test-macro.c
+++ b/src/test/test-macro.c
@@ -1117,6 +1117,18 @@ TEST(ASSERT) {
ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
ASSERT_SIGNAL(ASSERT_OK(-ENOANO), SIGABRT);
+ ASSERT_OK_POSITIVE(1);
+ ASSERT_OK_POSITIVE(255);
+ ASSERT_SIGNAL(ASSERT_OK_POSITIVE(0), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_POSITIVE(-1), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_POSITIVE(-ENOANO), SIGABRT);
+
+ ASSERT_OK_ZERO(0);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO(1), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO(255), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO(-1), SIGABRT);
+ ASSERT_SIGNAL(ASSERT_OK_ZERO(-ENOANO), SIGABRT);
+
ASSERT_OK_ERRNO(0 >= 0);
ASSERT_OK_ERRNO(255 >= 0);
ASSERT_OK_ERRNO(printf("Hello world\n"));