154aa6d63Sopenharmony_ci/* 254aa6d63Sopenharmony_ci * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 354aa6d63Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 454aa6d63Sopenharmony_ci * you may not use this file except in compliance with the License. 554aa6d63Sopenharmony_ci * You may obtain a copy of the License at 654aa6d63Sopenharmony_ci * 754aa6d63Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 854aa6d63Sopenharmony_ci * 954aa6d63Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1054aa6d63Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1154aa6d63Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1254aa6d63Sopenharmony_ci * See the License for the specific language governing permissions and 1354aa6d63Sopenharmony_ci * limitations under the License. 1454aa6d63Sopenharmony_ci */ 1554aa6d63Sopenharmony_ci 1654aa6d63Sopenharmony_ci#include <memory> 1754aa6d63Sopenharmony_ci#include <fstream> 1854aa6d63Sopenharmony_ci#include <gtest/gtest.h> 1954aa6d63Sopenharmony_ci 2054aa6d63Sopenharmony_ci#include "signing_block.h" 2154aa6d63Sopenharmony_ci 2254aa6d63Sopenharmony_cinamespace OHOS { 2354aa6d63Sopenharmony_cinamespace SignatureTools { 2454aa6d63Sopenharmony_ci 2554aa6d63Sopenharmony_ciclass SigningBlockTest : public testing::Test { 2654aa6d63Sopenharmony_cipublic: 2754aa6d63Sopenharmony_ci static void SetUpTestCase(void) {}; 2854aa6d63Sopenharmony_ci static void TearDownTestCase() {}; 2954aa6d63Sopenharmony_ci void SetUp() {}; 3054aa6d63Sopenharmony_ci void TearDown() {}; 3154aa6d63Sopenharmony_ci}; 3254aa6d63Sopenharmony_ci 3354aa6d63Sopenharmony_ci/** 3454aa6d63Sopenharmony_ci * @tc.name: GetLength 3554aa6d63Sopenharmony_ci * @tc.desc: Test function of SigningBlockTest::GetLength() interface for SUCCESS. 3654aa6d63Sopenharmony_ci * @tc.size: MEDIUM 3754aa6d63Sopenharmony_ci * @tc.type: FUNC 3854aa6d63Sopenharmony_ci * @tc.level Level 1 3954aa6d63Sopenharmony_ci * @tc.require: SR000H63TL 4054aa6d63Sopenharmony_ci */ 4154aa6d63Sopenharmony_ciHWTEST_F(SigningBlockTest, GetLength, testing::ext::TestSize.Level1) 4254aa6d63Sopenharmony_ci{ 4354aa6d63Sopenharmony_ci std::vector<int8_t> value; 4454aa6d63Sopenharmony_ci SigningBlock signingBlock(0, value, 0); 4554aa6d63Sopenharmony_ci int32_t length = signingBlock.GetLength(); 4654aa6d63Sopenharmony_ci 4754aa6d63Sopenharmony_ci EXPECT_EQ(length, 0); 4854aa6d63Sopenharmony_ci} 4954aa6d63Sopenharmony_ci 5054aa6d63Sopenharmony_ci/** 5154aa6d63Sopenharmony_ci * @tc.name: GetValue 5254aa6d63Sopenharmony_ci * @tc.desc: Test function of SigningBlockTest::GetValue() interface for SUCCESS. 5354aa6d63Sopenharmony_ci * @tc.size: MEDIUM 5454aa6d63Sopenharmony_ci * @tc.type: FUNC 5554aa6d63Sopenharmony_ci * @tc.level Level 1 5654aa6d63Sopenharmony_ci * @tc.require: SR000H63TL 5754aa6d63Sopenharmony_ci */ 5854aa6d63Sopenharmony_ciHWTEST_F(SigningBlockTest, GetValue, testing::ext::TestSize.Level1) 5954aa6d63Sopenharmony_ci{ 6054aa6d63Sopenharmony_ci std::vector<int8_t> value; 6154aa6d63Sopenharmony_ci SigningBlock signingBlock(0, value, 0); 6254aa6d63Sopenharmony_ci std::vector<int8_t> val = signingBlock.GetValue(); 6354aa6d63Sopenharmony_ci int size = val.size(); 6454aa6d63Sopenharmony_ci 6554aa6d63Sopenharmony_ci EXPECT_EQ(size, 0); 6654aa6d63Sopenharmony_ci} 6754aa6d63Sopenharmony_ci 6854aa6d63Sopenharmony_ci/** 6954aa6d63Sopenharmony_ci * @tc.name: GetOffset 7054aa6d63Sopenharmony_ci * @tc.desc: Test function of SigningBlockTest::GetOffset() interface for SUCCESS. 7154aa6d63Sopenharmony_ci * @tc.size: MEDIUM 7254aa6d63Sopenharmony_ci * @tc.type: FUNC 7354aa6d63Sopenharmony_ci * @tc.level Level 1 7454aa6d63Sopenharmony_ci * @tc.require: SR000H63TL 7554aa6d63Sopenharmony_ci */ 7654aa6d63Sopenharmony_ciHWTEST_F(SigningBlockTest, GetOffset, testing::ext::TestSize.Level1) 7754aa6d63Sopenharmony_ci{ 7854aa6d63Sopenharmony_ci std::vector<int8_t> value; 7954aa6d63Sopenharmony_ci SigningBlock signingBlock(0, value, 0); 8054aa6d63Sopenharmony_ci int32_t offset = signingBlock.GetOffset(); 8154aa6d63Sopenharmony_ci 8254aa6d63Sopenharmony_ci EXPECT_EQ(offset, 0); 8354aa6d63Sopenharmony_ci} 8454aa6d63Sopenharmony_ci} // namespace SignatureTools 8554aa6d63Sopenharmony_ci} // namespace OHOS