From: Klas Lindfors Date: Fri, 9 Nov 2012 14:17:52 +0000 (+0100) Subject: some tests for new neo ndef X-Git-Tag: v1.10.0~29 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=409c8f450c44d59027f769e66c5fe9403693f9d3;p=yubikey-personalization some tests for new neo ndef --- diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index b129a48..8c8786a 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -515,7 +515,7 @@ int _test_swap_with_update(void) assert(rc == 0); } -int _test_ndef_for_neo(void) +int _test_ndef_for_neo_beta(void) { YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 1, 7); @@ -553,7 +553,7 @@ int _test_ndef_with_non_neo(void) free(st); } -int _test_slot_two_with_neo(void) +int _test_slot_two_with_neo_beta(void) { YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 1, 7); @@ -569,6 +569,42 @@ int _test_slot_two_with_neo(void) free(st); } +int _test_ndef2_with_neo_beta(void) +{ + YKP_CONFIG *cfg = ykp_alloc(); + YK_STATUS *st = _test_init_st(2, 1, 7); + + char *argv[] = { + "unittest", "-2", "-nhttps://my.yubico.com/neo/", + }; + int argc = 2; + + int rc = _test_config(cfg, st, argc, argv); + assert(rc == 0); + ykp_free_config(cfg); + free(st); +} + +int _test_ndef2_with_neo(void) +{ + YKP_CONFIG *cfg = ykp_alloc(); + YK_STATUS *st = _test_init_st(3, 0, 0); + + char *argv[] = { + "unittest", "-2", "-nhttps://my.yubico.com/neo/", + NULL + }; + int argc = 3; + + int rc = _test_config(cfg, st, argc, argv); + assert(rc == 1); + struct config_st *ycfg = (struct config_st *) ykp_core_config(cfg); + assert(((struct ykp_config_t*)cfg)->command == SLOT_NDEF2); + + ykp_free_config(cfg); + free(st); +} + int main (int argc, char **argv) { _test_config_slot1(); @@ -589,9 +625,11 @@ int main (int argc, char **argv) _test_swap_with_slot(); _test_slot_with_update(); _test_swap_with_update(); - _test_ndef_for_neo(); + _test_ndef_for_neo_beta(); _test_ndef_with_non_neo(); - _test_slot_two_with_neo(); + _test_slot_two_with_neo_beta(); + _test_ndef2_with_neo(); + _test_ndef2_with_neo_beta(); return 0; }