Comment all the tests
This commit is contained in:
parent
7e2fd0a8d1
commit
50ed84c1bd
1 changed files with 12 additions and 9 deletions
|
@ -6,19 +6,15 @@
|
||||||
|
|
||||||
const char* tests()
|
const char* tests()
|
||||||
{
|
{
|
||||||
{
|
// Test if we can properly set a unit's visual
|
||||||
CBoard board = CBoard(10,5);
|
|
||||||
board.clear();
|
|
||||||
board.fill(48);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
CUnit unit;
|
CUnit unit;
|
||||||
unit.setFromVisual('v');
|
unit.setFromVisual('v');
|
||||||
if( unit.getVisual() != 118 )
|
if( unit.getVisual() != 'v' )
|
||||||
return "failed to properly create V unit";
|
return "failed to properly create V unit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test unique unit IDs
|
||||||
{
|
{
|
||||||
CUnit unit;
|
CUnit unit;
|
||||||
CUnit unit2;
|
CUnit unit2;
|
||||||
|
@ -26,12 +22,14 @@ const char* tests()
|
||||||
return "Unit IDs the same";
|
return "Unit IDs the same";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if we can successfully create a unit from a visual
|
||||||
{
|
{
|
||||||
CUnit unit = CUnit::getUnitFromVis('v');
|
CUnit unit = CUnit::getUnitFromVis('v');
|
||||||
if( unit.getVisual() != 'v' )
|
if( unit.getVisual() != 'v' )
|
||||||
return "failed to properly create V unit with factory";
|
return "failed to properly create V unit with factory";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if we can successfully convert orders back and forth
|
||||||
{
|
{
|
||||||
COrder order;
|
COrder order;
|
||||||
order.order = order_c::F;
|
order.order = order_c::F;
|
||||||
|
@ -43,6 +41,7 @@ const char* tests()
|
||||||
return "failed order string conversion test";
|
return "failed order string conversion test";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if movement order is correctly recognised
|
||||||
{
|
{
|
||||||
COrder order;
|
COrder order;
|
||||||
order.order = order_c::F;
|
order.order = order_c::F;
|
||||||
|
@ -53,6 +52,7 @@ const char* tests()
|
||||||
return "Wrongly detected an action order";
|
return "Wrongly detected an action order";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if Attack order is correctly recognised
|
||||||
{
|
{
|
||||||
COrder order;
|
COrder order;
|
||||||
order.order = order_c::A;
|
order.order = order_c::A;
|
||||||
|
@ -63,6 +63,7 @@ const char* tests()
|
||||||
return "Wrongly detected an movement order";
|
return "Wrongly detected an movement order";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test of the game can logically handle a blank game
|
||||||
{
|
{
|
||||||
CTTRTSGame game( 15, 10 );
|
CTTRTSGame game( 15, 10 );
|
||||||
if( game.SimulateToNextTurn() )
|
if( game.SimulateToNextTurn() )
|
||||||
|
@ -72,6 +73,7 @@ const char* tests()
|
||||||
return "Game started with non-zero unit number";
|
return "Game started with non-zero unit number";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if the game correctly rejects units placed ontop of others
|
||||||
{
|
{
|
||||||
CTTRTSGame game( 5, 5 );
|
CTTRTSGame game( 5, 5 );
|
||||||
|
|
||||||
|
@ -96,6 +98,7 @@ const char* tests()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test on a small board if a movement command succeeds correctly
|
||||||
{
|
{
|
||||||
CTTRTSGame game( 5, 5 );
|
CTTRTSGame game( 5, 5 );
|
||||||
|
|
||||||
|
@ -123,6 +126,7 @@ const char* tests()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test on a tiny board, whether a unit can correctly attack another
|
||||||
{
|
{
|
||||||
CTTRTSGame game( 2, 1 );
|
CTTRTSGame game( 2, 1 );
|
||||||
|
|
||||||
|
@ -166,8 +170,7 @@ const char* tests()
|
||||||
return "Game killed the wrong unit";
|
return "Game killed the wrong unit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main program entry point
|
// Main program entry point
|
||||||
|
|
Loading…
Add table
Reference in a new issue