int _test_two_slots1()
{
- 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 choose slot more than once */
char *argv[] = {
"unittest", "-1", "-1",
NULL
};
- int argc = sizeof argv/sizeof argv[0] - 1;
-
- rc = _test_config(cfg, st, argc, argv);
+ int rc = _parse_args_rc (argv);
assert(rc == 0);
-
- ykp_free_config(cfg);
- free(st);
}
int _test_two_slots2()
{
- 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 choose slot more than once */
char *argv[] = {
"unittest", "-2", "-1",
NULL
};
- int argc = sizeof argv/sizeof argv[0] - 1;
-
- rc = _test_config(cfg, st, argc, argv);
+ int rc = _parse_args_rc (argv);
assert(rc == 0);
-
- ykp_free_config(cfg);
- free(st);
}
int _test_two_modes_at_once1()
{
- 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 choose mode (OATH-HOTP/CHAL-RESP) more than once */
char *argv[] = {
"unittest", "-ochal-resp", "-ooath-hotp",
NULL
};
- int argc = sizeof argv/sizeof argv[0] - 1;
-
- rc = _test_config(cfg, st, argc, argv);
+ int rc = _parse_args_rc (argv);
assert(rc == 0);
-
- ykp_free_config(cfg);
- free(st);
}
int _test_two_modes_at_once2()
{
- 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 choose mode (OATH-HOTP/CHAL-RESP) more than once */
char *argv[] = {
"unittest", "-ochal-resp", "-ochal-resp",
NULL
};
- int argc = sizeof argv/sizeof argv[0] - 1;
-
- rc = _test_config(cfg, st, argc, argv);
+ int rc = _parse_args_rc (argv);
assert(rc == 0);
-
- ykp_free_config(cfg);
- 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);
+ int rc = _parse_args_rc (argv);
assert(rc == 0);
-
- ykp_free_config(cfg);
- free(st);
}
int _test_key_mixed_case1()
{
- YKP_CONFIG *cfg = ykp_create_config();
- YK_STATUS *st = _test_init_st(2, 2, 0);
- int rc = 0;
-
/* Make sure key with mixed case is rejected (parsing function yubikey_hex_decode
* only handles lower case hex)
*/
"unittest", "-1", "-a0000000000000000000000000000000E",
NULL
};
- int argc = sizeof argv/sizeof argv[0] - 1;
-
- rc = _test_config(cfg, st, argc, argv);
+ int rc = _parse_args_rc (argv);
assert(rc == 0);
-
- ykp_free_config(cfg);
- free(st);
}
int _test_uid_for_oath()