${CMAKE_CURRENT_SOURCE_DIR}/test_base64.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_binary-queue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_certificate.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_client-common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_comm-manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_crypto-logic.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_data-type.cpp
--- /dev/null
+/*
+ * Copyright (c) 2021 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 <boost_macros_wrapper.h>
+#include <string>
+#include "client-common.h"
+
+namespace {
+const std::string OWNER_ID = "some_id";
+const std::string NAME = "some_name";
+
+const std::string EMPTY_OWNER_ID = "";
+}
+
+BOOST_AUTO_TEST_SUITE(CLIENT_COMMON)
+
+POSITIVE_TEST_CASE(AliasTest) {
+ const auto alias = CKM::AliasSupport::merge(OWNER_ID, NAME);
+ const auto alias_support = CKM::AliasSupport(alias);
+
+ BOOST_REQUIRE(!alias_support.isOwnerEmpty());
+ BOOST_REQUIRE(alias_support.getName() == NAME);
+ BOOST_REQUIRE(alias_support.getOwner() == OWNER_ID);
+
+ const auto empty_owner_alias = CKM::AliasSupport::merge(EMPTY_OWNER_ID, NAME);
+ const auto empty_owner_alias_support = CKM::AliasSupport(empty_owner_alias);
+
+ BOOST_REQUIRE(empty_owner_alias_support.isOwnerEmpty());
+ BOOST_REQUIRE(empty_owner_alias_support.getName() == NAME);
+ BOOST_REQUIRE(empty_owner_alias_support.getOwner() == EMPTY_OWNER_ID);
+}
+
+NEGATIVE_TEST_CASE(AliasTest) {
+ const auto empty_alias = CKM::AliasSupport::merge("", "");
+ const auto empty_alias_support = CKM::AliasSupport(empty_alias);
+ BOOST_REQUIRE(empty_alias_support.isOwnerEmpty());
+ BOOST_REQUIRE(empty_alias_support.getName() == "");
+ BOOST_REQUIRE(empty_alias_support.getOwner() == "");
+}
+
+BOOST_AUTO_TEST_SUITE_END()