Files
libcxx/utils/google-benchmark/test/templated_fixture_test.cc
Eric Fiselier ffc31db661 Update google-benchark to trunk
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336635 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 04:02:00 +00:00

29 lines
482 B
C++

#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();