• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-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 
16 #include <memory>
17 #include <fstream>
18 #include <gtest/gtest.h>
19 
20 #include "sign_block_info.h"
21 
22 namespace OHOS {
23 namespace SignatureTools {
24 
25 class SignBlockInfoTest : public testing::Test {
26 public:
SetUpTestCase(void)27     static void SetUpTestCase(void) {};
TearDownTestCase()28     static void TearDownTestCase() {};
SetUp()29     void SetUp() {};
TearDown()30     void TearDown() {};
31 };
32 
33 /**
34  * @tc.name: GetSignBlockMap
35  * @tc.desc: Test function of SignBlockInfoTest::GetSignBlockMap() interface for SUCCESS.
36  * @tc.size: MEDIUM
37  * @tc.type: FUNC
38  * @tc.level Level 1
39  * @tc.require: SR000H63TL
40  */
41 HWTEST_F(SignBlockInfoTest, GetSignBlockMap, testing::ext::TestSize.Level1)
42 {
43     SignBlockInfo signBlockInfo(false);
44     std::unordered_map<int8_t, SigningBlock> signBlockMap = signBlockInfo.GetSignBlockMap();
45     int size = signBlockMap.size();
46 
47     EXPECT_EQ(size, 0);
48 }
49 
50 /**
51  * @tc.name: GetFileDigest
52  * @tc.desc: Test function of SignBlockInfoTest::GetFileDigest() interface for SUCCESS.
53  * @tc.size: MEDIUM
54  * @tc.type: FUNC
55  * @tc.level Level 1
56  * @tc.require: SR000H63TL
57  */
58 HWTEST_F(SignBlockInfoTest, GetFileDigest, testing::ext::TestSize.Level1)
59 {
60     SignBlockInfo signBlockInfo(true);
61     std::vector<int8_t> fileDigest = signBlockInfo.GetFileDigest();
62     int size = fileDigest.size();
63 
64     EXPECT_EQ(size, 0);
65 }
66 
67 /**
68  * @tc.name: SetFileDigest
69  * @tc.desc: Test function of SignBlockInfoTest::SetFileDigest() interface for SUCCESS.
70  * @tc.size: MEDIUM
71  * @tc.type: FUNC
72  * @tc.level Level 1
73  * @tc.require: SR000H63TL
74  */
75 HWTEST_F(SignBlockInfoTest, SetFileDigest, testing::ext::TestSize.Level1)
76 {
77     SignBlockInfo signBlockInfo(true);
78     std::vector<int8_t> fileDigest;
79     signBlockInfo.SetFileDigest(fileDigest);
80     int size = fileDigest.size();
81 
82     EXPECT_EQ(size, 0);
83 }
84 
85 /**
86  * @tc.name: GetRawDigest
87  * @tc.desc: Test function of SignBlockInfoTest::GetRawDigest() interface for SUCCESS.
88  * @tc.size: MEDIUM
89  * @tc.type: FUNC
90  * @tc.level Level 1
91  * @tc.require: SR000H63TL
92  */
93 HWTEST_F(SignBlockInfoTest, GetRawDigest, testing::ext::TestSize.Level1)
94 {
95     SignBlockInfo signBlockInfo(true);
96     std::vector<int8_t> digest = signBlockInfo.GetRawDigest();
97     int size = digest.size();
98 
99     EXPECT_EQ(size, 0);
100 }
101 
102 /**
103  * @tc.name: SetRawDigest
104  * @tc.desc: Test function of SignBlockInfoTest::SetRawDigest() interface for SUCCESS.
105  * @tc.size: MEDIUM
106  * @tc.type: FUNC
107  * @tc.level Level 1
108  * @tc.require: SR000H63TL
109  */
110 HWTEST_F(SignBlockInfoTest, SetRawDigest, testing::ext::TestSize.Level1)
111 {
112     SignBlockInfo signBlockInfo(true);
113     std::vector<int8_t> digest;
114     signBlockInfo.SetRawDigest(digest);
115     int size = digest.size();
116 
117     EXPECT_EQ(size, 0);
118 }
119 
120 /**
121  * @tc.name: GetNeedGenerateDigest
122  * @tc.desc: Test function of SignBlockInfoTest::GetNeedGenerateDigest() interface for SUCCESS.
123  * @tc.size: MEDIUM
124  * @tc.type: FUNC
125  * @tc.level Level 1
126  * @tc.require: SR000H63TL
127  */
128 HWTEST_F(SignBlockInfoTest, GetNeedGenerateDigest, testing::ext::TestSize.Level1)
129 {
130     SignBlockInfo signBlockInfo(true);
131     bool needGenerateDigest = signBlockInfo.GetNeedGenerateDigest();
132 
133     EXPECT_EQ(needGenerateDigest, true);
134 }
135 } // namespace SignatureTools
136 } // namespace OHOS