diff options
| author | 2019-02-04 16:55:44 +0000 | |
|---|---|---|
| committer | 2019-02-04 16:55:44 +0000 | |
| commit | 76c648e7a477ffb2a882ad5ffe523269bd9a3f6a (patch) | |
| tree | 29d319d598650bab04e4f58e5e8769567e33091e /lib/libcxx/utils/google-benchmark/test/templated_fixture_test.cc | |
| parent | Import libc++abi 7.0.1. (diff) | |
| download | wireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.tar.xz wireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.zip | |
Import libc++ 7.0.1.
Diffstat (limited to 'lib/libcxx/utils/google-benchmark/test/templated_fixture_test.cc')
| -rw-r--r-- | lib/libcxx/utils/google-benchmark/test/templated_fixture_test.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/libcxx/utils/google-benchmark/test/templated_fixture_test.cc b/lib/libcxx/utils/google-benchmark/test/templated_fixture_test.cc new file mode 100644 index 00000000000..fe9865cc776 --- /dev/null +++ b/lib/libcxx/utils/google-benchmark/test/templated_fixture_test.cc @@ -0,0 +1,28 @@ + +#include "benchmark/benchmark.h" + +#include <cassert> +#include <memory> + +template <typename T> +class MyFixture : public ::benchmark::Fixture { + public: + MyFixture() : data(0) {} + + T data; +}; + +BENCHMARK_TEMPLATE_F(MyFixture, Foo, int)(benchmark::State& st) { + for (auto _ : st) { + data += 1; + } +} + +BENCHMARK_TEMPLATE_DEFINE_F(MyFixture, Bar, double)(benchmark::State& st) { + for (auto _ : st) { + data += 1.0; + } +} +BENCHMARK_REGISTER_F(MyFixture, Bar); + +BENCHMARK_MAIN(); |
