From: Fredrik Thulin Date: Mon, 17 Jan 2011 12:57:20 +0000 (+0100) Subject: Add test case for option after mode selection. X-Git-Tag: v1.4.0~12 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d41df97100d47c252b45cebf4bf6c6cbc0553e2;p=yubikey-personalization.old Add test case for option after mode selection. --- diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index 87e78ad..f463306 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -444,6 +444,26 @@ int _test_two_modes_at_once2() free(st); } +int _test_mode_after_other_option() +{ + YKP_CONFIG *cfg = ykp_create_config(); + YK_STATUS *st = _test_init_st(2, 2, 0); + int rc = 0; + + /* Test that it is not possible to set mode after other options */ + char *argv[] = { + "unittest", "-ohmac-lt64", "-ochal-resp", + NULL + }; + int argc = sizeof argv/sizeof argv[0] - 1; + + rc = _test_config(cfg, st, argc, argv); + assert(rc == 0); + + ykp_free_config(cfg); + free(st); +} + int main (int argc, char **argv) { _test_config_slot1(); @@ -457,6 +477,7 @@ int main (int argc, char **argv) _test_two_slots2(); _test_two_modes_at_once1(); _test_two_modes_at_once2(); + _test_mode_after_other_option(); return 0; }