Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
dmah42 committed Aug 7, 2024
1 parent 3053d1b commit a1c840f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
10 changes: 5 additions & 5 deletions src/json_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ void JSONReporter::PrintRunData(Run const& run) {
out << indent << FormatKV("real_time", run.real_accumulated_time)
<< ",\n";
if (run.threads != 1) {
out << indent
<< FormatKV(
"per_thread_real_time",
run.real_accumulated_time * static_cast<double>(run.threads))
<< ",\n";
out << indent
<< FormatKV(
"per_thread_real_time",
run.real_accumulated_time * static_cast<double>(run.threads))
<< ",\n";
}
out << indent << FormatKV("cpu_time", run.cpu_accumulated_time);
}
Expand Down
13 changes: 6 additions & 7 deletions test/output_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,20 @@ void CheckCase(std::stringstream& remaining_output, TestCase const& TC,
for (const auto& NC : not_checks) {
BM_CHECK(!NC.regex->Match(line))
<< "Unexpected match for line \"" << line << "\" for MR_Not regex \""
<< NC.regex_str << "\""
<< "\n actual regex string \"" << TC.substituted_regex << "\""
<< NC.regex_str << "\"" << "\n actual regex string \""
<< TC.substituted_regex << "\""
<< "\n started matching near: " << first_line;
}
if (TC.regex->Match(line)) return;
BM_CHECK(TC.match_rule != MR_Next)
<< "Expected line \"" << line << "\" to match regex \"" << TC.regex_str
<< "\""
<< "\n actual regex string \"" << TC.substituted_regex << "\""
<< "\n started matching near: " << first_line;
<< "\"" << "\n actual regex string \"" << TC.substituted_regex
<< "\"" << "\n started matching near: " << first_line;
}
BM_CHECK(remaining_output.eof() == false)
<< "End of output reached before match for regex \"" << TC.regex_str
<< "\" was found"
<< "\n actual regex string \"" << TC.substituted_regex << "\""
<< "\" was found" << "\n actual regex string \""
<< TC.substituted_regex << "\""
<< "\n started matching near: " << first_line;
}

Expand Down
42 changes: 23 additions & 19 deletions test/reporter_output_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// ---------------------- Testing Prologue Output -------------------------- //
// ========================================================================= //

ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next},
{"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$", MR_Next},
{"^[-]+$", MR_Next}});
ADD_CASES(TC_ConsoleOut,
{{"^[-]+$", MR_Next},
{"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$",
MR_Next},
{"^[-]+$", MR_Next}});
static int AddContextCases() {
AddCases(TC_ConsoleErr,
{
Expand Down Expand Up @@ -417,8 +419,9 @@ void BM_Complexity_O1(benchmark::State& state) {
BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1);
SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"},
{"%RMS", "[ ]*[0-9]+ %"}});
ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"},
{"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}});
ADD_CASES(TC_ConsoleOut,
{{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"},
{"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}});

// ========================================================================= //
// ----------------------- Testing Aggregate Output ------------------------ //
Expand Down Expand Up @@ -842,20 +845,21 @@ BENCHMARK(BM_UserStats)

// check that user-provided stats is calculated, and is after the default-ones
// empty string as name is intentional, it would sort before anything else
ADD_CASES(TC_ConsoleOut, {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
"]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"},
{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
"]*150 ns [ ]*150 ns %time [ ]*5$"},
{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
"]*150 ns [ ]*150 ns %time [ ]*5$"},
{"^BM_UserStats/iterations:5/repeats:3/"
"manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"},
{"^BM_UserStats/iterations:5/repeats:3/"
"manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"},
{"^BM_UserStats/iterations:5/repeats:3/"
"manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"},
{"^BM_UserStats/iterations:5/repeats:3/manual_time_cv "
"%console_percentage_report[ ]*$"}});
ADD_CASES(TC_ConsoleOut,
{{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
"]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"},
{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
"]*150 ns [ ]*150 ns %time [ ]*5$"},
{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
"]*150 ns [ ]*150 ns %time [ ]*5$"},
{"^BM_UserStats/iterations:5/repeats:3/"
"manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"},
{"^BM_UserStats/iterations:5/repeats:3/"
"manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"},
{"^BM_UserStats/iterations:5/repeats:3/"
"manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"},
{"^BM_UserStats/iterations:5/repeats:3/manual_time_cv "
"%console_percentage_report[ ]*$"}});
ADD_CASES(
TC_JSONOut,
{{"\"name\": \"BM_UserStats/iterations:5/repeats:3/manual_time\",$"},
Expand Down

0 comments on commit a1c840f

Please sign in to comment.