PageRenderTime 57ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/branches/bwapi4/bwapi/TestAIModule/Source/TerranTest.cpp

http://bwapi.googlecode.com/
C++ | 201 lines | 193 code | 7 blank | 1 comment | 1 complexity | 6ca69cceb12de22db28de9878f8edf06 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-3.0
  1. #include "TerranTest.h"
  2. #include "TrainTest.h"
  3. #include "BuildTest.h"
  4. #include "ResearchTest.h"
  5. #include "UpgradeTest.h"
  6. #include "UseTechTest.h"
  7. #include "CancelResearchTest.h"
  8. #include "CancelUpgradeTest.h"
  9. #include "SiegeTest.h"
  10. #include "CloakTest.h"
  11. #include "LiftTest.h"
  12. #include "RallyTest.h"
  13. #include "MPHSTest.h"
  14. #include "TransportTest.h"
  15. #include "AttackMoveTest.h"
  16. #include "AttackUnitTest.h"
  17. #include "RepairTest.h"
  18. #include "FollowTest.h"
  19. #include "CancelTrainTest.h"
  20. #include "GatherTest.h"
  21. #include "CancelConstructionTest.h"
  22. #include "RightClickTest.h"
  23. using namespace std;
  24. using namespace BWAPI;
  25. void TerranTest::onStart()
  26. {
  27. BWAssert(Broodwar->isReplay()==false);
  28. Broodwar->enableFlag(Flag::CompleteMapInformation);
  29. Broodwar->setLocalSpeed(0);
  30. Broodwar->setFrameSkip(512);
  31. this->addTestCase(new LiftTest(UnitTypes::Terran_Command_Center));
  32. this->addTestCase(new TrainTest(UnitTypes::Terran_SCV));
  33. this->addTestCase(new RightClickTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Command_Center,UnitTypes::Terran_Command_Center));
  34. this->addTestCase(new MPHSTest(UnitTypes::Terran_SCV));
  35. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_SCV));
  36. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Command_Center));
  37. this->addTestCase(new RepairTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Command_Center));
  38. this->addTestCase(new FollowTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Command_Center));
  39. this->addTestCase(new RallyTest(UnitTypes::Terran_Command_Center));
  40. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Command_Center,true));
  41. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Command_Center));
  42. this->addTestCase(new BuildTest(UnitTypes::Terran_Command_Center));
  43. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Supply_Depot));
  44. this->addTestCase(new BuildTest(UnitTypes::Terran_Supply_Depot));
  45. this->addTestCase(new BuildTest(UnitTypes::Terran_Supply_Depot));
  46. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Refinery,true));
  47. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Refinery));
  48. this->addTestCase(new BuildTest(UnitTypes::Terran_Refinery));
  49. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Barracks));
  50. this->addTestCase(new BuildTest(UnitTypes::Terran_Barracks));
  51. this->addTestCase(new RallyTest(UnitTypes::Terran_Barracks));
  52. this->addTestCase(new GatherTest());
  53. this->addTestCase(new BuildTest(UnitTypes::Terran_Engineering_Bay));
  54. this->addTestCase(new BuildTest(UnitTypes::Terran_Missile_Turret));
  55. this->addTestCase(new BuildTest(UnitTypes::Terran_Academy));
  56. // Lan-low latency makes it to here without error
  57. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Marine,UnitTypes::Terran_Medic,UnitTypes::Terran_Firebat));
  58. this->addTestCase(new BuildTest(UnitTypes::Terran_Bunker));
  59. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Factory,true));
  60. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Factory));
  61. this->addTestCase(new BuildTest(UnitTypes::Terran_Factory));
  62. this->addTestCase(new RallyTest(UnitTypes::Terran_Factory));
  63. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Machine_Shop));
  64. this->addTestCase(new BuildTest(UnitTypes::Terran_Machine_Shop));
  65. this->addTestCase(new BuildTest(UnitTypes::Terran_Starport));
  66. this->addTestCase(new RallyTest(UnitTypes::Terran_Starport));
  67. this->addTestCase(new BuildTest(UnitTypes::Terran_Science_Facility));
  68. this->addTestCase(new BuildTest(UnitTypes::Terran_Science_Facility));
  69. this->addTestCase(new BuildTest(UnitTypes::Terran_Armory));
  70. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Vulture,UnitTypes::Terran_Siege_Tank_Tank_Mode,UnitTypes::Terran_Goliath));
  71. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Siege_Tank_Tank_Mode,UnitTypes::Terran_Goliath,UnitTypes::Terran_Vulture));
  72. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Goliath,UnitTypes::Terran_Vulture,UnitTypes::Terran_Siege_Tank_Tank_Mode));
  73. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Comsat_Station));
  74. this->addTestCase(new BuildTest(UnitTypes::Terran_Comsat_Station));
  75. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Control_Tower));
  76. this->addTestCase(new BuildTest(UnitTypes::Terran_Control_Tower));
  77. this->addTestCase(new CancelConstructionTest(UnitTypes::Terran_Physics_Lab));
  78. this->addTestCase(new BuildTest(UnitTypes::Terran_Physics_Lab));
  79. this->addTestCase(new BuildTest(UnitTypes::Terran_Covert_Ops));
  80. this->addTestCase(new BuildTest(UnitTypes::Terran_Nuclear_Silo));
  81. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Firebat,UnitTypes::Terran_Marine,UnitTypes::Terran_Ghost));
  82. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Wraith,UnitTypes::Terran_Dropship,UnitTypes::Terran_Science_Vessel));
  83. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Battlecruiser,UnitTypes::Terran_Valkyrie,UnitTypes::Terran_Science_Vessel));
  84. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Battlecruiser,UnitTypes::Terran_Valkyrie,UnitTypes::Terran_Science_Vessel));
  85. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Valkyrie,UnitTypes::Terran_Science_Vessel,UnitTypes::Terran_Battlecruiser));
  86. this->addTestCase(new CancelTrainTest(UnitTypes::Terran_Science_Vessel,UnitTypes::Terran_Battlecruiser,UnitTypes::Terran_Valkyrie));
  87. this->addTestCase(new TrainTest(UnitTypes::Terran_Marine));
  88. this->addTestCase(new MPHSTest(UnitTypes::Terran_Marine));
  89. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Marine));
  90. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Marine,UnitTypes::Terran_Barracks));
  91. this->addTestCase(new TrainTest(UnitTypes::Terran_Firebat));
  92. this->addTestCase(new MPHSTest(UnitTypes::Terran_Firebat));
  93. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Firebat));
  94. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Firebat,UnitTypes::Terran_Barracks));
  95. this->addTestCase(new TrainTest(UnitTypes::Terran_Ghost));
  96. this->addTestCase(new MPHSTest(UnitTypes::Terran_Ghost));
  97. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Ghost));
  98. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Ghost,UnitTypes::Terran_Barracks));
  99. this->addTestCase(new RepairTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Barracks));
  100. this->addTestCase(new TrainTest(UnitTypes::Terran_Medic));
  101. this->addTestCase(new MPHSTest(UnitTypes::Terran_Medic));
  102. this->addTestCase(new TrainTest(UnitTypes::Terran_Vulture));
  103. this->addTestCase(new MPHSTest(UnitTypes::Terran_Vulture));
  104. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Vulture));
  105. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Vulture,UnitTypes::Terran_Factory));
  106. this->addTestCase(new FollowTest(UnitTypes::Terran_Marine,UnitTypes::Terran_Vulture));
  107. this->addTestCase(new TrainTest(UnitTypes::Terran_Siege_Tank_Tank_Mode));
  108. this->addTestCase(new MPHSTest(UnitTypes::Terran_Siege_Tank_Tank_Mode));
  109. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Siege_Tank_Tank_Mode));
  110. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Siege_Tank_Tank_Mode,UnitTypes::Terran_Factory));
  111. this->addTestCase(new FollowTest(UnitTypes::Terran_Firebat,UnitTypes::Terran_Siege_Tank_Tank_Mode));
  112. this->addTestCase(new TrainTest(UnitTypes::Terran_Goliath));
  113. this->addTestCase(new MPHSTest(UnitTypes::Terran_Goliath));
  114. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Goliath));
  115. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Goliath,UnitTypes::Terran_Factory));
  116. this->addTestCase(new FollowTest(UnitTypes::Terran_Ghost,UnitTypes::Terran_Goliath));
  117. this->addTestCase(new RepairTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Factory));
  118. this->addTestCase(new TrainTest(UnitTypes::Terran_Wraith));
  119. this->addTestCase(new MPHSTest(UnitTypes::Terran_Wraith));
  120. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Wraith));
  121. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Wraith,UnitTypes::Terran_Starport));
  122. this->addTestCase(new FollowTest(UnitTypes::Terran_Vulture,UnitTypes::Terran_Wraith));
  123. this->addTestCase(new TrainTest(UnitTypes::Terran_Dropship));
  124. this->addTestCase(new MPHSTest(UnitTypes::Terran_Dropship));
  125. this->addTestCase(new FollowTest(UnitTypes::Terran_Siege_Tank_Tank_Mode,UnitTypes::Terran_Dropship));
  126. this->addTestCase(new TrainTest(UnitTypes::Terran_Science_Vessel));
  127. this->addTestCase(new MPHSTest(UnitTypes::Terran_Science_Vessel));
  128. this->addTestCase(new FollowTest(UnitTypes::Terran_Goliath,UnitTypes::Terran_Science_Vessel));
  129. this->addTestCase(new TrainTest(UnitTypes::Terran_Battlecruiser));
  130. this->addTestCase(new MPHSTest(UnitTypes::Terran_Battlecruiser));
  131. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Battlecruiser));
  132. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Battlecruiser,UnitTypes::Terran_Starport));
  133. this->addTestCase(new RepairTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Starport));
  134. this->addTestCase(new TrainTest(UnitTypes::Terran_Valkyrie));
  135. this->addTestCase(new MPHSTest(UnitTypes::Terran_Valkyrie));
  136. this->addTestCase(new AttackMoveTest(UnitTypes::Terran_Valkyrie));
  137. this->addTestCase(new AttackUnitTest(UnitTypes::Terran_Valkyrie,UnitTypes::Terran_Battlecruiser));
  138. this->addTestCase(new RepairTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Battlecruiser));
  139. this->addTestCase(new FollowTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Marine));
  140. this->addTestCase(new FollowTest(UnitTypes::Terran_SCV,UnitTypes::Terran_Armory));
  141. this->addTestCase(new TrainTest(UnitTypes::Terran_Nuclear_Missile));
  142. this->addTestCase(new TransportTest(UnitTypes::Terran_Dropship));
  143. this->addTestCase(new TransportTest(UnitTypes::Terran_Bunker));
  144. this->addTestCase(new CancelResearchTest(TechTypes::Stim_Packs));
  145. this->addTestCase(new ResearchTest(TechTypes::Stim_Packs));
  146. this->addTestCase(new CancelResearchTest(TechTypes::Optical_Flare));
  147. this->addTestCase(new ResearchTest(TechTypes::Optical_Flare));
  148. this->addTestCase(new CancelResearchTest(TechTypes::Restoration));
  149. this->addTestCase(new ResearchTest(TechTypes::Restoration));
  150. this->addTestCase(new ResearchTest(TechTypes::Spider_Mines));
  151. this->addTestCase(new ResearchTest(TechTypes::Tank_Siege_Mode));
  152. this->addTestCase(new ResearchTest(TechTypes::Cloaking_Field));
  153. this->addTestCase(new ResearchTest(TechTypes::EMP_Shockwave));
  154. this->addTestCase(new ResearchTest(TechTypes::Irradiate));
  155. this->addTestCase(new ResearchTest(TechTypes::Lockdown));
  156. this->addTestCase(new ResearchTest(TechTypes::Personnel_Cloaking));
  157. this->addTestCase(new ResearchTest(TechTypes::Yamato_Gun));
  158. this->addTestCase(new SiegeTest());
  159. this->addTestCase(new CloakTest(UnitTypes::Terran_Ghost));
  160. this->addTestCase(new CloakTest(UnitTypes::Terran_Wraith));
  161. this->addTestCase(new UseTechTest(TechTypes::Scanner_Sweep));
  162. this->addTestCase(new UseTechTest(TechTypes::Stim_Packs));
  163. this->addTestCase(new UseTechTest(TechTypes::Optical_Flare));
  164. this->addTestCase(new UseTechTest(TechTypes::Defensive_Matrix));
  165. this->addTestCase(new UseTechTest(TechTypes::Restoration));
  166. this->addTestCase(new UseTechTest(TechTypes::Spider_Mines));
  167. this->addTestCase(new UseTechTest(TechTypes::EMP_Shockwave));
  168. this->addTestCase(new UseTechTest(TechTypes::Lockdown));
  169. this->addTestCase(new UseTechTest(TechTypes::Yamato_Gun));
  170. this->addTestCase(new UseTechTest(TechTypes::Irradiate));
  171. this->addTestCase(new UseTechTest(TechTypes::Nuclear_Strike));
  172. this->addTestCase(new UpgradeTest(UpgradeTypes::U_238_Shells));
  173. this->addTestCase(new CancelUpgradeTest(UpgradeTypes::Caduceus_Reactor));
  174. this->addTestCase(new UpgradeTest(UpgradeTypes::Caduceus_Reactor));
  175. this->addTestCase(new CancelUpgradeTest(UpgradeTypes::Ion_Thrusters));
  176. this->addTestCase(new UpgradeTest(UpgradeTypes::Ion_Thrusters));
  177. this->addTestCase(new CancelUpgradeTest(UpgradeTypes::Charon_Boosters));
  178. this->addTestCase(new UpgradeTest(UpgradeTypes::Charon_Boosters));
  179. this->addTestCase(new UpgradeTest(UpgradeTypes::Apollo_Reactor));
  180. this->addTestCase(new UpgradeTest(UpgradeTypes::Titan_Reactor));
  181. this->addTestCase(new UpgradeTest(UpgradeTypes::Ocular_Implants));
  182. this->addTestCase(new UpgradeTest(UpgradeTypes::Moebius_Reactor));
  183. this->addTestCase(new UpgradeTest(UpgradeTypes::Colossus_Reactor));
  184. for(int l=0;l<3;l++)
  185. {
  186. this->addTestCase(new CancelUpgradeTest(UpgradeTypes::Terran_Infantry_Weapons));
  187. this->addTestCase(new UpgradeTest(UpgradeTypes::Terran_Infantry_Weapons));
  188. this->addTestCase(new UpgradeTest(UpgradeTypes::Terran_Infantry_Armor));
  189. this->addTestCase(new UpgradeTest(UpgradeTypes::Terran_Vehicle_Weapons));
  190. this->addTestCase(new UpgradeTest(UpgradeTypes::Terran_Ship_Weapons));
  191. this->addTestCase(new UpgradeTest(UpgradeTypes::Terran_Vehicle_Plating));
  192. this->addTestCase(new UpgradeTest(UpgradeTypes::Terran_Ship_Plating));
  193. }
  194. }