From: Yu Watanabe Date: Tue, 25 Oct 2022 18:32:05 +0000 (+0900) Subject: test: add test for IN_SET() with bitfield specifier X-Git-Tag: v253-rc1~637^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F25134%2Fhead;p=thirdparty%2Fsystemd.git test: add test for IN_SET() with bitfield specifier --- diff --git a/src/test/test-macro.c b/src/test/test-macro.c index 049ea2c14e1..001166d0dcc 100644 --- a/src/test/test-macro.c +++ b/src/test/test-macro.c @@ -209,6 +209,16 @@ TEST(in_set) { assert_se(IN_SET(4, 1, 2, 3, 4)); assert_se(!IN_SET(0, 1)); assert_se(!IN_SET(0, 1, 2, 3, 4)); + + struct { + unsigned x:3; + } t = { 1 }; + + assert_se(IN_SET(t.x, 1)); + assert_se(IN_SET(t.x, 1, 2, 3, 4)); + assert_se(IN_SET(t.x, 2, 3, 4, 1)); + assert_se(!IN_SET(t.x, 0)); + assert_se(!IN_SET(t.x, 2, 3, 4)); } TEST(foreach_pointer) {