actiontest.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  ***************************************************************************/
00009 
00010 
00011 #include "../actions/moveunitcommand.h"
00012 #include "../loaders.h"
00013 #include "../itemrepository.h"
00014 #include "unittestutil.h"
00015 
00016 
00017 void testActions() 
00018 {
00019    auto_ptr<GameMap> game ( startMap("unittest-movement.map"));
00020    
00021    Vehicle* veh = game->getField(0,0)->vehicle;
00022    assertOrThrow( veh->getMovement() == 100 );
00023    
00024    
00025    move(veh, MapCoordinate(0,1));   
00026    move(veh, MapCoordinate(1,2));   
00027    move(veh, MapCoordinate(1,3));   
00028    move(veh, MapCoordinate(2,4));   
00029    move(veh, MapCoordinate(2,5));   
00030    move(veh, MapCoordinate(3,6));   
00031    move(veh, MapCoordinate(3,7));   
00032    move(veh, MapCoordinate(4,8));   
00033    move(veh, MapCoordinate(4,9));   
00034    move(veh, MapCoordinate(5,10));   
00035    
00036    for ( int i = 0; i < 5; ++i )  {
00037       ActionResult res = game->actions.rerun( createTestingContext( game.get() ) );  
00038       assertOrThrow( res.successful() );
00039    }
00040   
00041 }
00042 

Generated on Mon May 14 01:31:39 2012 for Advanced Strategic Command by  doxygen 1.5.1