]> err.no Git - yubikey-personalization/commitdiff
Add test case for option after mode selection.
authorFredrik Thulin <fredrik@yubico.com>
Mon, 17 Jan 2011 12:57:20 +0000 (13:57 +0100)
committerFredrik Thulin <fredrik@yubico.com>
Mon, 17 Jan 2011 12:57:20 +0000 (13:57 +0100)
tests/test_args_to_config.c

index 87e78ad2daa92b2ce78281bd99b8c0bc53fb8baf..f4633060f982e7c98651e9b7e38cb8a26f0b49c5 100644 (file)
@@ -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;
 }