]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Use assert_se() where variables are only checked by assert
authorBenjamin Robin <dev@benjarobin.fr>
Wed, 6 May 2020 18:32:27 +0000 (20:32 +0200)
committerBenjamin Robin <dev@benjarobin.fr>
Wed, 6 May 2020 21:03:25 +0000 (23:03 +0200)
Allow to build without any warning with NDEBUG defined

src/test/test-alloc-util.c
src/test/test-fd-util.c
src/test/test-time-util.c

index 758b753237903aa238b7226d8fa9251252271648..d85f705504403cdd9240e966adb17c8cce9e29b4 100644 (file)
@@ -99,13 +99,13 @@ static void test_bool_assign(void) {
         g = cp;    /* cast from pointer */
         h = NULL;  /* cast from pointer */
 
-        assert(b);
-        assert(c);
-        assert(d);
-        assert(e);
-        assert(!f);
-        assert(g);
-        assert(!h);
+        assert_se(b);
+        assert_se(c);
+        assert_se(d);
+        assert_se(e);
+        assert_se(!f);
+        assert_se(g);
+        assert_se(!h);
 }
 
 static int cleanup_counter = 0;
index 713795814dfab36b12a08e42e8cc89b63fea92e7..44c74987c58227f631fa40687c53bfc821162eda 100644 (file)
@@ -233,17 +233,17 @@ static void assert_equal_fd(int fd1, int fd2) {
                 ssize_t x, y;
 
                 x = read(fd1, a, sizeof(a));
-                assert(x >= 0);
+                assert_se(x >= 0);
 
                 y = read(fd2, b, sizeof(b));
-                assert(y >= 0);
+                assert_se(y >= 0);
 
-                assert(x == y);
+                assert_se(x == y);
 
                 if (x == 0)
                         break;
 
-                assert(memcmp(a, b, x) == 0);
+                assert_se(memcmp(a, b, x) == 0);
         }
 }
 
index a422cc8ddc63e5a4e1a5c5a686cf65e7b6400241..e3b1f6f8ca07c0fe29f2010c1d1313c670a81004 100644 (file)
@@ -433,7 +433,7 @@ static void assert_similar(usec_t a, usec_t b) {
         else
                 d = b - a;
 
-        assert(d < 10*USEC_PER_SEC);
+        assert_se(d < 10*USEC_PER_SEC);
 }
 
 static void test_usec_shift_clock(void) {