Skip to content

Commit 2544a4e

Browse files
committed
Make PrintTo functions static inline in perf_tests.cpp for better encapsulation. Add missing <ostream> include.
1 parent c966b97 commit 2544a4e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

modules/core/performance/tests/perf_tests.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <filesystem>
66
#include <fstream>
77
#include <memory>
8+
#include <ostream>
89
#include <stdexcept>
910
#include <string_view>
1011
#include <vector>
@@ -96,12 +97,11 @@ TEST(perf_tests, check_perf_task_float) {
9697
struct ParamTestCase {
9798
ppc::core::PerfResults::TypeOfRunning input;
9899
std::string expected_output;
100+
friend inline void PrintTo(const ParamTestCase& param, std::ostream* os) {
101+
*os << "{ input = " << static_cast<int>(param.input) << ", expected = " << param.expected_output << " }";
102+
}
99103
};
100104

101-
inline void PrintTo(const ParamTestCase& param, std::ostream* os) {
102-
*os << "{ input = " << static_cast<int>(param.input) << ", expected = " << param.expected_output << " }";
103-
}
104-
105105
class GetStringParamNameParamTest : public ::testing::TestWithParam<ParamTestCase> {};
106106

107107
TEST_P(GetStringParamNameParamTest, ReturnsExpectedString) {
@@ -120,13 +120,12 @@ struct TaskTypeTestCase {
120120
ppc::core::TypeOfTask type;
121121
std::string expected;
122122
std::string label;
123+
friend inline void PrintTo(const TaskTypeTestCase& param, std::ostream* os) {
124+
*os << "{ type = " << static_cast<int>(param.type) << ", expected = " << param.expected
125+
<< ", label = " << param.label << " }";
126+
}
123127
};
124128

125-
inline void PrintTo(const TaskTypeTestCase& param, std::ostream* os) {
126-
*os << "{ type = " << static_cast<int>(param.type) << ", expected = " << param.expected << ", label = " << param.label
127-
<< " }";
128-
}
129-
130129
class GetStringTaskTypeTest : public ::testing::TestWithParam<TaskTypeTestCase> {
131130
protected:
132131
std::string temp_path;

0 commit comments

Comments
 (0)