00001
00002
00003
00004
00005
00006
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