diff options
author | Stef Walter <stef@thewalter.net> | 2013-08-27 21:05:31 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-08-28 13:49:17 +0200 |
commit | c15dca006ca69c26ec083a4f2d4aac76b9f30d52 (patch) | |
tree | 0c2e8ab21bdf868faf6260caa3bb39471478f533 /p11-kit/tests | |
parent | 3f357776c15255710997e61ca305aa5a2ce5cf02 (diff) |
iter: Add p11_kit_iter_get_token() call
To get the already loaded CK_TOKEN_INFO during iteration for the
token that the current object is on.
Diffstat (limited to 'p11-kit/tests')
-rw-r--r-- | p11-kit/tests/test-iter.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/p11-kit/tests/test-iter.c b/p11-kit/tests/test-iter.c index b6bf6f9..a1d1c9c 100644 --- a/p11-kit/tests/test-iter.c +++ b/p11-kit/tests/test-iter.c @@ -740,6 +740,37 @@ test_token_mismatch (void) } static void +test_token_info (void) +{ + CK_FUNCTION_LIST_PTR *modules; + CK_TOKEN_INFO *info; + P11KitIter *iter; + char *string; + CK_RV rv; + + modules = initialize_and_get_modules (); + + iter = p11_kit_iter_new (NULL, 0); + p11_kit_iter_begin (iter, modules); + + rv = p11_kit_iter_next (iter); + assert_num_eq (rv, CKR_OK); + + info = p11_kit_iter_get_token (iter); + assert_ptr_not_null (info); + + string = p11_kit_space_strdup (info->label, sizeof (info->label)); + assert_ptr_not_null (string); + + assert_str_eq (string, "TEST LABEL"); + + free (string); + p11_kit_iter_free (iter); + + finalize_and_free_modules (modules); +} + +static void test_getslotlist_fail_first (void) { CK_FUNCTION_LIST module; @@ -1145,6 +1176,7 @@ main (int argc, p11_test (test_keep_session, "/iter/test_keep_session"); p11_test (test_token_match, "/iter/test_token_match"); p11_test (test_token_mismatch, "/iter/test_token_mismatch"); + p11_test (test_token_info, "/iter/token-info"); p11_test (test_module_match, "/iter/test_module_match"); p11_test (test_module_mismatch, "/iter/test_module_mismatch"); p11_test (test_getslotlist_fail_first, "/iter/test_getslotlist_fail_first"); |