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 <gtest/gtest.h>
18 #include <fs_verity_digest.h>
19 
20 namespace OHOS {
21 namespace SignatureTools {
22 
23 class FsVerityDigestTest : public testing::Test {
24 public:
SetUpTestCase(void)25     static void SetUpTestCase(void) {};
TearDownTestCase()26     static void TearDownTestCase() {};
SetUp()27     void SetUp() {};
TearDown()28     void TearDown() {};
29 };
30 
31 /**
32  * @tc.name: GetFsVerityDigest
33  * @tc.desc: Test function of FsVerityDigest::GetFsVerityDigest() interface for SUCCESS.
34  * @tc.size: MEDIUM
35  * @tc.type: FUNC
36  * @tc.level Level 1
37  * @tc.require: SR000H63TL
38  */
HWTEST_F(FsVerityDigestTest, GetFsVerityDigest, testing::ext::TestSize.Level1)39 HWTEST_F(FsVerityDigestTest, GetFsVerityDigest, testing::ext::TestSize.Level1)
40 {
41     std::vector<int8_t> digest = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
42 
43     std::vector<int8_t> fsVerityDigest;
44     FsVerityDigest::GetFsVerityDigest(1, digest, fsVerityDigest);
45 
46     EXPECT_EQ(digest.size(), 16);
47 }
48 } // namespace SignatureTools
49 } // namespace OHOS