Add some gtests
authorInkyun Kil <inkyun.kil@samsung.com>
Mon, 22 Feb 2021 06:53:12 +0000 (15:53 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Mon, 22 Feb 2021 06:56:23 +0000 (15:56 +0900)
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/rpk_manifest_handlers/required_privileges_handler.h
test/unit_tests/test_rpk_app_query_interface.cc
test/unit_tests/test_rpk_archive_info.cc [new file with mode: 0644]
test/unit_tests/test_rpk_registration.cc

index a8dce88fdc31b969e193862c69f0bd54934f9179..e0acc1adcb430dcaba0ce205bb5325df7a29e7af 100755 (executable)
@@ -14,7 +14,6 @@
 #include "manifest_parser/manifest_handler.h"
 #include "manifest_parser/permission_types.h"
 #include "manifest_parser/values.h"
-#include "tpk_manifest_handlers/appdefined_privilege_handler.h"
 
 namespace rpk {
 namespace parse {
index 2c707207a8d8a6cb5bcf4e769b8f39daaa82bee3..f5413c8b0815c66b583572020dd145c84a023eec 100644 (file)
@@ -31,7 +31,7 @@ class RpkAppQueryInterfaceTest : public ::testing::Test {
   }
 };
 
-TEST_F(RpkAppQueryInterfaceTest, DummyTest) {
+TEST_F(RpkAppQueryInterfaceTest, GetPkgIdFromPathTest) {
   std::unique_ptr<common_installer::AppQueryInterface> ptr =
       std::make_unique<rpk::RpkAppQueryInterface>();
   EXPECT_EQ(ptr->GetPkgId(""), "");
diff --git a/test/unit_tests/test_rpk_archive_info.cc b/test/unit_tests/test_rpk_archive_info.cc
new file mode 100644 (file)
index 0000000..ffff265
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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 <gtest/gtest.h>
+
+#include "lib/rpk_archive_info.h"
+
+class RpkArchiveInfoTest : public ::testing::Test {
+ public:
+  virtual void SetUp() {
+  }
+
+  virtual void TearDown() {
+  }
+};
+
+TEST_F(RpkArchiveInfoTest, LoadArchiveInfo) {
+  std::unique_ptr<RpkArchiveInfo> ptr = std::make_unique<RpkArchiveInfo>("");
+  EXPECT_EQ(ptr->LoadArchiveInfo(), true);
+}
index be47bad61a8805c24dc4c07544e81f233b29ceae..fe971a2d18cec97892b4de5ad4a27cbbd95ea452 100644 (file)
@@ -27,6 +27,14 @@ class RpkRegistrationTest : public ::testing::Test {
   }
 };
 
-TEST_F(RpkRegistrationTest, DummyTest) {
+TEST_F(RpkRegistrationTest, RegisterRpkInfo) {
+  EXPECT_EQ(rpk::RegisterRpkInfo(nullptr, 0), true);
+}
+
+TEST_F(RpkRegistrationTest, UpdateRpkInfo) {
+  EXPECT_EQ(rpk::UpdateRpkInfo(nullptr, 0), true);
+}
+
+TEST_F(RpkRegistrationTest, UnregisterRpkInfo) {
   EXPECT_EQ(rpk::RegisterRpkInfo(nullptr, 0), true);
 }