benchmark/test/cxx03_test.cc
Go to the documentation of this file.
1 #undef NDEBUG
2 #include <cassert>
3 #include <cstddef>
4 
5 #include "benchmark/benchmark.h"
6 
7 #if __cplusplus >= 201103L
8 #error C++11 or greater detected. Should be C++03.
9 #endif
10 
11 #ifdef BENCHMARK_HAS_CXX11
12 #error C++11 or greater detected by the library. BENCHMARK_HAS_CXX11 is defined.
13 #endif
14 
16  while (state.KeepRunning()) {
17  volatile benchmark::IterationCount x = state.iterations();
18  ((void)x);
19  }
20 }
22 
23 // The new C++11 interface for args/ranges requires initializer list support.
24 // Therefore we provide the old interface to support C++03.
26  assert((state.range(0) == 1 && state.range(1) == 2) ||
27  (state.range(0) == 5 && state.range(1) == 6));
28  while (state.KeepRunning()) {
29  }
30 }
31 BENCHMARK(BM_old_arg_range_interface)->ArgPair(1, 2)->RangePair(5, 5, 6, 6);
32 
33 template <class T, class U>
35  BM_empty(state);
36 }
38 
39 template <class T>
41  BM_empty(state);
42 }
45 
46 template <class T>
48 };
49 
51  BM_empty(state);
52 }
54  BM_empty(state);
55 }
56 
58  BM_empty(state);
59  state.counters["Foo"] = 2;
60 }
62 
BENCHMARK_TEMPLATE_F
BENCHMARK_TEMPLATE_F(BM_Fixture, BM_template1, long)(benchmark
Definition: benchmark/test/cxx03_test.cc:50
BM_template1
void BM_template1(benchmark::State &state)
Definition: benchmark/test/cxx03_test.cc:40
benchmark::Fixture
Definition: benchmark/include/benchmark/benchmark.h:1122
benchmark::IterationCount
uint64_t IterationCount
Definition: benchmark/include/benchmark/benchmark.h:451
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
BENCHMARK_TEMPLATE2
BENCHMARK_TEMPLATE2(BM_template2, int, long)
BENCHMARK_TEMPLATE1
BENCHMARK_TEMPLATE1(BM_template1, int)
BENCHMARK_TEMPLATE
BENCHMARK_TEMPLATE(BM_template1, long)
BM_counters
void BM_counters(benchmark::State &state)
Definition: benchmark/test/cxx03_test.cc:57
benchmark::State
Definition: benchmark/include/benchmark/benchmark.h:503
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
BM_Fixture
Definition: benchmark/test/cxx03_test.cc:47
BENCHMARK_MAIN
BENCHMARK_MAIN()
BENCHMARK
BENCHMARK(BM_empty)
BM_old_arg_range_interface
void BM_old_arg_range_interface(benchmark::State &state)
Definition: benchmark/test/cxx03_test.cc:25
BM_template2
void BM_template2(benchmark::State &state)
Definition: benchmark/test/cxx03_test.cc:34
BENCHMARK_TEMPLATE1_F
BENCHMARK_TEMPLATE1_F(BM_Fixture, BM_template2, int)(benchmark
Definition: benchmark/test/cxx03_test.cc:53
BM_empty
void BM_empty(benchmark::State &state)
Definition: benchmark/test/cxx03_test.cc:15
state
static struct rpc_state state
Definition: bad_server_response_test.cc:87


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:08