chiark / gitweb /
tree-wide: drop 'This file is part of systemd' blurb
[elogind.git] / src / test / test-alloc-util.c
index fa3bb9f440b5f2425189da1621aeb6f095ef51a8..d38416a361a1f29191756063ddd5b830e558b482 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 /***
-  This file is part of systemd.
-
   Copyright 2010 Lennart Poettering
 ***/
 
@@ -57,9 +55,30 @@ static void test_memdup_multiply_and_greedy_realloc(void) {
                 assert_se(p[i] == 0);
 }
 
+static void test_bool_assign(void) {
+        bool b, c, *cp = &c, d, e, f, g, h;
+
+        b = 123;
+        *cp = -11;
+        d = 0xF & 0xFF;
+        e = b & d;
+        f = 0x0;
+        g = cp;    /* cast from pointer */
+        h = NULL;  /* cast from pointer */
+
+        assert(b);
+        assert(c);
+        assert(d);
+        assert(e);
+        assert(!f);
+        assert(g);
+        assert(!h);
+}
+
 int main(int argc, char *argv[]) {
         test_alloca();
         test_memdup_multiply_and_greedy_realloc();
+        test_bool_assign();
 
         return 0;
 }