diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:45 +0000 |
commit | efeb864cb547a2cbf96dc0053a8bdb4d9190b364 (patch) | |
tree | c0b83368f18be983fcc763200c4c24d633244588 /src/test/test-login-util.c | |
parent | Releasing progress-linux version 255.5-1~progress7.99u1. (diff) | |
download | systemd-efeb864cb547a2cbf96dc0053a8bdb4d9190b364.tar.xz systemd-efeb864cb547a2cbf96dc0053a8bdb4d9190b364.zip |
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/test/test-login-util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/test-login-util.c b/src/test/test-login-util.c new file mode 100644 index 0000000..2d20e23 --- /dev/null +++ b/src/test/test-login-util.c @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#include "login-util.h" +#include "string-util.h" +#include "tests.h" + +TEST(session_id_valid) { + /* Invalid Session ID */ + assert_se(!session_id_valid("")); + assert_se(!session_id_valid(NULL)); + assert_se(!session_id_valid("abc-123")); + assert_se(!session_id_valid("abc_123")); + assert_se(!session_id_valid("abc123*")); + + /* Valid Session ID */ + assert_se(session_id_valid("abc123")); + assert_se(session_id_valid("AbCdEfG123456")); + assert_se(session_id_valid("1234567890")); + assert_se(session_id_valid("ABCDEFGHI")); +} + +DEFINE_TEST_MAIN(LOG_DEBUG); |