• 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 "executor/memory/get_heap_info.h"
17 #include <gtest/gtest.h>
18 #include <unistd.h>
19 
20 using namespace testing::ext;
21 namespace OHOS {
22 namespace HiviewDFX {
23 class GetHeapInfoTest : public testing::Test {
24 public:
25     using ValueMap = std::map<std::string, uint64_t>;
26     using GroupMap = std::map<std::string, ValueMap>;
27     static void SetUpTestCase(void);
28     static void TearDownTestCase(void);
29     void SetUp();
30     void TearDown();
31 };
32 
SetUpTestCase(void)33 void GetHeapInfoTest::SetUpTestCase(void)
34 {
35 }
TearDownTestCase(void)36 void GetHeapInfoTest::TearDownTestCase(void)
37 {
38 }
SetUp(void)39 void GetHeapInfoTest::SetUp(void)
40 {
41 }
TearDown(void)42 void GetHeapInfoTest::TearDown(void)
43 {
44 }
45 
46 /**
47  * @tc.name: GetHeapInfo001
48  * @tc.desc: Test appManager is nullptr .
49  * @tc.type: FUNC
50  */
51 HWTEST_F(GetHeapInfoTest, GetHeapInfo001, TestSize.Level1)
52 {
53     std::unique_ptr<MallHeapInfo> mallocHeapInfo = std::make_unique<MallHeapInfo>();
54     std::unique_ptr<GetHeapInfo> getHeapInfo = std::make_unique<GetHeapInfo>();
55     getHeapInfo->GetMallocHeapInfo(1, mallocHeapInfo);
56     ASSERT_TRUE(mallocHeapInfo != nullptr);
57 }
58 } // namespace HiviewDFX
59 } // namespace OHOS
60