summaryrefslogtreecommitdiff
path: root/utils/google-benchmark/test/options_test.cc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:07:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:07:56 +0000
commitf36202620b428c45a1c8d91743727c9313424fb2 (patch)
tree14928d8970ba4890a6370aca4c38fc832d45f21f /utils/google-benchmark/test/options_test.cc
parent0294ba5648d889e48ffee8ddad25944e258940ae (diff)
Notes
Diffstat (limited to 'utils/google-benchmark/test/options_test.cc')
-rw-r--r--utils/google-benchmark/test/options_test.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/utils/google-benchmark/test/options_test.cc b/utils/google-benchmark/test/options_test.cc
index bbbed28839881..fdec69174eec0 100644
--- a/utils/google-benchmark/test/options_test.cc
+++ b/utils/google-benchmark/test/options_test.cc
@@ -1,4 +1,4 @@
-#include "benchmark/benchmark_api.h"
+#include "benchmark/benchmark.h"
#include <chrono>
#include <thread>
@@ -8,13 +8,13 @@
#include <cassert>
void BM_basic(benchmark::State& state) {
- while (state.KeepRunning()) {
+ for (auto _ : state) {
}
}
void BM_basic_slow(benchmark::State& state) {
std::chrono::milliseconds sleep_duration(state.range(0));
- while (state.KeepRunning()) {
+ for (auto _ : state) {
std::this_thread::sleep_for(
std::chrono::duration_cast<std::chrono::nanoseconds>(sleep_duration));
}
@@ -44,7 +44,7 @@ void CustomArgs(benchmark::internal::Benchmark* b) {
BENCHMARK(BM_basic)->Apply(CustomArgs);
-void BM_explicit_iteration_count(benchmark::State& st) {
+void BM_explicit_iteration_count(benchmark::State& state) {
// Test that benchmarks specified with an explicit iteration count are
// only run once.
static bool invoked_before = false;
@@ -52,14 +52,14 @@ void BM_explicit_iteration_count(benchmark::State& st) {
invoked_before = true;
// Test that the requested iteration count is respected.
- assert(st.max_iterations == 42);
+ assert(state.max_iterations == 42);
size_t actual_iterations = 0;
- while (st.KeepRunning())
+ for (auto _ : state)
++actual_iterations;
- assert(st.iterations() == st.max_iterations);
- assert(st.iterations() == 42);
+ assert(state.iterations() == state.max_iterations);
+ assert(state.iterations() == 42);
}
BENCHMARK(BM_explicit_iteration_count)->Iterations(42);
-BENCHMARK_MAIN()
+BENCHMARK_MAIN();