• 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 #include <gtest/gtest.h>
16 #include "DDR.h"
17 #include "sp_utils.h"
18 #include "common.h"
19 
20 using namespace testing::ext;
21 using namespace std;
22 
23 namespace OHOS {
24 namespace SmartPerf {
25 class DDRTest : public testing::Test {
26 public:
SetUpTestCase()27     static void SetUpTestCase() {}
TearDownTestCase()28     static void TearDownTestCase() {}
29 
SetUp()30     void SetUp() {}
TearDown()31     void TearDown() {}
32 };
33 
34 HWTEST_F(DDRTest, ItemDataTest, TestSize.Level1)
35 {
36     bool ret = false;
37     DDR &ddr = DDR::GetInstance();
38     std::map<std::string, std::string> result = DDR::GetInstance().ItemData();
39     result["ddrFrequency"] = std::to_string(ddr.GetDdrFreq());
40     if (result.find("ddrFrequency") != result.end() && result["ddrFrequency"].empty()) {
41         result["ddrFrequency"] = "NA";
42     }
43     if (!result.empty()) {
44         ret = true;
45     }
46 
47     EXPECT_TRUE(ret);
48 }
49 }
50 }