grpc
third_party
benchmark
test
report_aggregates_only_test.cc
Go to the documentation of this file.
1
2
#undef NDEBUG
3
#include <cstdio>
4
#include <string>
5
6
#include "benchmark/benchmark.h"
7
#include "
output_test.h
"
8
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.
12
13
void
BM_SummaryRepeat
(
benchmark::State
&
state
) {
14
for
(
auto
_
:
state
) {
15
}
16
}
17
BENCHMARK
(
BM_SummaryRepeat
)->Repetitions(3)->ReportAggregatesOnly();
18
19
int
main
(
int
argc,
char
* argv[]) {
20
const
std::string
output
=
GetFileReporterOutput
(argc, argv);
21
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;
38
}
39
40
return
0;
41
}
GetFileReporterOutput
std::string GetFileReporterOutput(int argc, char *argv[])
Definition:
benchmark/test/output_test_helper.cc:501
BENCHMARK
BENCHMARK(BM_SummaryRepeat) -> Repetitions(3) ->ReportAggregatesOnly()
testing::internal::string
::std::string string
Definition:
bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
SubstrCnt
int SubstrCnt(const std::string &haystack, const std::string &pat)
Definition:
benchmark/test/output_test_helper.cc:453
main
int main(int argc, char *argv[])
Definition:
report_aggregates_only_test.cc:19
output_test.h
gmock_output_test.output
output
Definition:
bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
gmock_output_test._
_
Definition:
bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
benchmark::State
Definition:
benchmark/include/benchmark/benchmark.h:503
state
Definition:
bloaty/third_party/zlib/contrib/blast/blast.c:41
BM_SummaryRepeat
void BM_SummaryRepeat(benchmark::State &state)
Definition:
report_aggregates_only_test.cc:13
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:04