summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-11-06 17:19:32 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-11-08 13:41:13 +0100
commitb61b95ae9e5c6fe9f34fcadb63175631c36d8e17 (patch)
tree7b3a8bd46a86718e8056e9ba5fb66b63ec91c8fe /src
parenttests: move tests for PROTECT_ERRNO to the right file (diff)
downloadsystemd-b61b95ae9e5c6fe9f34fcadb63175631c36d8e17.tar.xz
systemd-b61b95ae9e5c6fe9f34fcadb63175631c36d8e17.zip
tests: move tests for eqzero() to a new file
It's a bit silly to have a separate file that one short test, but this is the last part of the test code that is misplaced, and here consistency beats brevity.
Diffstat (limited to 'src')
-rw-r--r--src/test/meson.build2
-rw-r--r--src/test/test-memory-util.c18
-rw-r--r--src/test/test-util.c24
3 files changed, 20 insertions, 24 deletions
diff --git a/src/test/meson.build b/src/test/meson.build
index bb09598966..0c6f2db428 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -217,6 +217,8 @@ tests += [
[],
[libm]],
+ [files('test-memory-util.c')],
+
[files('test-mkdir.c')],
[files('test-json.c'),
diff --git a/src/test/test-memory-util.c b/src/test/test-memory-util.c
new file mode 100644
index 0000000000..241f46c0d0
--- /dev/null
+++ b/src/test/test-memory-util.c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "memory-util.h"
+#include "tests.h"
+
+TEST(eqzero) {
+ const uint32_t zeros[] = {0, 0, 0};
+ const uint32_t ones[] = {1, 1};
+ const uint32_t mixed[] = {0, 1, 0, 0, 0};
+ const uint8_t longer[] = {[55] = 255};
+
+ assert_se(eqzero(zeros));
+ assert_se(!eqzero(ones));
+ assert_se(!eqzero(mixed));
+ assert_se(!eqzero(longer));
+}
+
+DEFINE_TEST_MAIN(LOG_INFO);
diff --git a/src/test/test-util.c b/src/test/test-util.c
index d2490228e7..8d0c4a3a42 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -1,17 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-
-#include "fileio.h"
-#include "fs-util.h"
-#include "limits-util.h"
-#include "memory-util.h"
-#include "missing_syscall.h"
-#include "parse-util.h"
-#include "process-util.h"
-#include "raw-clone.h"
-#include "rm-rf.h"
-#include "string-util.h"
#include "tests.h"
#include "util.h"
@@ -83,16 +71,4 @@ TEST(log2i) {
assert_se(log2i(INT_MAX) == sizeof(int)*8-2);
}
-TEST(eqzero) {
- const uint32_t zeros[] = {0, 0, 0};
- const uint32_t ones[] = {1, 1};
- const uint32_t mixed[] = {0, 1, 0, 0, 0};
- const uint8_t longer[] = {[55] = 255};
-
- assert_se(eqzero(zeros));
- assert_se(!eqzero(ones));
- assert_se(!eqzero(mixed));
- assert_se(!eqzero(longer));
-}
-
DEFINE_TEST_MAIN(LOG_INFO);