Skip to content

Commit 827978c

Browse files
committed
fix linter
1 parent d907680 commit 827978c

File tree

1 file changed

+29
-34
lines changed

1 file changed

+29
-34
lines changed

test/benchmark_setup_teardown_cb_types_gtest.cc

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,52 @@
1-
#include "gtest/gtest.h"
21
#include "benchmark/benchmark.h"
2+
#include "gtest/gtest.h"
33

44
using benchmark::BenchmarkReporter;
5+
using benchmark::callback_function;
6+
using benchmark::ClearRegisteredBenchmarks;
7+
using benchmark::RegisterBenchmark;
58
using benchmark::RunSpecifiedBenchmarks;
69
using benchmark::State;
7-
using benchmark::RegisterBenchmark;
8-
using benchmark::ClearRegisteredBenchmarks;
910
using benchmark::internal::Benchmark;
10-
using benchmark::callback_function;
1111

1212
static int functor_called = 0;
13-
1413
struct Functor {
15-
void operator()(const benchmark::State& /*unused*/) {
16-
functor_called++;
17-
}
14+
void operator()(const benchmark::State& /*unused*/) { functor_called++; }
1815
};
1916

2017
class NullReporter : public BenchmarkReporter {
21-
public:
22-
bool ReportContext(const Context& /*context*/) override { return true; }
23-
void ReportRuns(const std::vector<Run>& /* report */) override {}
24-
};
18+
public:
19+
bool ReportContext(const Context& /*context*/) override { return true; }
20+
void ReportRuns(const std::vector<Run>& /* report */) override {}
21+
};
2522

2623
class BenchmarkTest : public testing::Test {
27-
public:
28-
Benchmark* bm;
29-
NullReporter null_reporter;
24+
public:
25+
Benchmark* bm;
26+
NullReporter null_reporter;
3027

31-
int setup_calls;
32-
int teardown_calls;
28+
int setup_calls;
29+
int teardown_calls;
3330

34-
void SetUp() override {
35-
setup_calls = 0;
36-
teardown_calls = 0;
37-
functor_called = 0;
31+
void SetUp() override {
32+
setup_calls = 0;
33+
teardown_calls = 0;
34+
functor_called = 0;
3835

39-
bm = RegisterBenchmark("BM", [](State& st){
40-
for(auto _ : st){
36+
bm = RegisterBenchmark("BM", [](State& st) {
37+
for(auto _ : st) {
4138
}
4239
});
4340
bm->Iterations(1);
4441
}
4542

46-
void TearDown() override {
47-
ClearRegisteredBenchmarks();
48-
}
43+
void TearDown() override { ClearRegisteredBenchmarks(); }
4944
};
5045

5146
// Test that Setup/Teardown can correctly take a lambda expressions
5247
TEST_F(BenchmarkTest, LambdaTestCopy) {
53-
auto setup_lambda = [this](const State&){ setup_calls++; };
54-
auto teardown_lambda = [this](const State&){ teardown_calls++; };
48+
auto setup_lambda = [this](const State&) { setup_calls++; };
49+
auto teardown_lambda = [this](const State&) { teardown_calls++; };
5550
bm->Setup(setup_lambda);
5651
bm->Teardown(teardown_lambda);
5752
RunSpecifiedBenchmarks(&null_reporter);
@@ -61,8 +56,8 @@ TEST_F(BenchmarkTest, LambdaTestCopy) {
6156

6257
// Test that Setup/Teardown can correctly take a lambda expressions
6358
TEST_F(BenchmarkTest, LambdaTestMove) {
64-
auto setup_lambda = [this](const State&){ setup_calls++; };
65-
auto teardown_lambda = [this](const State&){ teardown_calls++; };
59+
auto setup_lambda = [this](const State&) { setup_calls++; };
60+
auto teardown_lambda = [this](const State&) { teardown_calls++; };
6661
bm->Setup(std::move(setup_lambda));
6762
bm->Teardown(std::move(teardown_lambda));
6863
RunSpecifiedBenchmarks(&null_reporter);
@@ -72,8 +67,8 @@ TEST_F(BenchmarkTest, LambdaTestMove) {
7267

7368
// Test that Setup/Teardown can correctly take std::function
7469
TEST_F(BenchmarkTest, CallbackFunctionCopy) {
75-
callback_function setup_lambda = [this](const State&){ setup_calls++; };
76-
callback_function teardown_lambda = [this](const State&){ teardown_calls++; };
70+
callback_function setup_lambda = [this](const State&) { setup_calls++; };
71+
callback_function teardown_lambda = [this](const State&) { teardown_calls++; };
7772
bm->Setup(setup_lambda);
7873
bm->Teardown(teardown_lambda);
7974
RunSpecifiedBenchmarks(&null_reporter);
@@ -83,8 +78,8 @@ TEST_F(BenchmarkTest, CallbackFunctionCopy) {
8378

8479
// Test that Setup/Teardown can correctly take std::function
8580
TEST_F(BenchmarkTest, CallbackFunctionMove) {
86-
callback_function setup_lambda = [this](const State&){ setup_calls++; };
87-
callback_function teardown_lambda = [this](const State&){ teardown_calls++; };
81+
callback_function setup_lambda = [this](const State&) { setup_calls++; };
82+
callback_function teardown_lambda = [this](const State&) { teardown_calls++; };
8883
bm->Setup(std::move(setup_lambda));
8984
bm->Teardown(std::move(teardown_lambda));
9085
RunSpecifiedBenchmarks(&null_reporter);

0 commit comments

Comments
 (0)