• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "asset_mem_wrapper_test.h"
17 
18 #include <cstring>
19 #include <gtest/gtest.h>
20 
21 #include "asset_mem.h"
22 
23 using namespace testing::ext;
24 namespace UnitTest::AssetMemWrapperTest {
25 class AssetMemWrapperTest : public testing::Test {
26 public:
27     static void SetUpTestCase(void);
28 
29     static void TearDownTestCase(void);
30 
31     void SetUp(void);
32 
33     void TearDown(void);
34 };
35 
SetUpTestCase(void)36 void AssetMemWrapperTest::SetUpTestCase(void)
37 {
38 }
39 
TearDownTestCase(void)40 void AssetMemWrapperTest::TearDownTestCase(void)
41 {
42 }
43 
SetUp(void)44 void AssetMemWrapperTest::SetUp(void)
45 {
46 }
47 
TearDown(void)48 void AssetMemWrapperTest::TearDown(void)
49 {
50 }
51 
52 /**
53  * @tc.name: AssetMemWrapperTest.AssetMemWrapperTest001
54  * @tc.desc: Test asset func AssetFree, AssetMalloc, expect nullptr
55  * @tc.type: FUNC
56  * @tc.result:0
57  */
58 HWTEST_F(AssetMemWrapperTest, AssetMemWrapperTest001, TestSize.Level0)
59 {
60     AssetFree(nullptr);
61     ASSERT_EQ(nullptr, AssetMalloc(0));
62 }
63 
64 /**
65  * @tc.name: AssetMemWrapperTest.AssetMemWrapperTest002
66  * @tc.desc: Test asset func AssetMemCmp, expect 0
67  * @tc.type: FUNC
68  * @tc.result:0
69  */
70 HWTEST_F(AssetMemWrapperTest, AssetMemWrapperTest002, TestSize.Level0)
71 {
72     const uint32_t size = 5;
73     uint8_t array1[size] = {1, 2, 3, 4, 5};
74     uint8_t array2[size] = {1, 2, 3, 4, 5};
75     ASSERT_EQ(0, AssetMemCmp(array1, array2, size));
76 }
77 }
78