From: Krzysztof Jackiewicz Date: Mon, 26 Jan 2015 13:04:46 +0000 (+0100) Subject: RUNNER_ASSERT wrappers moved to ckm-common.h X-Git-Tag: security-manager_5.5_testing~9^2~119 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ce6736838d8598d72f86c7d2b555ef10b04142f;hp=c2843c3345f70313d5c070caa7a514cff98b2577;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git RUNNER_ASSERT wrappers moved to ckm-common.h [Issue#] N/A [Feature/Bug] N/A [Problem] N/A [Cause] Wrappers for RUNNER_ASSERT could be used by other tests. [Solution] Wrappers moved to ckm-common.h [Verification] Successfull compilation Change-Id: Id9766c09d07c142814c3f3acd65a7b581ab5a061 --- diff --git a/tests/ckm/capi-certificate-chains.cpp b/tests/ckm/capi-certificate-chains.cpp index 8226a37..49a366a 100644 --- a/tests/ckm/capi-certificate-chains.cpp +++ b/tests/ckm/capi-certificate-chains.cpp @@ -229,36 +229,6 @@ enum CertIdx{ CERT_TEST_LEAF, // test certificate signed with CERT_TEST_IM_CA }; -template -void assert_result(int expected, F&& func, Args... args) -{ - int ret = func(args...); - RUNNER_ASSERT_MSG_BT(ret == expected, "Expected " << expected << " got: " << ret); -} - -template -void assert_positive(F&& func, Args... args) -{ - assert_result(CKMC_ERROR_NONE, std::move(func), args...); -} - -template -void assert_invalid_param(F&& func, Args... args) -{ - assert_result(CKMC_ERROR_INVALID_PARAMETER, std::move(func), args...); -} - -template -size_t list_size(const T* list) -{ - size_t size = 0; - while(list) { - list = list->next; - size++; - } - return size; -} - typedef std::unique_ptr CertPtr; typedef std::unique_ptr CertListPtr; typedef std::unique_ptr AliasListPtr; diff --git a/tests/ckm/ckm-common.h b/tests/ckm/ckm-common.h index 3d0695a..3b0d514 100644 --- a/tests/ckm/ckm-common.h +++ b/tests/ckm/ckm-common.h @@ -24,11 +24,47 @@ #include #include #include +#include +#include void switch_to_storage_user(const char* label); void switch_to_storage_ocsp_user(const char* label); +// RUNNER_ASSERT wrappers +template +void assert_result(int expected, F&& func, Args... args) +{ + int ret = func(args...); + RUNNER_ASSERT_MSG_BT(ret == expected, "Expected " << expected << " got: " << ret); +} + +template +void assert_positive(F&& func, Args... args) +{ + assert_result(CKMC_ERROR_NONE, std::move(func), args...); +} + +template +void assert_invalid_param(F&& func, Args... args) +{ + assert_result(CKMC_ERROR_INVALID_PARAMETER, std::move(func), args...); +} + + +// list operations +template +size_t list_size(const T* list) +{ + size_t size = 0; + while(list) { + list = list->next; + size++; + } + return size; +} + + // service lifecycle management enum ServiceIdx { LISTENER,