2 * Unix SMB/CIFS implementation.
4 * Copyright (C) 2020 Andreas Schneider <asn@samba.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #include "lib/replace/replace.h"
29 #include "libcli/smb/util.c"
31 static void test_smb_signing_setting_translate(void **state
)
33 enum smb_signing_setting signing_state
;
35 signing_state
= smb_signing_setting_translate("wurst");
36 assert_int_equal(signing_state
, SMB_SIGNING_REQUIRED
);
38 signing_state
= smb_signing_setting_translate("off");
39 assert_int_equal(signing_state
, SMB_SIGNING_OFF
);
41 signing_state
= smb_signing_setting_translate("if_required");
42 assert_int_equal(signing_state
, SMB_SIGNING_IF_REQUIRED
);
44 signing_state
= smb_signing_setting_translate("mandatory");
45 assert_int_equal(signing_state
, SMB_SIGNING_REQUIRED
);
49 static void test_smb_encryption_setting_translate(void **state
)
51 enum smb_encryption_setting encryption_state
;
53 encryption_state
= smb_encryption_setting_translate("wurst");
54 assert_int_equal(encryption_state
, SMB_ENCRYPTION_REQUIRED
);
56 encryption_state
= smb_encryption_setting_translate("off");
57 assert_int_equal(encryption_state
, SMB_ENCRYPTION_OFF
);
59 encryption_state
= smb_encryption_setting_translate("if_required");
60 assert_int_equal(encryption_state
, SMB_ENCRYPTION_IF_REQUIRED
);
62 encryption_state
= smb_encryption_setting_translate("mandatory");
63 assert_int_equal(encryption_state
, SMB_ENCRYPTION_REQUIRED
);
67 int main(int argc
, char *argv
[])
70 const struct CMUnitTest tests
[] = {
71 cmocka_unit_test(test_smb_signing_setting_translate
),
72 cmocka_unit_test(test_smb_encryption_setting_translate
),
76 cmocka_set_test_filter(argv
[1]);
78 cmocka_set_message_output(CM_OUTPUT_SUBUNIT
);
80 rc
= cmocka_run_group_tests(tests
, NULL
, NULL
);