1 /*
2 * Copyright (c) 2024 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 #include <gtest/gtest.h>
16 #include <string>
17 #include "trust_device_profile.h"
18 #include "distributed_device_profile_constants.h"
19 #include "macro_utils.h"
20 #include "profile_utils.h"
21
22 using namespace testing::ext;
23 namespace OHOS {
24 namespace DistributedDeviceProfile {
25 using namespace std;
26 namespace {
27 const std::string TAG = "TrustDeviceProfileTest";
28 }
29 class TrustDeviceProfileTest : public testing::Test {
30 public:
31 static void SetUpTestCase();
32 static void TearDownTestCase();
33 void SetUp();
34 void TearDown();
35 };
36
SetUpTestCase()37 void TrustDeviceProfileTest::SetUpTestCase()
38 {
39 }
40
TearDownTestCase()41 void TrustDeviceProfileTest::TearDownTestCase()
42 {
43 }
44
SetUp()45 void TrustDeviceProfileTest::SetUp()
46 {
47 }
48
TearDown()49 void TrustDeviceProfileTest::TearDown()
50 {
51 }
52
53 /*
54 * @tc.name: SetDeviceId001
55 * @tc.desc: SetDeviceId
56 * @tc.type: FUNC
57 * @tc.require:
58 */
59 HWTEST_F(TrustDeviceProfileTest, GetDeviceId001, TestSize.Level1)
60 {
61 std::string deviceId = "deviceId";
62 TrustDeviceProfile trustDeviceProfile;
63 trustDeviceProfile.SetDeviceId(deviceId);
64 std::string ret = trustDeviceProfile.GetDeviceId();
65 EXPECT_EQ(deviceId, ret);
66 }
67
68 /*
69 * @tc.name: GetDeviceIdType002
70 * @tc.desc: GetDeviceIdType
71 * @tc.type: FUNC
72 * @tc.require:
73 */
74 HWTEST_F(TrustDeviceProfileTest, GetDeviceIdType001, TestSize.Level1)
75 {
76 int32_t deviceType = 1;
77 TrustDeviceProfile trustDeviceProfile;
78 trustDeviceProfile.SetDeviceIdType(deviceType);
79 int32_t ret = trustDeviceProfile.GetDeviceIdType();
80 EXPECT_EQ(deviceType, ret);
81 }
82
83 /*
84 * @tc.name: GetDeviceIdHash001
85 * @tc.desc: GetDeviceIdHash
86 * @tc.type: FUNC
87 * @tc.require:
88 */
89 HWTEST_F(TrustDeviceProfileTest, GetDeviceIdHash001, TestSize.Level1)
90 {
91 std::string deviceIdHash = "deviceIdHash";
92 TrustDeviceProfile trustDeviceProfile;
93 trustDeviceProfile.SetDeviceIdHash(deviceIdHash);
94 std::string ret = trustDeviceProfile.GetDeviceIdHash();
95 EXPECT_EQ(deviceIdHash, ret);
96 }
97
98 /*
99 * @tc.name: GetStatus001
100 * @tc.desc: GetStatus
101 * @tc.type: FUNC
102 * @tc.require:
103 */
104 HWTEST_F(TrustDeviceProfileTest, GetStatus001, TestSize.Level1)
105 {
106 int32_t status = 1;
107 TrustDeviceProfile trustDeviceProfile;
108 trustDeviceProfile.SetStatus(status);
109 int32_t ret = trustDeviceProfile.GetStatus();
110 EXPECT_EQ(status, ret);
111 }
112
113 /*
114 * @tc.name: GetStatus001
115 * @tc.desc: GetStatus
116 * @tc.type: FUNC
117 * @tc.require:
118 */
119 HWTEST_F(TrustDeviceProfileTest, GetBindType001, TestSize.Level1)
120 {
121 uint32_t bindType = 1;
122 TrustDeviceProfile trustDeviceProfile;
123 trustDeviceProfile.SetBindType(bindType);
124 uint32_t ret = trustDeviceProfile.GetBindType();
125 EXPECT_EQ(bindType, ret);
126 }
127 }
128 }
129