mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +02:00
Added checks fro terrain
This commit is contained in:
parent
6552acdff6
commit
b828f8fa9b
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
#define VCMI_CHECK_FIELD_EQUAL(field) BOOST_CHECK_EQUAL(actual.field, expected.field)
|
#define VCMI_CHECK_FIELD_EQUAL(field) BOOST_CHECK_EQUAL(actual.field, expected.field)
|
||||||
|
|
||||||
#define VCMI_REQUIRE_FIELD_EQUAL(field) BOOST_REQUIRE_EQUAL(actual->field, expected->field)
|
#define VCMI_REQUIRE_FIELD_EQUAL_P(field) BOOST_REQUIRE_EQUAL(actual->field, expected->field)
|
||||||
|
#define VCMI_REQUIRE_FIELD_EQUAL(field) BOOST_REQUIRE_EQUAL(actual.field, expected.field)
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void checkEqual(const T & actual, const T & expected)
|
void checkEqual(const T & actual, const T & expected)
|
||||||
@ -88,12 +89,24 @@ void checkEqual(const TriggeredEvent & actual, const TriggeredEvent & expected)
|
|||||||
checkEqual(actual.trigger, expected.trigger);
|
checkEqual(actual.trigger, expected.trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkEqual(const TerrainTile & actual, const TerrainTile & expected)
|
||||||
|
{
|
||||||
|
//fatal fail here on any error
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(terType);
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(terView);
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(riverType);
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(riverDir);
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(roadType);
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(roadDir);
|
||||||
|
VCMI_REQUIRE_FIELD_EQUAL(extTileFlags);
|
||||||
|
}
|
||||||
|
|
||||||
void MapComparer::compareHeader()
|
void MapComparer::compareHeader()
|
||||||
{
|
{
|
||||||
//map size parameters are vital for further checks
|
//map size parameters are vital for further checks
|
||||||
VCMI_REQUIRE_FIELD_EQUAL(height);
|
VCMI_REQUIRE_FIELD_EQUAL_P(height);
|
||||||
VCMI_REQUIRE_FIELD_EQUAL(width);
|
VCMI_REQUIRE_FIELD_EQUAL_P(width);
|
||||||
VCMI_REQUIRE_FIELD_EQUAL(twoLevel);
|
VCMI_REQUIRE_FIELD_EQUAL_P(twoLevel);
|
||||||
|
|
||||||
VCMI_CHECK_FIELD_EQUAL_P(name);
|
VCMI_CHECK_FIELD_EQUAL_P(name);
|
||||||
VCMI_CHECK_FIELD_EQUAL_P(description);
|
VCMI_CHECK_FIELD_EQUAL_P(description);
|
||||||
@ -121,17 +134,27 @@ void MapComparer::compareOptions()
|
|||||||
//allowedArtifact
|
//allowedArtifact
|
||||||
//allowedAbilities
|
//allowedAbilities
|
||||||
|
|
||||||
BOOST_ERROR("Not implemented");
|
BOOST_ERROR("Not implemented compareOptions()");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapComparer::compareObjects()
|
void MapComparer::compareObjects()
|
||||||
{
|
{
|
||||||
BOOST_ERROR("Not implemented");
|
BOOST_ERROR("Not implemented compareObjects()");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapComparer::compareTerrain()
|
void MapComparer::compareTerrain()
|
||||||
{
|
{
|
||||||
BOOST_ERROR("Not implemented");
|
//assume map dimensions check passed
|
||||||
|
//todo: separate check for underground
|
||||||
|
|
||||||
|
for(int x = 0; x < expected->width; x++)
|
||||||
|
for(int y = 0; y < expected->height; y++)
|
||||||
|
{
|
||||||
|
int3 coord(x,y,0);
|
||||||
|
BOOST_TEST_CHECKPOINT(coord);
|
||||||
|
|
||||||
|
checkEqual(actual->getTile(coord), expected->getTile(coord));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapComparer::compare()
|
void MapComparer::compare()
|
||||||
|
@ -27,13 +27,13 @@
|
|||||||
<Depends filename="lib/VCMI_lib.cbp" />
|
<Depends filename="lib/VCMI_lib.cbp" />
|
||||||
</Project>
|
</Project>
|
||||||
<Project filename="test/Test.cbp">
|
<Project filename="test/Test.cbp">
|
||||||
|
<Depends filename="lib/VCMI_lib.cbp" />
|
||||||
|
<Depends filename="client/VCMI_client.cbp" />
|
||||||
<Depends filename="server/VCMI_server.cbp" />
|
<Depends filename="server/VCMI_server.cbp" />
|
||||||
<Depends filename="AI/EmptyAI/EmptyAI.cbp" />
|
<Depends filename="AI/EmptyAI/EmptyAI.cbp" />
|
||||||
<Depends filename="AI/VCAI/VCAI.cbp" />
|
<Depends filename="AI/VCAI/VCAI.cbp" />
|
||||||
<Depends filename="AI/StupidAI/StupidAI.cbp" />
|
<Depends filename="AI/StupidAI/StupidAI.cbp" />
|
||||||
<Depends filename="AI/BattleAI/BattleAI.cbp" />
|
<Depends filename="AI/BattleAI/BattleAI.cbp" />
|
||||||
<Depends filename="lib/VCMI_lib.cbp" />
|
|
||||||
<Depends filename="client/VCMI_client.cbp" />
|
|
||||||
</Project>
|
</Project>
|
||||||
<Project filename="scripting/erm/ERM.cbp">
|
<Project filename="scripting/erm/ERM.cbp">
|
||||||
<Depends filename="lib/VCMI_lib.cbp" />
|
<Depends filename="lib/VCMI_lib.cbp" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user