Mercurial > hg > CbC > CbC_llvm
comparison libcxx/utils/google-benchmark/test/templated_fixture_test.cc @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 | |
2 #include "benchmark/benchmark.h" | |
3 | |
4 #include <cassert> | |
5 #include <memory> | |
6 | |
7 template <typename T> | |
8 class MyFixture : public ::benchmark::Fixture { | |
9 public: | |
10 MyFixture() : data(0) {} | |
11 | |
12 T data; | |
13 }; | |
14 | |
15 BENCHMARK_TEMPLATE_F(MyFixture, Foo, int)(benchmark::State& st) { | |
16 for (auto _ : st) { | |
17 data += 1; | |
18 } | |
19 } | |
20 | |
21 BENCHMARK_TEMPLATE_DEFINE_F(MyFixture, Bar, double)(benchmark::State& st) { | |
22 for (auto _ : st) { | |
23 data += 1.0; | |
24 } | |
25 } | |
26 BENCHMARK_REGISTER_F(MyFixture, Bar); | |
27 | |
28 BENCHMARK_MAIN(); |