-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from NiskuT/improvement-27
[improvement-27] Add test for shared elements
- Loading branch information
Showing
10 changed files
with
230 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( BarbarianTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( constructorAndGetters ) | ||
{ | ||
shared::Barbarian barbarian; | ||
|
||
shared::ElementEnum type = barbarian.getType(); | ||
BOOST_CHECK(type == shared::ElementEnum::barbarian); | ||
BOOST_CHECK(barbarian.isAlive == true); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( kill ) | ||
{ | ||
shared::Barbarian barbarian; | ||
barbarian.kill(); | ||
BOOST_CHECK(barbarian.isAlive == false); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( BarbarianVillageTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( constructorAndGetters ) | ||
{ | ||
shared::BarbarianVillage village; | ||
|
||
shared::ElementEnum type = village.getType(); | ||
BOOST_CHECK(type == shared::ElementEnum::barbarianVillage); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( CardTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( constructorAndGetters ) | ||
{ | ||
shared::Card card(shared::CardsEnum::science); | ||
|
||
shared::CardsEnum type = card.getType(); | ||
BOOST_CHECK(type == shared::CardsEnum::science); | ||
BOOST_CHECK(card.getLevel() == 1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( boxAndDifficulty ) | ||
{ | ||
shared::Card card(shared::CardsEnum::science); | ||
|
||
BOOST_CHECK(card.getNumberOfBox() == 0); | ||
card.addBox(2); | ||
BOOST_CHECK(card.getNumberOfBox() == 2); | ||
card.removeBox(1); | ||
BOOST_CHECK(card.getNumberOfBox() == 1); | ||
|
||
card.setDificulty(3); | ||
BOOST_CHECK(card.getDificulty() == 3); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( CityTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( constructorAndGetters ) | ||
{ | ||
shared::City city({20, 15}); | ||
|
||
BOOST_CHECK(city.getPosition()[0] == 20); | ||
BOOST_CHECK(city.getPosition()[1] == 15); | ||
|
||
shared::ElementEnum type = city.getType(); | ||
BOOST_CHECK(type == shared::ElementEnum::city); | ||
|
||
BOOST_CHECK(city.isMature == false); | ||
BOOST_CHECK(city.isCapital == false); | ||
BOOST_CHECK(city.isStateCity == false); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( setStateCity ) | ||
{ | ||
shared::City city({0, 0}); | ||
city.setStateCity(shared::CityStateEnum::mohenjoDaro); | ||
|
||
BOOST_CHECK(city.stateCityType == shared::CityStateEnum::mohenjoDaro); | ||
BOOST_CHECK(city.isStateCity == true); | ||
|
||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( ControlPawnTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( constructorAndGetters ) | ||
{ | ||
shared::ControlPawn pawn({20, 15}); | ||
|
||
BOOST_CHECK(pawn.getPosition()[0] == 20); | ||
BOOST_CHECK(pawn.getPosition()[1] == 15); | ||
BOOST_CHECK(pawn.isReinforced() == false); | ||
|
||
shared::ElementEnum type = pawn.getType(); | ||
BOOST_CHECK(type == shared::ElementEnum::controlPawn); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( setReinforced ) | ||
{ | ||
shared::ControlPawn pawn({0, 0}); | ||
pawn.setReinforced(); | ||
BOOST_CHECK(pawn.isReinforced() == true); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( HexagonTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( constructorAndGetters ) | ||
{ | ||
shared::Hexagon hexagon; | ||
|
||
BOOST_CHECK(hexagon.getFieldLevel() == shared::FieldLevel::Grassland); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( setFieldType ) | ||
{ | ||
shared::Hexagon hexagon; | ||
|
||
hexagon.setFieldType(shared::FieldLevel::WonderMessa); | ||
|
||
BOOST_CHECK(hexagon.getFieldLevel() == shared::FieldLevel::WonderMessa); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( manageElements ) | ||
{ | ||
shared::Hexagon hexagon; | ||
|
||
BOOST_CHECK(hexagon.getElements().size() == 0); | ||
|
||
std::shared_ptr<shared::Caravan> caravan1 = std::make_shared<shared::Caravan>(); | ||
std::variant<shared::Caravan, shared::Barbarian, shared::BarbarianVillage, shared::ControlPawn, shared::City> element1 = *caravan1; | ||
hexagon.addElement(std::make_shared<std::variant<shared::Caravan, shared::Barbarian, shared::BarbarianVillage, shared::ControlPawn, shared::City>>(element1)); | ||
|
||
BOOST_CHECK(hexagon.getElements().size() == 1); | ||
|
||
std::shared_ptr<shared::Caravan> caravan2 = std::make_shared<shared::Caravan>(); | ||
std::variant<shared::Caravan, shared::Barbarian, shared::BarbarianVillage, shared::ControlPawn, shared::City> element2 = *caravan2; | ||
hexagon.addElement(std::make_shared<std::variant<shared::Caravan, shared::Barbarian, shared::BarbarianVillage, shared::ControlPawn, shared::City>>(element2)); | ||
|
||
BOOST_CHECK(hexagon.getElements().size() == 2); | ||
|
||
hexagon.removeElement(hexagon.getElements()[0]); | ||
|
||
BOOST_CHECK(hexagon.getElements().size() == 1); | ||
|
||
hexagon.clearElement(); | ||
|
||
BOOST_CHECK(hexagon.getElements().size() == 0); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <shared.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_SUITE( MapTest ) | ||
|
||
BOOST_AUTO_TEST_CASE(TestStaticAssert) | ||
{ | ||
BOOST_CHECK(1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( all ) | ||
{ | ||
shared::Resource resource(shared::ResourceEnum::stone); | ||
|
||
BOOST_CHECK(resource.getType() == shared::ResourceEnum::stone); | ||
resource.isAlive = true; | ||
resource.picked(); | ||
BOOST_CHECK(resource.isAlive == false); | ||
|
||
|
||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters