Skip to content

Commit

Permalink
style(tests): automatic reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjp committed Jan 23, 2023
1 parent adec433 commit 74905d0
Show file tree
Hide file tree
Showing 17 changed files with 1,292 additions and 437 deletions.
14 changes: 10 additions & 4 deletions test/unit-kami-agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@
using namespace kami;
using namespace std;

class TestAgent : public Agent {
class TestAgent
: public Agent {
public:
AgentID step(shared_ptr<Model> model) override {
return get_agent_id();
}
};

class TestModel : public Model {
class TestModel
: public Model {
};

class AgentTest : public ::testing::Test {
class AgentTest
: public ::testing::Test {
protected:
TestAgent agent_foo;
TestAgent agent_bar;
Expand Down Expand Up @@ -87,7 +90,10 @@ TEST_F(AgentTest, inequality) {
EXPECT_FALSE(agent_bar != agent_bar);
}

int main(int argc, char **argv) {
int main(
int argc,
char** argv
) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Expand Down
8 changes: 6 additions & 2 deletions test/unit-kami-agentid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

using namespace kami;

class AgentIDTest : public ::testing::Test {
class AgentIDTest
: public ::testing::Test {
protected:
AgentID agent_id_foo;
AgentID agent_id_bar;
Expand Down Expand Up @@ -62,7 +63,10 @@ TEST_F(AgentIDTest, ordering) {
EXPECT_FALSE(agent_id_bar < agent_id_foo);
}

int main(int argc, char **argv) {
int main(
int argc,
char** argv
) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Expand Down
8 changes: 6 additions & 2 deletions test/unit-kami-gridcoord1d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

using namespace kami;

class GridCoord1DTest : public ::testing::Test {
class GridCoord1DTest
: public ::testing::Test {
protected:
GridCoord1D gridcoord1d_foo = GridCoord1D(0);
GridCoord1D gridcoord1d_bar = GridCoord1D(1);
Expand Down Expand Up @@ -84,7 +85,10 @@ TEST_F(GridCoord1DTest, x) {
EXPECT_FALSE(gridcoord1d_bar.x() == gridcoord1d_baz.x());
}

int main(int argc, char **argv) {
int main(
int argc,
char** argv
) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Expand Down
8 changes: 6 additions & 2 deletions test/unit-kami-gridcoord2d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

using namespace kami;

class GridCoord2DTest : public ::testing::Test {
class GridCoord2DTest
: public ::testing::Test {
protected:
GridCoord2D gridcoord2d_foo = GridCoord2D(0, 0);
GridCoord2D gridcoord2d_bar = GridCoord2D(1, 1);
Expand Down Expand Up @@ -145,7 +146,10 @@ TEST_F(GridCoord2DTest, y) {
EXPECT_FALSE(gridcoord2d_bar.y() == gridcoord2d_qu2.y());
}

int main(int argc, char **argv) {
int main(
int argc,
char** argv
) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
11 changes: 8 additions & 3 deletions test/unit-kami-model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ using namespace kami;
using namespace kami::error;
using namespace std;

class TestAgent : public Agent {
class TestAgent
: public Agent {
public:
AgentID step(shared_ptr<Model> model) override {
return get_agent_id();
}
};

class TestModel : public Model {
class TestModel
: public Model {
public:
shared_ptr<Model> step() final {
return shared_from_this();
Expand Down Expand Up @@ -127,7 +129,10 @@ TEST(Model, get_domain) {
EXPECT_EQ(grid2_bar, grid2_baz);
}

int main(int argc, char **argv) {
int main(
int argc,
char** argv
) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Expand Down
81 changes: 61 additions & 20 deletions test/unit-kami-multigrid1d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,78 +224,98 @@ TEST(MultiGrid1D, get_neighborhood) {
{
MultiGrid1D multigrid1d_foo(10, true);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord9 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord9
});
auto rval = multigrid1d_foo.get_neighborhood(coord0, true);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, true);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(coord1, true);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, false);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1
});
auto rval = multigrid1d_foo.get_neighborhood(coord0, true);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, false);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(coord1, true);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, true);

auto tval = unordered_set < GridCoord1D > ({ coord1, coord9 });
auto tval = unordered_set < GridCoord1D > ({
coord1, coord9
});
auto rval = multigrid1d_foo.get_neighborhood(coord0, false);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, true);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(coord1, false);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, false);

auto tval = unordered_set < GridCoord1D > ({ coord1 });
auto tval = unordered_set < GridCoord1D > ({
coord1
});
auto rval = multigrid1d_foo.get_neighborhood(coord0, false);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, false);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(coord1, false);

EXPECT_EQ(tval, *rval);
}
{
MultiGrid1D multigrid1d_foo(10, true);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord9 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord9
});

EXPECT_THROW(auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, true), AgentNotFound);
}
{
MultiGrid1D multigrid1d_foo(10, true);
multigrid1d_foo.add_agent(agent_id_foo, coord0);
auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord9 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord9
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, true);

EXPECT_EQ(tval, *rval);
Expand All @@ -304,7 +324,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, true);
multigrid1d_foo.add_agent(agent_id_foo, coord1);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, true);

EXPECT_EQ(tval, *rval);
Expand All @@ -313,7 +335,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, false);
multigrid1d_foo.add_agent(agent_id_foo, coord0);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, true);

EXPECT_EQ(tval, *rval);
Expand All @@ -322,7 +346,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, false);
multigrid1d_foo.add_agent(agent_id_foo, coord1);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord1, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord1, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, true);

