1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #include "logind-action.h"
4 #include "logind-session.h"
5 #include "sleep-config.h"
6 #include "test-tables.h"
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
;
14 assert_se(data
= handle_action_lookup(action
));
16 assert_se(handle_action_str
= handle_action_to_string(action
));
17 assert_se(sleep_operation_str
= sleep_operation_to_string(data
->sleep_operation
));
19 assert_se(streq(handle_action_str
, sleep_operation_str
));
23 int main(int argc
, char **argv
) {
24 test_setup_logging(LOG_DEBUG
);
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
);
34 test_sleep_handle_action();