@@ -83,9 +83,9 @@ class MPITestEnvironment : public ::testing::Environment {
83
83
public:
84
84
MPITestEnvironment () : ::testing::Environment() {}
85
85
86
- MPITestEnvironment (const MPITestEnvironment&) = delete ;
86
+ MPITestEnvironment (const MPITestEnvironment &) = delete ;
87
87
88
- MPITestEnvironment (MPITestEnvironment&&) = default ;
88
+ MPITestEnvironment (MPITestEnvironment &&) = default ;
89
89
90
90
static MPI_Comm GetComm () { return global_test_comm; }
91
91
@@ -122,20 +122,20 @@ class PrettyMPIUnitTestResultPrinter : public ::testing::TestEventListener {
122
122
}
123
123
124
124
// The following methods override what's in the TestEventListener class.
125
- void OnTestIterationStart (const ::testing::UnitTest& unit_test, int iteration) override ;
126
- void OnEnvironmentsSetUpStart (const ::testing::UnitTest& unit_test) override ;
127
- void OnTestCaseStart (const ::testing::TestCase& test_case) override ;
128
- void OnTestStart (const ::testing::TestInfo& test_info) override ;
129
- void OnTestPartResult (const ::testing::TestPartResult& result) override ;
130
- void OnTestEnd (const ::testing::TestInfo& test_info) override ;
131
- void OnTestCaseEnd (const ::testing::TestCase& test_case) override ;
132
- void OnEnvironmentsTearDownStart (const ::testing::UnitTest& unit_test) override ;
133
- void OnTestIterationEnd (const ::testing::UnitTest& unit_test, int iteration) override ;
134
-
135
- void OnEnvironmentsSetUpEnd (const ::testing::UnitTest& /* unit_test*/ ) override {}
136
- void OnEnvironmentsTearDownEnd (const ::testing::UnitTest& /* unit_test*/ ) override {}
137
- void OnTestProgramStart (const ::testing::UnitTest& /* unit_test*/ ) override {}
138
- void OnTestProgramEnd (const ::testing::UnitTest& /* unit_test*/ ) override {}
125
+ void OnTestIterationStart (const ::testing::UnitTest & unit_test, int iteration) override ;
126
+ void OnEnvironmentsSetUpStart (const ::testing::UnitTest & unit_test) override ;
127
+ void OnTestCaseStart (const ::testing::TestCase & test_case) override ;
128
+ void OnTestStart (const ::testing::TestInfo & test_info) override ;
129
+ void OnTestPartResult (const ::testing::TestPartResult & result) override ;
130
+ void OnTestEnd (const ::testing::TestInfo & test_info) override ;
131
+ void OnTestCaseEnd (const ::testing::TestCase & test_case) override ;
132
+ void OnEnvironmentsTearDownStart (const ::testing::UnitTest & unit_test) override ;
133
+ void OnTestIterationEnd (const ::testing::UnitTest & unit_test, int iteration) override ;
134
+
135
+ void OnEnvironmentsSetUpEnd (const ::testing::UnitTest & /* unit_test*/ ) override {}
136
+ void OnEnvironmentsTearDownEnd (const ::testing::UnitTest & /* unit_test*/ ) override {}
137
+ void OnTestProgramStart (const ::testing::UnitTest & /* unit_test*/ ) override {}
138
+ void OnTestProgramEnd (const ::testing::UnitTest & /* unit_test*/ ) override {}
139
139
140
140
private:
141
141
int rank_;
@@ -149,15 +149,15 @@ class PrettyMPIUnitTestResultPrinter : public ::testing::TestEventListener {
149
149
};
150
150
151
151
// Taken / modified from Googletest
152
- void PrettyMPIUnitTestResultPrinter::OnTestIterationStart (const ::testing::UnitTest& unit_test,
152
+ void PrettyMPIUnitTestResultPrinter::OnTestIterationStart (const ::testing::UnitTest & unit_test,
153
153
int iteration) {
154
154
using namespace ::testing;
155
155
if (rank_ != 0 ) return ;
156
156
157
157
if (GTEST_FLAG (repeat) != 1 )
158
158
printf (" \n Repeating all tests (iteration %d) . . .\n\n " , iteration + 1 );
159
159
160
- const char * const filter = GTEST_FLAG (filter).c_str ();
160
+ const char * const filter = GTEST_FLAG (filter).c_str ();
161
161
162
162
// Prints the filter if it's not *. This reminds the user that some
163
163
// tests may be skipped.
@@ -185,7 +185,7 @@ void PrettyMPIUnitTestResultPrinter::OnTestIterationStart(const ::testing::UnitT
185
185
// Taken / modified from Googletest
186
186
// Formats a source file path and a line number as they would appear
187
187
// in an error message from the compiler used to compile this code.
188
- GTEST_API_ ::std::string FormatFileLocation (const char * file, int line) {
188
+ GTEST_API_ ::std::string FormatFileLocation (const char * file, int line) {
189
189
const std::string file_name (file == nullptr ? " unkown file" : file);
190
190
191
191
if (line < 0 ) {
@@ -200,15 +200,15 @@ GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
200
200
201
201
// Taken / modified from Googletest
202
202
void PrettyMPIUnitTestResultPrinter::OnEnvironmentsSetUpStart (
203
- const ::testing::UnitTest& /* unit_test*/ ) {
203
+ const ::testing::UnitTest & /* unit_test*/ ) {
204
204
if (rank_ != 0 ) return ;
205
205
ColoredPrintf (COLOR_GREEN, " [----------] " );
206
206
printf (" Global test environment set-up.\n " );
207
207
fflush (stdout);
208
208
}
209
209
210
210
// Taken / modified from Googletest
211
- void PrettyMPIUnitTestResultPrinter::OnTestCaseStart (const ::testing::TestCase& test_case) {
211
+ void PrettyMPIUnitTestResultPrinter::OnTestCaseStart (const ::testing::TestCase & test_case) {
212
212
using namespace ::testing;
213
213
if (rank_ != 0 ) return ;
214
214
const std::string counts = FormatCountableNoun (test_case.test_to_run_count (), " test" , " tests" );
@@ -223,7 +223,7 @@ void PrettyMPIUnitTestResultPrinter::OnTestCaseStart(const ::testing::TestCase&
223
223
}
224
224
225
225
// Taken / modified from Googletest
226
- void PrettyMPIUnitTestResultPrinter::OnTestStart (const ::testing::TestInfo& test_info) {
226
+ void PrettyMPIUnitTestResultPrinter::OnTestStart (const ::testing::TestInfo & test_info) {
227
227
if (rank_ != 0 ) return ;
228
228
ColoredPrintf (COLOR_GREEN, " [ RUN ] " );
229
229
printf (" %s.%s" , test_info.test_case_name (), test_info.name ());
@@ -233,15 +233,15 @@ void PrettyMPIUnitTestResultPrinter::OnTestStart(const ::testing::TestInfo& test
233
233
}
234
234
235
235
// Taken / modified from Googletest
236
- void PrettyMPIUnitTestResultPrinter::OnTestPartResult (const ::testing::TestPartResult& result) {
236
+ void PrettyMPIUnitTestResultPrinter::OnTestPartResult (const ::testing::TestPartResult & result) {
237
237
using namespace ::testing;
238
238
// If the test part succeeded, we don't need to do anything.
239
239
if (result.type () == TestPartResult::kSuccess ) return ;
240
240
failed_results_.Add (result);
241
241
}
242
242
243
243
// Taken / modified from Googletest
244
- void PrintFailedTestResultCollection (const TestPartResultCollection& collection, int rank) {
244
+ void PrintFailedTestResultCollection (const TestPartResultCollection & collection, int rank) {
245
245
for (std::size_t i = 0 ; i < collection.Size (); ++i) {
246
246
std::string m =
247
247
(::testing::Message ()
@@ -256,7 +256,7 @@ void PrintFailedTestResultCollection(const TestPartResultCollection& collection,
256
256
}
257
257
258
258
// Taken / modified from Googletest
259
- void PrettyMPIUnitTestResultPrinter::OnTestEnd (const ::testing::TestInfo& test_info) {
259
+ void PrettyMPIUnitTestResultPrinter::OnTestEnd (const ::testing::TestInfo & test_info) {
260
260
using namespace ::testing;
261
261
262
262
// check if any ranks failed
@@ -275,7 +275,7 @@ void PrettyMPIUnitTestResultPrinter::OnTestEnd(const ::testing::TestInfo& test_i
275
275
}
276
276
277
277
int failed_globally = failed_locally;
278
- for (const auto & f : failed_flags_per_rank) {
278
+ for (const auto & f : failed_flags_per_rank) {
279
279
if (f) failed_globally = 1 ;
280
280
}
281
281
@@ -329,7 +329,7 @@ void PrettyMPIUnitTestResultPrinter::OnTestEnd(const ::testing::TestInfo& test_i
329
329
}
330
330
331
331
// Taken / modified from Googletest
332
- void PrettyMPIUnitTestResultPrinter::OnTestCaseEnd (const ::testing::TestCase& test_case) {
332
+ void PrettyMPIUnitTestResultPrinter::OnTestCaseEnd (const ::testing::TestCase & test_case) {
333
333
using namespace ::testing;
334
334
if (!GTEST_FLAG (print_time) || rank_ != 0 ) return ;
335
335
@@ -340,9 +340,9 @@ void PrettyMPIUnitTestResultPrinter::OnTestCaseEnd(const ::testing::TestCase& te
340
340
fflush (stdout);
341
341
}
342
342
343
- static std::string FormatSet (const std::set<int >& s) {
343
+ std::string FormatSet (const std::set<int > & s) {
344
344
std::string res;
345
- for (const auto & val : s) {
345
+ for (const auto & val : s) {
346
346
res += std::to_string (val);
347
347
if (val != *(--s.end ())) {
348
348
res += " , " ;
@@ -353,8 +353,7 @@ static std::string FormatSet(const std::set<int>& s) {
353
353
}
354
354
355
355
// Taken / modified from Googletest
356
- static void PrintFullTestCommentIfPresent (const std::string& type_param,
357
- const std::string& value_param) {
356
+ void PrintFullTestCommentIfPresent (const std::string &type_param, const std::string &value_param) {
358
357
if (!type_param.empty () || !value_param.empty ()) {
359
358
printf (" , where " );
360
359
if (!type_param.empty ()) {
@@ -369,7 +368,7 @@ static void PrintFullTestCommentIfPresent(const std::string& type_param,
369
368
}
370
369
371
370
// Taken / modified from Googletest
372
- void PrettyMPIUnitTestResultPrinter::OnTestIterationEnd (const ::testing::UnitTest& unit_test,
371
+ void PrettyMPIUnitTestResultPrinter::OnTestIterationEnd (const ::testing::UnitTest & unit_test,
373
372
int /* iteration*/ ) {
374
373
using namespace ::testing;
375
374
failed_results_.Reset ();
@@ -390,7 +389,7 @@ void PrettyMPIUnitTestResultPrinter::OnTestIterationEnd(const ::testing::UnitTes
390
389
if (num_failed_tests_) {
391
390
ColoredPrintf (COLOR_RED, " [ FAILED ] " );
392
391
printf (" %s, listed below:\n " , FormatTestCount (num_failed_tests_).c_str ());
393
- for (const auto & prop : failed_test_properties_) {
392
+ for (const auto & prop : failed_test_properties_) {
394
393
if (!prop.should_run ) continue ;
395
394
ColoredPrintf (COLOR_RED, " [ FAILED ] " );
396
395
printf (" %s.%s" , prop.case_name .c_str (), prop.name .c_str ());
@@ -414,7 +413,7 @@ void PrettyMPIUnitTestResultPrinter::OnTestIterationEnd(const ::testing::UnitTes
414
413
415
414
// Taken / modified from Googletest
416
415
void PrettyMPIUnitTestResultPrinter::OnEnvironmentsTearDownStart (
417
- const ::testing::UnitTest& /* unit_test*/ ) {
416
+ const ::testing::UnitTest & /* unit_test*/ ) {
418
417
if (rank_ != 0 ) return ;
419
418
ColoredPrintf (COLOR_GREEN, " [----------] " );
420
419
printf (" Global MPI test environment tear-down\n " );
0 commit comments