diff options
author | Eli Bendersky <eliben@gmail.com> | 2015-09-23 11:44:26 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2015-09-23 12:47:54 -0700 |
commit | 1dd40c99c092e16488387c3409a6f8600a406d00 (patch) | |
tree | 8e9a2f243b61054b0e0c9b289d3cbb5f5774aa79 | |
parent | f338ce7965ab7b90bd8f69a981b8386ab8b54dc5 (diff) | |
download | google-benchmark-1dd40c99c092e16488387c3409a6f8600a406d00.tar.gz |
Custom arguments function usage with Apply - fix doc and add test.
-rw-r--r-- | include/benchmark/benchmark_api.h | 3 | ||||
-rw-r--r-- | test/options_test.cc | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/benchmark/benchmark_api.h b/include/benchmark/benchmark_api.h index 4d9d5f3..f098255 100644 --- a/include/benchmark/benchmark_api.h +++ b/include/benchmark/benchmark_api.h @@ -90,8 +90,7 @@ BENCHMARK(BM_SetInsert)->RangePair(1<<10, 8<<10, 1, 512); static void CustomArguments(benchmark::internal::Benchmark* b) { for (int i = 0; i <= 10; ++i) for (int j = 32; j <= 1024*1024; j *= 8) - b = b->ArgPair(i, j); - return b; + b->ArgPair(i, j); } BENCHMARK(BM_SetInsert)->Apply(CustomArguments); diff --git a/test/options_test.cc b/test/options_test.cc index ec8c2a1..d4c682d 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -15,4 +15,12 @@ BENCHMARK(BM_basic)->UseRealTime(); BENCHMARK(BM_basic)->ThreadRange(2, 4); BENCHMARK(BM_basic)->ThreadPerCpu(); +void CustomArgs(benchmark::internal::Benchmark* b) { + for (int i = 0; i < 10; ++i) { + b->Arg(i); + } +} + +BENCHMARK(BM_basic)->Apply(CustomArgs); + BENCHMARK_MAIN() |