diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
commit | 78e9bb837c258ac0ec7712b3d612cc2f407e731e (patch) | |
tree | f515d16b6efd858a9aeb5b0ef5d6f90bf288283d /src/test/test-login-util.c | |
parent | Adding debian version 255.5-1. (diff) | |
download | systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.tar.xz systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.zip |
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/test-login-util.c')
-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); |