mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
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.
This commit is contained in:
parent
737f274e1e
commit
b61b95ae9e
2
TODO
2
TODO
@ -72,8 +72,6 @@ Regularly:
|
||||
|
||||
Janitorial Clean-ups:
|
||||
|
||||
* Rearrange tests so that the various test-xyz.c match a specific src/basic/xyz.c again
|
||||
|
||||
* rework mount.c and swap.c to follow proper state enumeration/deserialization
|
||||
semantics, like we do for device.c now
|
||||
|
||||
|
@ -217,6 +217,8 @@ tests += [
|
||||
[],
|
||||
[libm]],
|
||||
|
||||
[files('test-memory-util.c')],
|
||||
|
||||
[files('test-mkdir.c')],
|
||||
|
||||
[files('test-json.c'),
|
||||
|
18
src/test/test-memory-util.c
Normal file
18
src/test/test-memory-util.c
Normal file
@ -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);
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user