diff options
author | Stef Walter <stef@thewalter.net> | 2013-08-27 21:14:35 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-08-28 13:52:34 +0200 |
commit | dec3efbaf4a6550bc45d1b9926e4d66b93306802 (patch) | |
tree | bd7f4eaff34def1fd321688e3e361413e960953d /p11-kit/tests/test-iter.c | |
parent | c15dca006ca69c26ec083a4f2d4aac76b9f30d52 (diff) |
iter: Add p11_kit_iter_set_uri() function
This is so we can set a filtering uri on the iterator after construction
Diffstat (limited to 'p11-kit/tests/test-iter.c')
-rw-r--r-- | p11-kit/tests/test-iter.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/p11-kit/tests/test-iter.c b/p11-kit/tests/test-iter.c index a1d1c9c..46b825e 100644 --- a/p11-kit/tests/test-iter.c +++ b/p11-kit/tests/test-iter.c @@ -519,6 +519,33 @@ test_uri_with_type (void) } static void +test_set_uri (void) +{ + CK_FUNCTION_LIST_PTR *modules; + P11KitIter *iter; + P11KitUri *uri; + CK_RV rv; + + modules = initialize_and_get_modules (); + + uri = p11_kit_uri_new (); + p11_kit_uri_set_unrecognized (uri, 1); + iter = p11_kit_iter_new (NULL, 0); + p11_kit_iter_set_uri (iter, uri); + p11_kit_uri_free (uri); + + p11_kit_iter_begin (iter, modules); + + /* Nothing should have matched */ + rv = p11_kit_iter_next (iter); + assert_num_eq (rv, CKR_CANCEL); + + p11_kit_iter_free (iter); + + finalize_and_free_modules (modules); +} + +static void test_filter (void) { CK_OBJECT_HANDLE objects[128]; @@ -1165,6 +1192,7 @@ main (int argc, p11_test (test_all, "/iter/test_all"); p11_test (test_unrecognized, "/iter/test_unrecognized"); p11_test (test_uri_with_type, "/iter/test_uri_with_type"); + p11_test (test_set_uri, "/iter/set-uri"); p11_test (test_session_flags, "/iter/test_session_flags"); p11_test (test_callback, "/iter/test_callback"); p11_test (test_callback_fails, "/iter/test_callback_fails"); |