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 "signing_block.h"
21 
22 namespace OHOS {
23 namespace SignatureTools {
24 
25 class SigningBlockTest : 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: GetLength
35  * @tc.desc: Test function of SigningBlockTest::GetLength() interface for SUCCESS.
36  * @tc.size: MEDIUM
37  * @tc.type: FUNC
38  * @tc.level Level 1
39  * @tc.require: SR000H63TL
40  */
HWTEST_F(SigningBlockTest, GetLength, testing::ext::TestSize.Level1)41 HWTEST_F(SigningBlockTest, GetLength, testing::ext::TestSize.Level1)
42 {
43     std::vector<int8_t> value;
44     SigningBlock signingBlock(0, value, 0);
45     int32_t length = signingBlock.GetLength();
46 
47     EXPECT_EQ(length, 0);
48 }
49 
50 /**
51  * @tc.name: GetValue
52  * @tc.desc: Test function of SigningBlockTest::GetValue() interface for SUCCESS.
53  * @tc.size: MEDIUM
54  * @tc.type: FUNC
55  * @tc.level Level 1
56  * @tc.require: SR000H63TL
57  */
HWTEST_F(SigningBlockTest, GetValue, testing::ext::TestSize.Level1)58 HWTEST_F(SigningBlockTest, GetValue, testing::ext::TestSize.Level1)
59 {
60     std::vector<int8_t> value;
61     SigningBlock signingBlock(0, value, 0);
62     std::vector<int8_t> val = signingBlock.GetValue();
63     int size = val.size();
64 
65     EXPECT_EQ(size, 0);
66 }
67 
68 /**
69  * @tc.name: GetOffset
70  * @tc.desc: Test function of SigningBlockTest::GetOffset() interface for SUCCESS.
71  * @tc.size: MEDIUM
72  * @tc.type: FUNC
73  * @tc.level Level 1
74  * @tc.require: SR000H63TL
75  */
HWTEST_F(SigningBlockTest, GetOffset, testing::ext::TestSize.Level1)76 HWTEST_F(SigningBlockTest, GetOffset, testing::ext::TestSize.Level1)
77 {
78     std::vector<int8_t> value;
79     SigningBlock signingBlock(0, value, 0);
80     int32_t offset = signingBlock.GetOffset();
81 
82     EXPECT_EQ(offset, 0);
83 }
84 } // namespace SignatureTools
85 } // namespace OHOS