Search in sources :

Example 31 with IntegerMap

use of games.strategy.util.IntegerMap in project triplea by triplea-game.

the class PlaceDelegateTest method testCanProduceInSea.

@Test
public void testCanProduceInSea() {
    final IntegerMap<UnitType> map = new IntegerMap<>();
    map.add(transport, 2);
    final PlaceableUnits response = delegate.getPlaceableUnits(GameDataTestUtil.getUnits(map, british), northSea);
    assertFalse(response.isError());
}
Also used : IntegerMap(games.strategy.util.IntegerMap) PlaceableUnits(games.strategy.triplea.delegate.dataObjects.PlaceableUnits) UnitType(games.strategy.engine.data.UnitType) Test(org.junit.jupiter.api.Test)

Example 32 with IntegerMap

use of games.strategy.util.IntegerMap in project triplea by triplea-game.

the class VictoryTest method testPuOnlyResourcesToPurchase.

@Test
public void testPuOnlyResourcesToPurchase() {
    testBridge.setStepName("italianPurchase");
    purchaseDelegate.setDelegateBridgeAndPlayer(testBridge);
    purchaseDelegate.start();
    final IntegerMap<ProductionRule> purchaseList = new IntegerMap<>();
    final ProductionRule buyArmour = gameData.getProductionRuleList().getProductionRule("buyArmour");
    assertNotNull(buyArmour);
    italianResources.subtract(buyArmour.getCosts());
    purchaseList.add(buyArmour, 1);
    final String error = purchaseDelegate.purchase(purchaseList);
    assertEquals(null, error);
    assertEquals(italianResources, italians.getResources().getResourcesCopy());
}
Also used : IntegerMap(games.strategy.util.IntegerMap) ProductionRule(games.strategy.engine.data.ProductionRule) Test(org.junit.jupiter.api.Test)

Example 33 with IntegerMap

use of games.strategy.util.IntegerMap in project triplea by triplea-game.

the class MoveDelegateTest method testAirCanFlyOverWater.

@Test
public void testAirCanFlyOverWater() {
    final IntegerMap<UnitType> map = new IntegerMap<>();
    map.put(bomber, 2);
    final Route route = new Route();
    route.setStart(egypt);
    // exast movement to force landing
    route.add(redSea);
    route.add(syria);
    final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
    assertValid(results);
}
Also used : IntegerMap(games.strategy.util.IntegerMap) UnitType(games.strategy.engine.data.UnitType) Route(games.strategy.engine.data.Route) Test(org.junit.jupiter.api.Test)

Example 34 with IntegerMap

use of games.strategy.util.IntegerMap in project triplea by triplea-game.

the class MoveDelegateTest method testCanReturnToCarrier.

@Test
public void testCanReturnToCarrier() {
    final IntegerMap<UnitType> map = new IntegerMap<>();
    map.put(fighter, 3);
    final Route route = new Route();
    route.setStart(congoSeaZone);
    route.add(southAtlantic);
    route.add(antarticSea);
    final String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
    assertValid(results);
}
Also used : IntegerMap(games.strategy.util.IntegerMap) UnitType(games.strategy.engine.data.UnitType) Route(games.strategy.engine.data.Route) Test(org.junit.jupiter.api.Test)

Example 35 with IntegerMap

use of games.strategy.util.IntegerMap in project triplea by triplea-game.

the class MoveDelegateTest method testMoveTransportsTwice.

@Test
public void testMoveTransportsTwice() {
    // move transports
    Route route = new Route();
    route.setStart(congoSeaZone);
    route.add(southAtlantic);
    final IntegerMap<UnitType> map = new IntegerMap<>();
    map.put(infantry, 2);
    map.put(transport, 1);
    String results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
    assertValid(results);
    // move again
    route = new Route();
    route.setStart(southAtlantic);
    route.add(angolaSeaZone);
    results = delegate.move(GameDataTestUtil.getUnits(map, route.getStart()), route);
    assertValid(results);
}
Also used : IntegerMap(games.strategy.util.IntegerMap) UnitType(games.strategy.engine.data.UnitType) Route(games.strategy.engine.data.Route) Test(org.junit.jupiter.api.Test)

Aggregations

IntegerMap (games.strategy.util.IntegerMap)132 UnitType (games.strategy.engine.data.UnitType)87 Test (org.junit.jupiter.api.Test)73 Route (games.strategy.engine.data.Route)66 Unit (games.strategy.engine.data.Unit)53 Territory (games.strategy.engine.data.Territory)39 ArrayList (java.util.ArrayList)35 PlayerID (games.strategy.engine.data.PlayerID)26 TripleAUnit (games.strategy.triplea.TripleAUnit)24 HashMap (java.util.HashMap)23 HashSet (java.util.HashSet)19 Resource (games.strategy.engine.data.Resource)16 GameData (games.strategy.engine.data.GameData)15 ProductionRule (games.strategy.engine.data.ProductionRule)14 Collection (java.util.Collection)12 List (java.util.List)12 UnitAttachment (games.strategy.triplea.attachments.UnitAttachment)10 Set (java.util.Set)10 RepairRule (games.strategy.engine.data.RepairRule)9 NamedAttachable (games.strategy.engine.data.NamedAttachable)7