From 50ed84c1bde34b46e2e9ec1f494d147b236e048c Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Tue, 16 Dec 2014 13:13:02 +0000 Subject: [PATCH] Comment all the tests --- test/test.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 96ac285..2df8aeb 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -6,19 +6,15 @@ const char* tests() { - { - CBoard board = CBoard(10,5); - board.clear(); - board.fill(48); - } - + // Test if we can properly set a unit's visual { CUnit unit; unit.setFromVisual('v'); - if( unit.getVisual() != 118 ) + if( unit.getVisual() != 'v' ) return "failed to properly create V unit"; } + // Test unique unit IDs { CUnit unit; CUnit unit2; @@ -26,12 +22,14 @@ const char* tests() return "Unit IDs the same"; } + // Test if we can successfully create a unit from a visual { CUnit unit = CUnit::getUnitFromVis('v'); if( unit.getVisual() != 'v' ) return "failed to properly create V unit with factory"; } + // Test if we can successfully convert orders back and forth { COrder order; order.order = order_c::F; @@ -43,6 +41,7 @@ const char* tests() return "failed order string conversion test"; } + // Test if movement order is correctly recognised { COrder order; order.order = order_c::F; @@ -53,6 +52,7 @@ const char* tests() return "Wrongly detected an action order"; } + // Test if Attack order is correctly recognised { COrder order; order.order = order_c::A; @@ -63,6 +63,7 @@ const char* tests() return "Wrongly detected an movement order"; } + // Test of the game can logically handle a blank game { CTTRTSGame game( 15, 10 ); if( game.SimulateToNextTurn() ) @@ -72,6 +73,7 @@ const char* tests() return "Game started with non-zero unit number"; } + // Test if the game correctly rejects units placed ontop of others { 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 ); @@ -123,6 +126,7 @@ const char* tests() } + // Test on a tiny board, whether a unit can correctly attack another { CTTRTSGame game( 2, 1 ); @@ -166,8 +170,7 @@ const char* tests() return "Game killed the wrong unit"; } - - return nullptr; + return 0; } // Main program entry point