ADD_SUBDIRECTORY(systemd)
ADD_SUBDIRECTORY(etc)
-IF (DEFINED CERTSVC_TEST_BUILD)
ADD_DEFINITIONS("-DTESTAPP_RES_DIR=\"${CERT_SVC_TESTS}/\"")
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(examples)
-ENDIF (DEFINED CERTSVC_TEST_BUILD)
+ADD_SUBDIRECTORY(unit-tests)
CONFIGURE_FILE(packaging/cert-svc.manifest.in cert-svc.manifest @ONLY)
-%define certsvc_test_build 0
-
Name: cert-svc
Summary: Certification service
Version: 2.2.2
BuildRequires: ca-certificates
BuildRequires: ca-certificates-devel
BuildRequires: ca-certificates-tizen-devel
+BuildRequires: boost-devel
Requires: ca-certificates
Requires: ca-certificates-tizen
Requires: security-config
%description devel
Certification service (development files)
-%if 0%{?certsvc_test_build}
%package test
Summary: Certification service (tests)
Group: Security/Testing
%description test-binaries
Certification service (test binaries)
-%endif
%prep
%setup -q
-DCERT_SVC_RO_PATH=%cert_svc_ro_path \
-DCERT_SVC_PKCS12=%cert_svc_pkcs12 \
-DCERT_SVC_DB_PATH=%cert_svc_db_path \
-%if 0%{?certsvc_test_build}
- -DCERTSVC_TEST_BUILD=1 \
-DCERT_SVC_TESTS=%cert_svc_tests \
-DCERT_SVC_EXAMPLES=%cert_svc_examples \
-%endif
-DCMAKE_BUILD_TYPE=%build_type \
-DSYSTEMD_UNIT_DIR=%_unitdir
%_libdir/pkgconfig/*
%_libdir/libcert-svc-vcore.so
-%if 0%{?certsvc_test_build}
%files test
%manifest %name.manifest
%bin_dir/cert-svc-test*
%bin_dir/cert-svc-example*
%cert_svc_examples
+%bin_dir/cert-svc-unit-tests
+
%files test-binaries
%manifest %name.manifest
%cert_svc_tests/apps
-
-%endif
--- /dev/null
+# Copyright (c) 2024 Samsung Electronics Co., Ltd 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.
+#
+SET(TARGET_UNIT_TESTS "cert-svc-unit-tests")
+
+PKG_CHECK_MODULES(UNIT_TESTS_DEPS
+ REQUIRED
+ xmlsec1
+ dlog
+ key-manager
+ sqlite3
+ libsystemd
+ openssl3
+ libxml-2.0
+ libpcrecpp
+)
+
+ADD_DEFINITIONS( "-DBOOST_TEST_DYN_LINK" )
+ADD_DEFINITIONS(${UNIT_TESTS_DEPS_CFLAGS})
+ADD_DEFINITIONS(${UNIT_TESTS_DEPS_CFLAGS_OTHER})
+
+FILE(GLOB VCORE_SOURCES ${PROJECT_SOURCE_DIR}/src/vcore/*.cpp)
+FILE(GLOB DPL_LOG_SOURCES ${PROJECT_SOURCE_DIR}/src/dpl/log/src/*.cpp)
+FILE(GLOB DPL_CORE_SOURCES ${PROJECT_SOURCE_DIR}/src/dpl/core/src/*.cpp)
+
+SET(UNIT_TESTS_SOURCES
+ test_main.cpp
+ test_vcore_cert_store_type.cpp
+ test_vcore_api.cpp
+ test_cert_server_db.cpp
+ colour_log_formatter.cpp
+ ${PROJECT_SOURCE_DIR}/src/server/src/cert-server-logic.c
+ ${PROJECT_SOURCE_DIR}/src/server/src/cert-server-db.c
+)
+
+INCLUDE_DIRECTORIES(
+ SYSTEM
+ ${UNIT_TESTS_DEPS_INCLUDE_DIRS}
+ ${PROJECT_SOURCE_DIR}/src
+ ${PROJECT_SOURCE_DIR}/src/dpl/log/include
+ ${PROJECT_SOURCE_DIR}/src/dpl/core/include
+ ${PROJECT_SOURCE_DIR}/src/server/include
+)
+
+ADD_EXECUTABLE(
+ ${TARGET_UNIT_TESTS}
+ ${UNIT_TESTS_SOURCES}
+ ${VCORE_SOURCES}
+ ${DPL_CORE_SOURCES}
+ ${DPL_LOG_SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(
+ ${TARGET_UNIT_TESTS}
+ ${UNIT_TESTS_DEPS_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ boost_unit_test_framework
+ -ldl
+)
+
+SET_SOURCE_FILES_PROPERTIES(
+ ${UNIT_TESTS_SOURCES}
+ PROPERTIES
+ COMPILE_FLAGS "-D_GNU_SOURCE -fvisibility=hidden -fPIE"
+)
+
+INSTALL(TARGETS ${TARGET_UNIT_TESTS} DESTINATION ${BIN_DIR})
--- /dev/null
+/*\r
+ * (C) Copyright Gennadiy Rozental 2005-2008.\r
+ * Distributed under the Boost Software License, Version 1.0.\r
+ * (See accompanying file LICENSE_1_0.txt or copy at\r
+ * http://www.boost.org/LICENSE_1_0.txt)\r
+ *\r
+ * See http://www.boost.org/libs/test for the library home page.\r
+ */\r
+\r
+// Boost.Test\r
+#include "colour_log_formatter.h"\r
+#include <boost/test/impl/execution_monitor.ipp>\r
+#if BOOST_VERSION >= 105900\r
+#include <boost/test/tree/test_unit.hpp>\r
+#else\r
+#include <boost/test/unit_test_suite_impl.hpp>\r
+#endif\r
+#include <boost/test/framework.hpp>\r
+#include <boost/test/utils/basic_cstring/io.hpp>\r
+#include <boost/test/utils/lazy_ostream.hpp>\r
+\r
+// Boost\r
+#include <boost/version.hpp>\r
+\r
+// STL\r
+#include <iostream>\r
+#include <string>\r
+\r
+const char* GREEN_BEGIN = "\033[0;32m";\r
+const char* RED_BEGIN = "\033[0;31m";\r
+const char* CYAN_BEGIN = "\033[0;36m";\r
+const char* BOLD_YELLOW_BEGIN = "\033[1;33m";\r
+const char* COLOR_END = "\033[m";\r
+\r
+// ************************************************************************** //\r
+// ************** colour_log_formatter ************** //\r
+// ************************************************************************** //\r
+\r
+using namespace boost::unit_test;\r
+namespace CertSvc {\r
+\r
+namespace {\r
+\r
+const_string\r
+test_unit_type_name(const test_unit &tu)\r
+{\r
+#if BOOST_VERSION >= 105900\r
+ return const_string(tu.p_type_name);\r
+#else\r
+ return tu.p_type_name.get();\r
+#endif\r
+}\r
+\r
+const_string\r
+test_unit_name(const test_unit &tu)\r
+{\r
+#if BOOST_VERSION >= 105900\r
+ return const_string(tu.p_name);\r
+#else\r
+ return tu.p_name.get();\r
+#endif\r
+}\r
+\r
+const_string\r
+test_phase_identifier()\r
+{\r
+ return test_unit_name(framework::current_test_case());\r
+}\r
+\r
+const_string\r
+get_basename(const const_string &file_name)\r
+{\r
+ return basename(file_name.begin());\r
+}\r
+\r
+std::string\r
+get_basename(const std::string &file_name)\r
+{\r
+ return basename(file_name.c_str());\r
+}\r
+\r
+bool\r
+test_unit_type_name_contains(const test_unit &tu, const std::string &substr)\r
+{\r
+ return test_unit_type_name(tu).find(const_string(substr)) == 0;\r
+}\r
+\r
+} // local namespace\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_start(\r
+ std::ostream &output,\r
+ counter_t test_cases_amount)\r
+{\r
+ if (test_cases_amount > 0)\r
+ output << "Running " << test_cases_amount << " test "\r
+ << (test_cases_amount > 1 ? "cases" : "case") << "...\n";\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_finish(std::ostream &ostr)\r
+{\r
+ ostr.flush();\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_build_info(std::ostream &output, bool log_build_info)\r
+{\r
+ if (log_build_info)\r
+ output << "Platform: " << BOOST_PLATFORM << '\n'\r
+ << "Compiler: " << BOOST_COMPILER << '\n'\r
+ << "STL : " << BOOST_STDLIB << '\n';\r
+ output << "Boost : " << BOOST_VERSION / 100000 << '.'\r
+ << BOOST_VERSION / 100 % 1000 << '.'\r
+ << BOOST_VERSION % 100 << std::endl;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::test_unit_start(\r
+ std::ostream &output,\r
+ test_unit const &tu)\r
+{\r
+ if (test_unit_type_name_contains(tu, "suite")) {\r
+ output << "Starting test ";\r
+ } else {\r
+ output << "Running test ";\r
+ }\r
+ output << test_unit_type_name(tu) << " \"" << test_unit_name(tu)\r
+ << "\"" << std::endl;\r
+\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::test_unit_finish(\r
+ std::ostream &output,\r
+ test_unit const &tu,\r
+ unsigned long elapsed)\r
+{\r
+ if (test_unit_type_name_contains(tu, "suite")) {\r
+ output << "Finished test " << test_unit_type_name(tu) << " \"" << test_unit_name(tu) << "\"" <<\r
+ std::endl;\r
+ return;\r
+ }\r
+\r
+ std::string color = GREEN_BEGIN;\r
+ std::string status = "OK";\r
+\r
+ if (m_isTestCaseFailed) {\r
+ color = RED_BEGIN;\r
+ status = "FAIL";\r
+ }\r
+\r
+ output << "\t" << "[ " << color << status << COLOR_END <<\r
+ " ]";\r
+\r
+\r
+ output << ", " << CYAN_BEGIN << "time: ";\r
+\r
+ if (elapsed > 0) {\r
+ if (elapsed % 1000 == 0)\r
+ output << elapsed / 1000 << "ms";\r
+ else\r
+ output << elapsed << "mks";\r
+ } else {\r
+ output << "N/A";\r
+ }\r
+\r
+ output << COLOR_END << std::endl;\r
+ m_isTestCaseFailed = false;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::test_unit_skipped(\r
+ std::ostream &output,\r
+ test_unit const &tu)\r
+{\r
+ output << "Test " << test_unit_type_name(tu) << " \"" << test_unit_name(tu) << "\"" <<\r
+ "is skipped" << std::endl;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_exception(\r
+ std::ostream &output,\r
+ log_checkpoint_data const &checkpoint_data,\r
+ boost::execution_exception const &ex)\r
+{\r
+ boost::execution_exception::location const &loc = ex.where();\r
+ output << '\t' << BOLD_YELLOW_BEGIN << get_basename(\r
+ loc.m_file_name)\r
+ << '(' << loc.m_line_num << "), ";\r
+\r
+ output << "fatal error in \""\r
+ << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function) <<\r
+ "\": ";\r
+\r
+ output << COLOR_END << ex.what();\r
+\r
+ if (!checkpoint_data.m_file_name.is_empty()) {\r
+ output << '\n';\r
+ output << "\tlast checkpoint : " << get_basename(checkpoint_data.m_file_name)\r
+ << '(' << checkpoint_data.m_line_num << ")";\r
+\r
+ if (!checkpoint_data.m_message.empty())\r
+ output << ": " << checkpoint_data.m_message;\r
+ }\r
+\r
+ output << std::endl;\r
+ m_isTestCaseFailed = true;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_entry_start(\r
+ std::ostream &output,\r
+ log_entry_data const &entry_data,\r
+ log_entry_types let)\r
+{\r
+ switch (let) {\r
+ case BOOST_UTL_ET_INFO:\r
+ output << '\t' << entry_data.m_file_name << '(' << entry_data.m_line_num <<\r
+ "), ";\r
+ output << "info: ";\r
+ break;\r
+\r
+ case BOOST_UTL_ET_MESSAGE:\r
+ break;\r
+\r
+ case BOOST_UTL_ET_WARNING:\r
+ output << '\t' << get_basename(entry_data.m_file_name) << '(' <<\r
+ entry_data.m_line_num << "), ";\r
+ output << "warning in \"" << test_phase_identifier() << "\": ";\r
+ break;\r
+\r
+ case BOOST_UTL_ET_ERROR:\r
+ output << '\t' << BOLD_YELLOW_BEGIN << get_basename(\r
+ entry_data.m_file_name)\r
+ << '(' << entry_data.m_line_num << "), ";\r
+ output << "error in \"" << test_phase_identifier() << "\": ";\r
+ m_isTestCaseFailed = true;\r
+ break;\r
+\r
+ case BOOST_UTL_ET_FATAL_ERROR:\r
+ output << '\t' << BOLD_YELLOW_BEGIN << get_basename(\r
+ entry_data.m_file_name)\r
+ << '(' << entry_data.m_line_num << "), ";\r
+ output << " fatal error in \"" << test_phase_identifier() << "\": ";\r
+ m_isTestCaseFailed = true;\r
+ break;\r
+ }\r
+\r
+ output << COLOR_END;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_entry_value(\r
+ std::ostream &output,\r
+ const_string value)\r
+{\r
+ output << value;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_entry_value(\r
+ std::ostream &output,\r
+ lazy_ostream const &value)\r
+{\r
+ output << value;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+void\r
+colour_log_formatter::log_entry_finish(\r
+ std::ostream &output)\r
+{\r
+ output << std::endl;\r
+}\r
+\r
+//____________________________________________________________________________//\r
+\r
+#if BOOST_VERSION >= 106501\r
+void\r
+colour_log_formatter::log_exception_start(\r
+ std::ostream& os,\r
+ boost::unit_test::log_checkpoint_data const& lcd,\r
+ boost::execution_exception const& ex)\r
+{\r
+ log_exception(os, lcd, ex);\r
+}\r
+\r
+void\r
+colour_log_formatter::log_exception_finish(std::ostream& os)\r
+{\r
+ (void)os;\r
+}\r
+\r
+void\r
+colour_log_formatter::entry_context_start(\r
+ std::ostream& os,\r
+ boost::unit_test::log_level l)\r
+{\r
+ (void)os;\r
+ (void)l;\r
+}\r
+\r
+void\r
+colour_log_formatter::log_entry_context(\r
+ std::ostream& os,\r
+ boost::unit_test::log_level l,\r
+ boost::unit_test::const_string value)\r
+{\r
+ (void)os;\r
+ (void)l;\r
+ (void)value;\r
+}\r
+\r
+void\r
+colour_log_formatter::entry_context_finish(\r
+ std::ostream& os,\r
+ boost::unit_test::log_level l)\r
+{\r
+ (void)os;\r
+ (void)l;\r
+}\r
+#endif\r
+\r
+//____________________________________________________________________________//\r
+\r
+} // namespace CertSvc\r
+\r
+//____________________________________________________________________________//\r
--- /dev/null
+/*\r
+ * (C) Copyright Gennadiy Rozental 2005-2008.\r
+ * Distributed under the Boost Software License, Version 1.0.\r
+ * (See accompanying file LICENSE_1_0.txt or copy at\r
+ * http://www.boost.org/LICENSE_1_0.txt)\r
+ *\r
+ * See http://www.boost.org/libs/test for the library home page.\r
+ */\r
+\r
+#pragma once\r
+#include <boost/test/unit_test_log_formatter.hpp>\r
+\r
+namespace CertSvc {\r
+class colour_log_formatter : public boost::unit_test::unit_test_log_formatter {\r
+public:\r
+ // Formatter interface\r
+ colour_log_formatter() : m_isTestCaseFailed(false) {}\r
+ void log_start(\r
+ std::ostream &,\r
+ boost::unit_test::counter_t test_cases_amount);\r
+ void log_finish(std::ostream &);\r
+ void log_build_info(std::ostream &output, bool log_build_info = true);\r
+\r
+ void test_unit_start(\r
+ std::ostream &,\r
+ boost::unit_test::test_unit const &tu);\r
+ void test_unit_finish(\r
+ std::ostream &,\r
+ boost::unit_test::test_unit const &tu,\r
+ unsigned long elapsed);\r
+ void test_unit_skipped(\r
+ std::ostream &,\r
+ boost::unit_test::test_unit const &tu);\r
+\r
+ void log_exception(\r
+ std::ostream &,\r
+ boost::unit_test::log_checkpoint_data const &,\r
+ boost::execution_exception const &ex);\r
+\r
+ void log_entry_start(\r
+ std::ostream &,\r
+ boost::unit_test::log_entry_data const &,\r
+ log_entry_types let);\r
+ void log_entry_value(\r
+ std::ostream &,\r
+ boost::unit_test::const_string value);\r
+ void log_entry_value(\r
+ std::ostream &,\r
+ boost::unit_test::lazy_ostream const &value);\r
+ void log_entry_finish(std::ostream &);\r
+\r
+#if BOOST_VERSION >= 106501\r
+ void log_exception_start(\r
+ std::ostream& os,\r
+ boost::unit_test::log_checkpoint_data const& lcd,\r
+ boost::execution_exception const& ex);\r
+ void log_exception_finish(std::ostream& os);\r
+ void entry_context_start(\r
+ std::ostream& os,\r
+ boost::unit_test::log_level l);\r
+ void log_entry_context(\r
+ std::ostream& os,\r
+ boost::unit_test::log_level l,\r
+ boost::unit_test::const_string value);\r
+ void entry_context_finish(\r
+ std::ostream& os,\r
+ boost::unit_test::log_level l);\r
+#endif\r
+\r
+private:\r
+ bool m_isTestCaseFailed;\r
+};\r
+} // namespace CertSvc\r
--- /dev/null
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd 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.
+ */
+
+extern "C"{
+ #include "cert-svc/cerror.h"
+ #include "cert-server-db.h"
+}
+
+#include "test_macros.h"
+
+BOOST_AUTO_TEST_SUITE(CERT_SERVER_DB_TEST)
+
+POSITIVE_TEST_CASE(T_initialize_db){
+ int res;
+ res = initialize_db();
+ BOOST_CHECK_EQUAL(res, CERTSVC_SUCCESS);
+ res = initialize_db();
+ BOOST_CHECK_EQUAL(res, CERTSVC_SUCCESS);
+}
+
+POSITIVE_TEST_CASE(T_initialize_db_with_db_null){
+ deinitialize_db();
+ deinitialize_db();
+ int res = initialize_db();
+ BOOST_CHECK_EQUAL(res, CERTSVC_SUCCESS);
+}
+
+POSITIVE_TEST_CASE(T_get_schema_version){
+ initialize_db();
+ schema_version version;
+ int res = get_schema_version(&version);
+ BOOST_CHECK_EQUAL(res, CERTSVC_SUCCESS);
+ deinitialize_db();
+}
+
+NEGATIVE_TEST_CASE(T_set_schema_version_wrong_argument){
+ initialize_db();
+ schema_version version = TIZEN_2_4;
+ int res = set_schema_version(version);
+ BOOST_CHECK_EQUAL(res, CERTSVC_WRONG_ARGUMENT);
+ deinitialize_db();
+}
+
+NEGATIVE_TEST_CASE(T_set_schema_version_existed){
+ initialize_db();
+ schema_version version = TIZEN_3_0;
+ int res = set_schema_version(version);
+ BOOST_CHECK_EQUAL(res, CERTSVC_FAIL);
+ deinitialize_db();
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#pragma once\r
+\r
+#include <boost/test/unit_test.hpp>\r
+\r
+#define POSITIVE_TEST_CASE(name) BOOST_AUTO_TEST_CASE(POSITIVE_ ## name)\r
+#define NEGATIVE_TEST_CASE(name) BOOST_AUTO_TEST_CASE(NEGATIVE_ ## name)\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#define BOOST_TEST_MODULE CertSvcTests\r
+#include <boost/test/unit_test.hpp>\r
+#include <boost/test/unit_test_log.hpp>\r
+#include <boost/test/results_reporter.hpp>\r
+#include "colour_log_formatter.h"\r
+\r
+struct TestConfig {\r
+ TestConfig()\r
+ {\r
+ boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_test_units);\r
+ boost::unit_test::results_reporter::set_level(boost::unit_test::SHORT_REPORT);\r
+ boost::unit_test::unit_test_log.set_formatter(new CertSvc::colour_log_formatter);\r
+ }\r
+ ~TestConfig()\r
+ {\r
+ }\r
+};\r
+\r
+BOOST_GLOBAL_FIXTURE(TestConfig);\r
--- /dev/null
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd 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.
+ */
+
+#include "test_macros.h"
+#include "cert-svc/cinstance.h"
+#include "cert-svc/cstring.h"
+#include "cert-svc/ccert.h"
+#include "cert-svc/cpkcs12.h"
+#include "dpl/log/log.h"
+#include <cstring>
+
+static CertSvcInstance instance;
+
+BOOST_AUTO_TEST_SUITE(VCORE_API_TEST)
+
+POSITIVE_TEST_CASE(T_certsvc_instance_new){
+ int result;
+ result = certsvc_instance_new(&instance);
+ BOOST_CHECK_EQUAL(result, CERTSVC_SUCCESS);
+ certsvc_instance_free(instance);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd 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.
+ */
+
+#include "test_macros.h"
+#include "vcore/CertStoreType.h"
+
+using namespace ValidationCore::CertStoreId;
+using namespace std;
+
+string getTypeToString(Type certType){
+ Set typeSet;
+ typeSet.add(certType);
+ return typeSet.typeToString();
+}
+
+BOOST_AUTO_TEST_SUITE(CERT_STORE_TYPE_TEST)
+
+POSITIVE_TEST_CASE(T_get_type_to_string){
+ BOOST_CHECK(getTypeToString(TIZEN_DEVELOPER) == "TIZEN_DEVELOPER ");
+ BOOST_CHECK(getTypeToString(TIZEN_TEST) == "TIZEN_TEST ");
+ BOOST_CHECK(getTypeToString(TIZEN_VERIFY) == "TIZEN_VERIFY ");
+ BOOST_CHECK(getTypeToString(TIZEN_STORE) == "TIZEN_STORE ");
+ BOOST_CHECK(getTypeToString(TIZEN_REVOKED) == "TIZEN_REVOKED ");
+ BOOST_CHECK(getTypeToString(VIS_PUBLIC) == "VIS_PUBLIC ");
+ BOOST_CHECK(getTypeToString(VIS_PLATFORM) == "VIS_PLATFORM ");
+ BOOST_CHECK(getTypeToString(VIS_PARTNER) == "VIS_PARTNER ");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file