blob: ec5b4c0cc07821937a514745adf9d99514b204c6 [file] [log] [blame]
Eric Fiselier19039762018-01-18 04:23:01 +00001
2#include "benchmark/benchmark.h"
3
4#include <cassert>
5#include <memory>
6
7template<typename T>
8class MyFixture : public ::benchmark::Fixture {
9public:
10 MyFixture() : data(0) {}
11
12 T data;
13};
14
15BENCHMARK_TEMPLATE_F(MyFixture, Foo, int)(benchmark::State &st) {
16 for (auto _ : st) {
17 data += 1;
18 }
19}
20
21BENCHMARK_TEMPLATE_DEFINE_F(MyFixture, Bar, double)(benchmark::State& st) {
22 for (auto _ : st) {
23 data += 1.0;
24 }
25}
26BENCHMARK_REGISTER_F(MyFixture, Bar);
27
28BENCHMARK_MAIN();