From 5b20e0f06a4103a48872f85322e37243dc041c47 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Tue, 10 Apr 2012 14:32:51 +0200 Subject: [PATCH] simple tests for parsing of new flags. --- tests/test_args_to_config.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index 2449dbd..db1c17e 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -474,6 +474,39 @@ int _test_uid_for_chal_resp(void) assert(rc == 0); } +int _test_swap_with_slot(void) +{ + /* Test that you can not both swap and set slot */ + char *argv[] = { + "unittest", "-x", "-1", + NULL + }; + int rc = _parse_args_rc (3, argv); + assert(rc == 0); +} + +int _test_slot_with_update(void) +{ + /* Test the update must be before slot */ + char *argv[] = { + "unittest", "-1", "-u", + NULL + }; + int rc = _parse_args_rc (3, argv); + assert(rc == 0); +} + +int _test_swap_with_update(void) +{ + /* Test the update must be before slot */ + char *argv[] = { + "unittest", "-u", "-x", + NULL + }; + int rc = _parse_args_rc (3, argv); + assert(rc == 0); +} + int main (int argc, char **argv) { _test_config_slot1(); @@ -491,6 +524,9 @@ int main (int argc, char **argv) _test_key_mixed_case1(); _test_uid_for_oath(); _test_uid_for_chal_resp(); + _test_swap_with_slot(); + _test_slot_with_update(); + _test_swap_with_update(); return 0; } -- 2.39.5