]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/test-login-tables.c
Merge pull request #29853 from YHNdnzj/sleep-automated
[thirdparty/systemd.git] / src / login / test-login-tables.c
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
a8b409db
ZJS
2
3#include "logind-action.h"
4#include "logind-session.h"
0f15d14c 5#include "sleep-config.h"
a8b409db 6#include "test-tables.h"
965040d8 7#include "tests.h"
a8b409db 8
0f15d14c
MY
9static 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
cd4dd90b
MY
14 if (action == HANDLE_SLEEP)
15 continue;
16
0f15d14c
MY
17 assert_se(data = handle_action_lookup(action));
18
19 assert_se(handle_action_str = handle_action_to_string(action));
20 assert_se(sleep_operation_str = sleep_operation_to_string(data->sleep_operation));
21
22 assert_se(streq(handle_action_str, sleep_operation_str));
23 }
24}
25
a8b409db 26int main(int argc, char **argv) {
965040d8
YW
27 test_setup_logging(LOG_DEBUG);
28
a8b409db
ZJS
29 test_table(handle_action, HANDLE_ACTION);
30 test_table(inhibit_mode, INHIBIT_MODE);
31 test_table(kill_who, KILL_WHO);
32 test_table(session_class, SESSION_CLASS);
33 test_table(session_state, SESSION_STATE);
34 test_table(session_type, SESSION_TYPE);
35 test_table(user_state, USER_STATE);
36
0f15d14c
MY
37 test_sleep_handle_action();
38
a8b409db
ZJS
39 return EXIT_SUCCESS;
40}