]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/login/test-login-tables.c
polkit: turn "interactive" flag to polkit APIs into a proper flags field (#31715)
[thirdparty/systemd.git] / src / login / test-login-tables.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "logind-action.h"
4 #include "logind-session.h"
5 #include "sleep-config.h"
6 #include "test-tables.h"
7 #include "tests.h"
8
9 static void test_sleep_handle_action(void) {
10 for (HandleAction action = _HANDLE_ACTION_SLEEP_FIRST; action < _HANDLE_ACTION_SLEEP_LAST; action++) {
11 const HandleActionData *data;
12 const char *sleep_operation_str, *handle_action_str;
13
14 assert_se(data = handle_action_lookup(action));
15
16 assert_se(handle_action_str = handle_action_to_string(action));
17 assert_se(sleep_operation_str = sleep_operation_to_string(data->sleep_operation));
18
19 assert_se(streq(handle_action_str, sleep_operation_str));
20 }
21 }
22
23 int main(int argc, char **argv) {
24 test_setup_logging(LOG_DEBUG);
25
26 test_table(handle_action, HANDLE_ACTION);
27 test_table(inhibit_mode, INHIBIT_MODE);
28 test_table(kill_who, KILL_WHO);
29 test_table(session_class, SESSION_CLASS);
30 test_table(session_state, SESSION_STATE);
31 test_table(session_type, SESSION_TYPE);
32 test_table(user_state, USER_STATE);
33
34 test_sleep_handle_action();
35
36 return EXIT_SUCCESS;
37 }