clang-format

This commit is contained in:
Dominic Hamon 2024-08-07 16:47:41 +01:00
parent 3053d1bc83
commit a1c840fd5d
3 changed files with 34 additions and 31 deletions

View File

@ -287,11 +287,11 @@ void JSONReporter::PrintRunData(Run const& run) {
out << indent << FormatKV("real_time", run.real_accumulated_time) out << indent << FormatKV("real_time", run.real_accumulated_time)
<< ",\n"; << ",\n";
if (run.threads != 1) { if (run.threads != 1) {
out << indent out << indent
<< FormatKV( << FormatKV(
"per_thread_real_time", "per_thread_real_time",
run.real_accumulated_time * static_cast<double>(run.threads)) run.real_accumulated_time * static_cast<double>(run.threads))
<< ",\n"; << ",\n";
} }
out << indent << FormatKV("cpu_time", run.cpu_accumulated_time); out << indent << FormatKV("cpu_time", run.cpu_accumulated_time);
} }

View File

@ -108,21 +108,20 @@ void CheckCase(std::stringstream& remaining_output, TestCase const& TC,
for (const auto& NC : not_checks) { for (const auto& NC : not_checks) {
BM_CHECK(!NC.regex->Match(line)) BM_CHECK(!NC.regex->Match(line))
<< "Unexpected match for line \"" << line << "\" for MR_Not regex \"" << "Unexpected match for line \"" << line << "\" for MR_Not regex \""
<< NC.regex_str << "\"" << NC.regex_str << "\"" << "\n actual regex string \""
<< "\n actual regex string \"" << TC.substituted_regex << "\"" << TC.substituted_regex << "\""
<< "\n started matching near: " << first_line; << "\n started matching near: " << first_line;
} }
if (TC.regex->Match(line)) return; if (TC.regex->Match(line)) return;
BM_CHECK(TC.match_rule != MR_Next) BM_CHECK(TC.match_rule != MR_Next)
<< "Expected line \"" << line << "\" to match regex \"" << TC.regex_str << "Expected line \"" << line << "\" to match regex \"" << TC.regex_str
<< "\"" << "\"" << "\n actual regex string \"" << TC.substituted_regex
<< "\n actual regex string \"" << TC.substituted_regex << "\"" << "\"" << "\n started matching near: " << first_line;
<< "\n started matching near: " << first_line;
} }
BM_CHECK(remaining_output.eof() == false) BM_CHECK(remaining_output.eof() == false)
<< "End of output reached before match for regex \"" << TC.regex_str << "End of output reached before match for regex \"" << TC.regex_str
<< "\" was found" << "\" was found" << "\n actual regex string \""
<< "\n actual regex string \"" << TC.substituted_regex << "\"" << TC.substituted_regex << "\""
<< "\n started matching near: " << first_line; << "\n started matching near: " << first_line;
} }

View File

@ -10,9 +10,11 @@
// ---------------------- Testing Prologue Output -------------------------- // // ---------------------- Testing Prologue Output -------------------------- //
// ========================================================================= // // ========================================================================= //
ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next}, ADD_CASES(TC_ConsoleOut,
{"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$", MR_Next}, {{"^[-]+$", MR_Next},
{"^[-]+$", MR_Next}}); {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$",
MR_Next},
{"^[-]+$", MR_Next}});
static int AddContextCases() { static int AddContextCases() {
AddCases(TC_ConsoleErr, AddCases(TC_ConsoleErr,
{ {
@ -417,8 +419,9 @@ void BM_Complexity_O1(benchmark::State& state) {
BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1); BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1);
SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"}, SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"},
{"%RMS", "[ ]*[0-9]+ %"}}); {"%RMS", "[ ]*[0-9]+ %"}});
ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"}, ADD_CASES(TC_ConsoleOut,
{"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}}); {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"},
{"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}});
// ========================================================================= // // ========================================================================= //
// ----------------------- Testing Aggregate Output ------------------------ // // ----------------------- Testing Aggregate Output ------------------------ //
@ -842,20 +845,21 @@ BENCHMARK(BM_UserStats)
// check that user-provided stats is calculated, and is after the default-ones // 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 // empty string as name is intentional, it would sort before anything else
ADD_CASES(TC_ConsoleOut, {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " ADD_CASES(TC_ConsoleOut,
"]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"},
"]*150 ns [ ]*150 ns %time [ ]*5$"}, {"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " "]*150 ns [ ]*150 ns %time [ ]*5$"},
"]*150 ns [ ]*150 ns %time [ ]*5$"}, {"^BM_UserStats/iterations:5/repeats:3/manual_time [ "
{"^BM_UserStats/iterations:5/repeats:3/" "]*150 ns [ ]*150 ns %time [ ]*5$"},
"manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, {"^BM_UserStats/iterations:5/repeats:3/"
{"^BM_UserStats/iterations:5/repeats:3/" "manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"},
"manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, {"^BM_UserStats/iterations:5/repeats:3/"
{"^BM_UserStats/iterations:5/repeats:3/" "manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"},
"manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"}, {"^BM_UserStats/iterations:5/repeats:3/"
{"^BM_UserStats/iterations:5/repeats:3/manual_time_cv " "manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"},
"%console_percentage_report[ ]*$"}}); {"^BM_UserStats/iterations:5/repeats:3/manual_time_cv "
"%console_percentage_report[ ]*$"}});
ADD_CASES( ADD_CASES(
TC_JSONOut, TC_JSONOut,
{{"\"name\": \"BM_UserStats/iterations:5/repeats:3/manual_time\",$"}, {{"\"name\": \"BM_UserStats/iterations:5/repeats:3/manual_time\",$"},