summaryrefslogtreecommitdiffstats
path: root/src/test/test-login-util.c
blob: 2d20e234ef22cb533ce3febfb9771c50d41f54a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);