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 #include <memory> 16 #include <gtest/gtest.h> 17 #include "sign_head.h" 18 19 namespace OHOS { 20 namespace SignatureTools { 21 22 /* 23 * 测试套件,固定写法 24 */ 25 class SignHeadTest : public testing::Test { 26 public: SetUpTestCase(void)27 static void SetUpTestCase(void) 28 { 29 }; TearDownTestCase()30 static void TearDownTestCase() 31 { 32 }; SetUp()33 void SetUp() 34 { 35 }; TearDown()36 void TearDown() 37 { 38 }; 39 }; 40 41 /** 42 * @tc.name: GetSignHead 43 * @tc.desc: Test get sign head for SUCCESS. 44 * @tc.size: MEDIUM 45 * @tc.type: FUNC 46 * @tc.level Level 1 47 * @tc.require: SR000H63TL 48 */ 49 HWTEST_F(SignHeadTest, GetSignHead, testing::ext::TestSize.Level1) 50 { 51 std::shared_ptr<SignHead> api = std::make_shared<SignHead>(); 52 std::vector<int8_t> signHead = api->GetSignHead(5254); 53 EXPECT_EQ(signHead.size(), 32); 54 } 55 56 /** 57 * @tc.name: getSignHeadLittleEndian 58 * @tc.desc: Test get sign head by little endian for SUCCESS. 59 * @tc.size: MEDIUM 60 * @tc.type: FUNC 61 * @tc.level Level 1 62 * @tc.require: SR000H63TL 63 */ 64 HWTEST_F(SignHeadTest, getSignHeadLittleEndian, testing::ext::TestSize.Level1) 65 { 66 std::shared_ptr<SignHead> api = std::make_shared<SignHead>(); 67 std::vector<int8_t> signHeadLittleEndian = api->GetSignHeadLittleEndian(1024, 1); 68 EXPECT_EQ(signHeadLittleEndian.size(), 32); 69 } 70 } // namespace SignatureTools 71 } // namespace OHOS