aboutsummaryrefslogtreecommitdiff
path: root/test/fixture_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixture_test.cc')
-rw-r--r--test/fixture_test.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/fixture_test.cc b/test/fixture_test.cc
index a331c7d..d1093eb 100644
--- a/test/fixture_test.cc
+++ b/test/fixture_test.cc
@@ -1,33 +1,33 @@
-#include "benchmark/benchmark.h"
-
#include <cassert>
#include <memory>
+#include "benchmark/benchmark.h"
+
#define FIXTURE_BECHMARK_NAME MyFixture
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
public:
- void SetUp(const ::benchmark::State& state) {
- if (state.thread_index == 0) {
+ void SetUp(const ::benchmark::State& state) override {
+ if (state.thread_index() == 0) {
assert(data.get() == nullptr);
data.reset(new int(42));
}
}
- void TearDown(const ::benchmark::State& state) {
- if (state.thread_index == 0) {
+ void TearDown(const ::benchmark::State& state) override {
+ if (state.thread_index() == 0) {
assert(data.get() != nullptr);
data.reset();
}
}
- ~FIXTURE_BECHMARK_NAME() { assert(data == nullptr); }
+ ~FIXTURE_BECHMARK_NAME() override { assert(data == nullptr); }
std::unique_ptr<int> data;
};
-BENCHMARK_F(FIXTURE_BECHMARK_NAME, Foo)(benchmark::State &st) {
+BENCHMARK_F(FIXTURE_BECHMARK_NAME, Foo)(benchmark::State& st) {
assert(data.get() != nullptr);
assert(*data == 42);
for (auto _ : st) {
@@ -35,7 +35,7 @@ BENCHMARK_F(FIXTURE_BECHMARK_NAME, Foo)(benchmark::State &st) {
}
BENCHMARK_DEFINE_F(FIXTURE_BECHMARK_NAME, Bar)(benchmark::State& st) {
- if (st.thread_index == 0) {
+ if (st.thread_index() == 0) {
assert(data.get() != nullptr);
assert(*data == 42);
}