From c15dca006ca69c26ec083a4f2d4aac76b9f30d52 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 27 Aug 2013 21:05:31 +0200 Subject: 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. --- p11-kit/tests/test-iter.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'p11-kit/tests') 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"); -- cgit v1.1