2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <gtest/gtest.h>
19 #include <request_type.hh>
25 namespace pc = pkgmgr_common;
27 class RequestTypeTest : public ::testing::Test {
29 virtual void SetUp() {}
31 virtual void TearDown() {}
34 TEST_F(RequestTypeTest, GetAppInfoTypeTest) {
35 pc::ReqType type = pc::ReqType::GET_APP_INFO;
36 EXPECT_EQ(strcmp(ReqTypeToString(type), "GET_APP_INFO"), 0);
39 TEST_F(RequestTypeTest, GetPkgInfoTypeTest) {
40 pc::ReqType type = pc::ReqType::GET_PKG_INFO;
41 EXPECT_EQ(strcmp(ReqTypeToString(type), "GET_PKG_INFO"), 0);
44 TEST_F(RequestTypeTest, SetPkgInfoTypeTest) {
45 pc::ReqType type = pc::ReqType::SET_PKG_INFO;
46 EXPECT_EQ(strcmp(ReqTypeToString(type), "SET_PKG_INFO"), 0);
49 TEST_F(RequestTypeTest, SetCertInfoTypeTest) {
50 pc::ReqType type = pc::ReqType::SET_CERT_INFO;
51 EXPECT_EQ(strcmp(ReqTypeToString(type), "SET_CERT_INFO"), 0);
54 TEST_F(RequestTypeTest, GetCertInfoTypeTest) {
55 pc::ReqType type = pc::ReqType::GET_CERT_INFO;
56 EXPECT_EQ(strcmp(ReqTypeToString(type), "GET_CERT_INFO"), 0);
59 TEST_F(RequestTypeTest, GetPkgDepInfoTypeTest) {
60 pc::ReqType type = pc::ReqType::GET_PKG_DEP_INFO;
61 EXPECT_EQ(strcmp(ReqTypeToString(type), "GET_PKG_DEP_INFO"), 0);
64 TEST_F(RequestTypeTest, GetQueryTypeTest) {
65 pc::ReqType type = pc::ReqType::READ_QUERY;
66 EXPECT_EQ(strcmp(ReqTypeToString(type), "READ_QUERY"), 0);
69 TEST_F(RequestTypeTest, SetQueryTypeTest) {
70 pc::ReqType type = pc::ReqType::WRITE_QUERY;
71 EXPECT_EQ(strcmp(ReqTypeToString(type), "WRITE_QUERY"), 0);
74 TEST_F(RequestTypeTest, CommandTypeTest) {
75 pc::ReqType type = pc::ReqType::COMMAND;
76 EXPECT_EQ(strcmp(ReqTypeToString(type), "COMMAND"), 0);
79 TEST_F(RequestTypeTest, NoneTypeTest) {
80 pc::ReqType type = pc::ReqType::REQ_TYPE_NONE;
81 EXPECT_EQ(strcmp(ReqTypeToString(type), "ERROR_REQ_TYPE"), 0);
84 TEST_F(RequestTypeTest, MaxTypeTest) {
85 pc::ReqType type = pc::ReqType::MAX;
86 EXPECT_EQ(strcmp(ReqTypeToString(type), "ERROR_REQ_TYPE"), 0);