Add macros adding NEGATIVE_ or POSITIVE_ prefix to test name 28/233728/15
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 18 May 2020 13:29:37 +0000 (15:29 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 6 Jul 2020 09:59:38 +0000 (11:59 +0200)
Change-Id: I3f0681ed8697b301b061778cb9e4babb81c5ab30

tests/api_test.cpp
tests/test_macros.h [new file with mode: 0644]

index 29a3696..2cd611b 100644 (file)
 #include <cstring>
 
 #include <boost/algorithm/hex.hpp>
-#include <boost/test/unit_test.hpp>
 
 #include "device_certificate_manager.h"
+#include "test_macros.h"
 
 BOOST_AUTO_TEST_SUITE(API_TEST)
 
-BOOST_AUTO_TEST_CASE(test01_dcm_create_key_context)
+POSITIVE_TEST_CASE(test01_dcm_create_key_context)
 {
     void *ctx;
     int ret = dcm_create_key_context(NULL, NULL, NULL, &ctx);
@@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(test01_dcm_create_key_context)
     BOOST_REQUIRE_EQUAL(ret, DCM_ERROR_NONE);
 }
 
-BOOST_AUTO_TEST_CASE(test02_dcm_get_certificate_chain)
+POSITIVE_TEST_CASE(test02_dcm_get_certificate_chain)
 {
     void *ctx;
     char *cert;
@@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(test02_dcm_get_certificate_chain)
     free(cert);
 }
 
-BOOST_AUTO_TEST_CASE(test03_dcm_get_key_bit_length)
+POSITIVE_TEST_CASE(test03_dcm_get_key_bit_length)
 {
     int ret;
     void *ctx;
@@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(test03_dcm_get_key_bit_length)
     BOOST_REQUIRE_EQUAL(ret, DCM_ERROR_NONE);
 }
 
-BOOST_AUTO_TEST_CASE(test04_dcm_get_key_type)
+POSITIVE_TEST_CASE(test04_dcm_get_key_type)
 {
     int ret;
     void *ctx;
@@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE(test04_dcm_get_key_type)
     free(key_type);
 }
 
-BOOST_AUTO_TEST_CASE(test05_dcm_create_signature)
+POSITIVE_TEST_CASE(test05_dcm_create_signature)
 {
     int ret;
     void *ctx;
diff --git a/tests/test_macros.h b/tests/test_macros.h
new file mode 100644 (file)
index 0000000..5459b40
--- /dev/null
@@ -0,0 +1,25 @@
+/******************************************************************
+ *
+ * Copyright 2020 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#pragma once
+
+#include <boost/test/unit_test.hpp>
+
+#define POSITIVE_TEST_CASE(name) BOOST_AUTO_TEST_CASE(POSITIVE_ ## name)
+#define NEGATIVE_TEST_CASE(name) BOOST_AUTO_TEST_CASE(NEGATIVE_ ## name)
+