148f512ceSopenharmony_ci/* 248f512ceSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 348f512ceSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 448f512ceSopenharmony_ci * you may not use this file except in compliance with the License. 548f512ceSopenharmony_ci * You may obtain a copy of the License at 648f512ceSopenharmony_ci * 748f512ceSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 848f512ceSopenharmony_ci * 948f512ceSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1048f512ceSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1148f512ceSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1248f512ceSopenharmony_ci * See the License for the specific language governing permissions and 1348f512ceSopenharmony_ci * limitations under the License. 1448f512ceSopenharmony_ci */ 1548f512ceSopenharmony_ci 1648f512ceSopenharmony_ci#ifndef REPORT_TEST 1748f512ceSopenharmony_ci#define REPORT_TEST 1848f512ceSopenharmony_ci 1948f512ceSopenharmony_ci#include <gtest/gtest.h> 2048f512ceSopenharmony_ci#include <hilog/log.h> 2148f512ceSopenharmony_ci 2248f512ceSopenharmony_ci#include "debug_logger.h" 2348f512ceSopenharmony_ci#include "report.h" 2448f512ceSopenharmony_ci#include "utilities.h" 2548f512ceSopenharmony_ci 2648f512ceSopenharmony_cinamespace OHOS { 2748f512ceSopenharmony_cinamespace Developtools { 2848f512ceSopenharmony_cinamespace HiPerf { 2948f512ceSopenharmony_citemplate<class T> 3048f512ceSopenharmony_civoid CompareNumberTest(T &lowValue, T &midValue, T &highValue, 3148f512ceSopenharmony_ci ReportKeyCompareFunction &compareFunction) 3248f512ceSopenharmony_ci{ 3348f512ceSopenharmony_ci EXPECT_EQ(compareFunction(lowValue, lowValue) == 0, true); 3448f512ceSopenharmony_ci EXPECT_EQ(compareFunction(lowValue, midValue) < 0, true); 3548f512ceSopenharmony_ci EXPECT_EQ(compareFunction(lowValue, highValue) < 0, true); 3648f512ceSopenharmony_ci EXPECT_EQ(compareFunction(highValue, midValue) > 0, true); 3748f512ceSopenharmony_ci EXPECT_EQ(compareFunction(highValue, lowValue) > 0, true); 3848f512ceSopenharmony_ci} 3948f512ceSopenharmony_ci 4048f512ceSopenharmony_citemplate<class T> 4148f512ceSopenharmony_civoid CompareStringTest(T &lowValue, T &midValue, T &highValue, 4248f512ceSopenharmony_ci ReportKeyCompareFunction &compareFunction) 4348f512ceSopenharmony_ci{ 4448f512ceSopenharmony_ci EXPECT_EQ(compareFunction(lowValue, lowValue) == 0, true); 4548f512ceSopenharmony_ci EXPECT_EQ(compareFunction(lowValue, midValue) < 0, true); 4648f512ceSopenharmony_ci EXPECT_EQ(compareFunction(lowValue, highValue) < 0, true); 4748f512ceSopenharmony_ci EXPECT_EQ(compareFunction(highValue, midValue) > 0, true); 4848f512ceSopenharmony_ci EXPECT_EQ(compareFunction(highValue, lowValue) > 0, true); 4948f512ceSopenharmony_ci} 5048f512ceSopenharmony_ci} // namespace HiPerf 5148f512ceSopenharmony_ci} // namespace Developtools 5248f512ceSopenharmony_ci} // namespace OHOS 5348f512ceSopenharmony_ci 5448f512ceSopenharmony_ci#endif // REPORT_TEST 55