• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include "service_characteristic_profile.h"
19 #include "utils.h"
20 
21 namespace OHOS {
22 namespace DeviceProfile {
23 using namespace testing;
24 using namespace testing::ext;
25 
26 class ServiceProfileTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
29     static void TearDownTestCase();
30     void SetUp();
31     void TearDown();
32 };
33 
SetUpTestCase()34 void ServiceProfileTest::SetUpTestCase()
35 {
36     DTEST_LOG << "SetUpTestCase" << std::endl;
37 }
38 
TearDownTestCase()39 void ServiceProfileTest::TearDownTestCase()
40 {
41     DTEST_LOG << "TearDownTestCase" << std::endl;
42 }
43 
SetUp()44 void ServiceProfileTest::SetUp()
45 {
46     DTEST_LOG << "SetUp" << std::endl;
47 }
48 
TearDown()49 void ServiceProfileTest::TearDown()
50 {
51     DTEST_LOG << "TearDown" << std::endl;
52 }
53 
54 /**
55  * @tc.name: SetServiceProfileJson_001
56  * @tc.desc: set service profile json
57  * @tc.type: FUNC
58  * @tc.require: I4OH94
59  */
60 HWTEST_F(ServiceProfileTest, SetServiceProfileJson_001, TestSize.Level3)
61 {
62     std::string profileJson;
63     ServiceCharacteristicProfile profile;
64     profile.SetServiceProfileJson(profileJson);
65     EXPECT_EQ("", profileJson);
66 }
67 
68 /**
69  * @tc.name: GetServiceProfileJson_001
70  * @tc.desc: get service profile json
71  * @tc.type: FUNC
72  * @tc.require: I4OH94
73  */
74 HWTEST_F(ServiceProfileTest, GetServiceProfileJson_001, TestSize.Level3)
75 {
76     std::string profileJson = "";
77     ServiceCharacteristicProfile profile;
78     std::string result = profile.GetServiceProfileJson();
79     EXPECT_EQ(profileJson, result);
80 }
81 
82 /**
83  * @tc.name: Marshalling_001
84  * @tc.desc: marshalling
85  * @tc.type: FUNC
86  * @tc.require: I4OH94
87  */
88 HWTEST_F(ServiceProfileTest, Marshalling_001, TestSize.Level3)
89 {
90     Parcel parcel;
91     ServiceCharacteristicProfile profile;
92     bool result = profile.Marshalling(parcel);
93     EXPECT_EQ(true, result);
94 }
95 
96 /**
97  * @tc.name: Unmarshalling_001
98  * @tc.desc: unmarshalling
99  * @tc.type: FUNC
100  * @tc.require: I4OH94
101  */
102 HWTEST_F(ServiceProfileTest, Unmarshalling_001, TestSize.Level3)
103 {
104     Parcel parcel;
105     ServiceCharacteristicProfile profile;
106     bool result = profile.Unmarshalling(parcel);
107     EXPECT_NE(true, result);
108 }
109 }
110 }