[NFC] Add libcxx python reformat SHA to .git-blame-ignore-revs
[llvm-project.git] / third-party / benchmark / test / report_aggregates_only_test.cc
blob47da50358885bbd80a43afdf73c1031a0e2f06b1
2 #undef NDEBUG
3 #include <cstdio>
4 #include <string>
6 #include "benchmark/benchmark.h"
7 #include "output_test.h"
9 // Ok this test is super ugly. We want to check what happens with the file
10 // reporter in the presence of ReportAggregatesOnly().
11 // We do not care about console output, the normal tests check that already.
13 void BM_SummaryRepeat(benchmark::State& state) {
14 for (auto _ : state) {
17 BENCHMARK(BM_SummaryRepeat)->Repetitions(3)->ReportAggregatesOnly();
19 int main(int argc, char* argv[]) {
20 const std::string output = GetFileReporterOutput(argc, argv);
22 if (SubstrCnt(output, "\"name\": \"BM_SummaryRepeat/repeats:3") != 4 ||
23 SubstrCnt(output, "\"name\": \"BM_SummaryRepeat/repeats:3_mean\"") != 1 ||
24 SubstrCnt(output, "\"name\": \"BM_SummaryRepeat/repeats:3_median\"") !=
25 1 ||
26 SubstrCnt(output, "\"name\": \"BM_SummaryRepeat/repeats:3_stddev\"") !=
27 1 ||
28 SubstrCnt(output, "\"name\": \"BM_SummaryRepeat/repeats:3_cv\"") != 1) {
29 std::cout << "Precondition mismatch. Expected to only find four "
30 "occurrences of \"BM_SummaryRepeat/repeats:3\" substring:\n"
31 "\"name\": \"BM_SummaryRepeat/repeats:3_mean\", "
32 "\"name\": \"BM_SummaryRepeat/repeats:3_median\", "
33 "\"name\": \"BM_SummaryRepeat/repeats:3_stddev\", "
34 "\"name\": \"BM_SummaryRepeat/repeats:3_cv\"\nThe entire "
35 "output:\n";
36 std::cout << output;
37 return 1;
40 return 0;