EXPECT_EQ(tval, *rval);
Expand All @@ -331,7 +357,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, true);
multigrid1d_foo.add_agent(agent_id_foo, coord0);

auto tval = unordered_set < GridCoord1D > ({ coord1, coord9 });
auto tval = unordered_set < GridCoord1D > ({
coord1, coord9
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, false);

EXPECT_EQ(tval, *rval);
Expand All @@ -340,7 +368,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, true);
multigrid1d_foo.add_agent(agent_id_foo, coord1);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, false);

EXPECT_EQ(tval, *rval);
Expand All @@ -349,7 +379,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, false);
multigrid1d_foo.add_agent(agent_id_foo, coord0);

auto tval = unordered_set < GridCoord1D > ({ coord1 });
auto tval = unordered_set < GridCoord1D > ({
coord1
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, false);

EXPECT_EQ(tval, *rval);
Expand All @@ -358,7 +390,9 @@ TEST(MultiGrid1D, get_neighborhood) {
MultiGrid1D multigrid1d_foo(10, false);
multigrid1d_foo.add_agent(agent_id_foo, coord1);

auto tval = unordered_set < GridCoord1D > ({ coord0, coord2 });
auto tval = unordered_set < GridCoord1D > ({
coord0, coord2
});
auto rval = multigrid1d_foo.get_neighborhood(agent_id_foo, false);

EXPECT_EQ(tval, *rval);
Expand Down Expand Up @@ -407,7 +441,9 @@ TEST(MultiGrid1D, get_location_contents) {
static_cast<void>(multigrid1d_foo.add_agent(agent_id_bar, coord1));
static_cast<void>(multigrid1d_foo.add_agent(agent_id_baz, coord1));

auto tval = set < AgentID > ({ agent_id_foo, agent_id_bar, agent_id_baz });
auto tval = set < AgentID > ({
agent_id_foo, agent_id_bar, agent_id_baz
});
auto rval = multigrid1d_foo.get_location_contents(coord1);

EXPECT_TRUE(rval);
Expand All @@ -419,15 +455,20 @@ TEST(MultiGrid1D, get_location_contents) {
static_cast<void>(multigrid1d_foo.add_agent(agent_id_bar, coord1));
static_cast<void>(multigrid1d_foo.add_agent(agent_id_baz, coord9));

auto tval = set < AgentID > ({ agent_id_foo, agent_id_bar });
auto tval = set < AgentID > ({
agent_id_foo, agent_id_bar
});
auto rval = multigrid1d_foo.get_location_contents(coord1);

EXPECT_TRUE(rval);
EXPECT_EQ(tval, *rval);
}
}

int main(int argc, char **argv) {
int main(
int argc,
char** argv
) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Expand Down
Loading

0 comments on commit 74905d0

Please sign in to comment.