- * BoosterDraftTest class. - *
- * - * @author Forge - * @version $Id: BoosterDraftTest.java 24769 2014-02-09 13:56:04Z Hellfish $ - */ -@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false) -public class BoosterDraftTest implements IBoosterDraft { - - private int n = 3; - - @Override - @Test(timeOut = 1000) - public Deck[] getDecks() { - return null; - } - - @Override - public CardPool nextChoice() { - this.n--; - SealedProduct.Template booster = FModel.getMagicDb().getBoosters().get("M11"); - CardPool result = new CardPool(); - result.addAllFlat(BoosterGenerator.getBoosterPack(booster)); - return result; - } - - /** {@inheritDoc} */ - @Override - public void setChoice(final PaperCard c) { - System.out.println(c.getName()); - } - - @Override - public boolean hasNextChoice() { - return this.n > 0; - } - - @Override - public boolean isRoundOver() { - return hasNextChoice(); - } - - public List- * PanelTest class. - *
- * - * @author Forge - * @version $Id: PanelTest.java 24769 2014-02-09 13:56:04Z Hellfish $ - */ -@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false) -public class PanelTest extends JFrame { - /** - * - */ - private static final long serialVersionUID = 1L; - private final JPanel jPanel1 = new JPanel(); - private final JLabel jLabel1 = new JLabel(); - - /** - * Phase test1. - */ - @Test(timeOut = 1000, enabled = false) - public void phaseTest1() { - final PanelTest p = new PanelTest(); - p.setSize(300, 300); - p.setVisible(true); - } - - /** - *- * Constructor for PanelTest. - *
- */ - public PanelTest() { - try { - this.jbInit(); - } - catch (final Exception ex) { - BugReporter.reportException(ex); - ex.printStackTrace(); - } - } - - /** - *- * jbInit. - *
- * - * @throws java.lang.Exception - * if any. - */ - private void jbInit() throws Exception { - this.getContentPane().setLayout(null); - this.jPanel1.setForeground(Color.orange); - this.jPanel1.setBounds(new Rectangle(15, 36, 252, 156)); - this.jLabel1.setFont(new java.awt.Font("Dialog", 1, 12)); - this.jLabel1.setForeground(new Color(70, 90, 163)); - this.jLabel1.setText("jLabel1"); - this.getContentPane().add(this.jPanel1, null); - this.jPanel1.add(this.jLabel1, null); - } -} diff --git a/forge-gui-desktop/src/test/java/forge/RunTest.java b/forge-gui-desktop/src/test/java/forge/RunTest.java deleted file mode 100644 index ea75106a..00000000 --- a/forge-gui-desktop/src/test/java/forge/RunTest.java +++ /dev/null @@ -1,340 +0,0 @@ -package forge; - -import forge.game.card.Card; -import forge.game.combat.CombatUtil; -import org.testng.annotations.Test; - -/** - *- * RunTest class. - *
- * - * @author Forge - * @version $Id: RunTest.java 24769 2014-02-09 13:56:04Z Hellfish $ - */ -@Test(groups = { "UnitTest" }, timeOut = 1000, enabled = false) -public class RunTest { - // @SuppressWarnings("unchecked") // HashSet needs- * test. - *
- */ - @Test(timeOut = 1000, enabled = false) - void test() { - Card c; - //final CardFactoryInterface cf = Singletons.getModel().getCardFactory(); - // ********* test Card - /* - c = cf.getCard("Elvish Warrior", AllZone.getComputerPlayer()); - this.check("1", c.getOwner().isComputer()); - this.check("1.1", c.getName().equals("Elvish Warrior")); - this.check("2", c.getManaCost().equals("G G")); - this.check("2.1", c.isCreature()); - this.check("2.2", c.isType("Elf")); - this.check("2.3", c.isType("Warrior")); - this.check("3", c.getText().equals("")); - this.check("4", c.getNetPower() == 2); - this.check("5", c.getNetToughness() == 3); - this.check("6", c.getKeyword().isEmpty()); - - c = cf.getCard("Shock", null); - this.check("14", c.isInstant()); - // check("15", - // c.getText().equals("Shock deals 2 damge to target creature or player.")); - - c = cf.getCard("Bayou", null); - this.check("17", c.getManaCost().equals("")); - this.check("18", c.isLand()); - this.check("19", c.isType("Swamp")); - this.check("20", c.isType("Forest")); - - // ********* test ManaCost - ManaCost manaCost = new ManaCost("G"); - this.check("21", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GREEN); - this.check("22", manaCost.isPaid()); - - manaCost = new ManaCost("7"); - this.check("23", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLACK); - this.check("24", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLUE); - this.check("25", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GENERIC); - this.check("26", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GREEN); - this.check("27", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.RED); - this.check("28", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.WHITE); - this.check("29", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.WHITE); - this.check("30", manaCost.isPaid()); - - manaCost = new ManaCost("2 W W G G B B U U R R"); - this.check("31", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.WHITE); - this.check("32", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.WHITE); - this.check("32.1", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLACK); - this.check("33", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLACK); - this.check("34", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLUE); - this.check("35", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLUE); - this.check("36", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GREEN); - this.check("37", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GREEN); - this.check("38", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.RED); - this.check("39", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.RED); - this.check("40", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.RED); - this.check("41", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLUE); - this.check("42", manaCost.isPaid()); - - manaCost = new ManaCost("G G"); - this.check("43", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GREEN); - this.check("44", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.GREEN); - this.check("45", manaCost.isPaid()); - - manaCost = new ManaCost("1 U B"); - this.check("45", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLACK); - this.check("46", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLUE); - this.check("47", !manaCost.isPaid()); - manaCost.payMana(MagicColor.Constant.BLUE); - this.check("48", manaCost.isPaid()); - - // ********* test CardUtil.getColors() - c = new Card(); - c.setManaCost(new CardManaCost(new ManaCostParser("G"))); - ArrayList- * check. - *
- * - * @param message - * a {@link java.lang.String} object. - * @param ok - * a boolean. - */ - void check(final String message, final boolean ok) { - if (!ok) { - // throw new RuntimeException("RunTest test error : " +message); - System.out.println("RunTest test error : " + message); - } - - } -} diff --git a/forge-gui-desktop/src/test/java/forge/TinyTest.java b/forge-gui-desktop/src/test/java/forge/TinyTest.java deleted file mode 100644 index 18de236a..00000000 --- a/forge-gui-desktop/src/test/java/forge/TinyTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package forge; - -import org.testng.Assert; -import org.testng.annotations.Test; - -/** - * This test mostly exists to test TestNG itself. - * - * @author Forge - * @version $Id: TinyTest.java 11726 2011-11-03 16:16:33Z jendave $ - */ -@Test(groups = { "UnitTest" }) -public class TinyTest { - /** - * Just a quick test to see if TestNG and Assert are working. - */ - @Test(groups = { "UnitTest", "fast" }) - public void test_true() { - Assert.assertTrue(true); - } -} diff --git a/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java b/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java deleted file mode 100644 index a4b6585c..00000000 --- a/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java +++ /dev/null @@ -1,1352 +0,0 @@ -package forge.ai.simulation; - -import com.google.common.collect.Lists; -import forge.ai.ComputerUtilAbility; -import forge.card.CardStateName; -import forge.card.MagicColor; -import forge.game.Game; -import forge.game.card.Card; -import forge.game.card.CardCollection; -import forge.game.card.CounterType; -import forge.game.phase.PhaseType; -import forge.game.player.Player; -import forge.game.spellability.SpellAbility; -import forge.game.zone.ZoneType; - -import java.util.List; - -public class GameSimulatorTest extends SimulationTestCase { - - public void testActivateAbilityTriggers() { - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - - addCard("Plains", p); - addCard("Plains", p); - addCard("Plains", p); - String heraldCardName = "Herald of Anafenza"; - Card herald = addCard(heraldCardName, p); - herald.setSickness(false); - - game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); - - SpellAbility outlastSA = findSAWithPrefix(herald, "Outlast"); - assertNotNull(outlastSA); - - GameSimulator sim = createSimulator(game, p); - int score = sim.simulateSpellAbility(outlastSA).value; - assertTrue(score > 0); - Game simGame = sim.getSimulatedGameState(); - - Card heraldCopy = findCardWithName(simGame, heraldCardName); - assertNotNull(heraldCopy); - assertTrue(heraldCopy.isTapped()); - assertTrue(heraldCopy.hasCounters()); - assertEquals(1, heraldCopy.getToughnessBonusFromCounters()); - assertEquals(1, heraldCopy.getPowerBonusFromCounters()); - - Card warriorToken = findCardWithName(simGame, "Warrior"); - assertNotNull(warriorToken); - assertTrue(warriorToken.isSick()); - assertEquals(1, warriorToken.getCurrentPower()); - assertEquals(1, warriorToken.getCurrentToughness()); - } - - public void testStaticAbilities() { - String sliverCardName = "Sidewinder Sliver"; - String heraldCardName = "Herald of Anafenza"; - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - Card sliver = addCard(sliverCardName, p); - sliver.setSickness(false); - Card herald = addCard(heraldCardName, p); - herald.setSickness(false); - addCard("Plains", p); - addCard("Plains", p); - addCard("Plains", p); - addCard("Spear of Heliod", p); - - game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); - game.getAction().checkStateEffects(true); - game.getAction().checkStateEffects(true); - - assertEquals(1, sliver.getAmountOfKeyword("Flanking")); - assertEquals(2, sliver.getNetPower()); - assertEquals(2, sliver.getNetToughness()); - - SpellAbility outlastSA = findSAWithPrefix(herald, "Outlast"); - assertNotNull(outlastSA); - - GameSimulator sim = createSimulator(game, p); - int score = sim.simulateSpellAbility(outlastSA).value; - assertTrue(score > 0); - Game simGame = sim.getSimulatedGameState(); - Card sliverCopy = findCardWithName(simGame, sliverCardName); - assertEquals(1, sliverCopy.getAmountOfKeyword("Flanking")); - assertEquals(2, sliver.getNetPower()); - assertEquals(2, sliver.getNetToughness()); - } - - public void testStaticEffectsMonstrous() { - String lionCardName = "Fleecemane Lion"; - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - Card lion = addCard(lionCardName, p); - lion.setSickness(false); - lion.setMonstrous(true); - game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); - game.getAction().checkStateEffects(true); - assertTrue(lion.isMonstrous()); - assertEquals(1, lion.getAmountOfKeyword("Hexproof")); - assertEquals(1, lion.getAmountOfKeyword("Indestructible")); - - GameSimulator sim = createSimulator(game, p); - Game simGame = sim.getSimulatedGameState(); - Card lionCopy = findCardWithName(simGame, lionCardName); - assertTrue(lionCopy.isMonstrous()); - assertEquals(1, lionCopy.getAmountOfKeyword("Hexproof")); - assertEquals(1, lionCopy.getAmountOfKeyword("Indestructible")); - } - - public void testEquippedAbilities() { - String bearCardName = "Runeclaw Bear"; - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - Card bear = addCard(bearCardName, p); - bear.setSickness(false); - Card cloak = addCard("Whispersilk Cloak", p); - cloak.equipCard(bear); - game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); - game.getAction().checkStateEffects(true); - assertEquals(1, bear.getAmountOfKeyword("Unblockable")); - - GameSimulator sim = createSimulator(game, p); - Game simGame = sim.getSimulatedGameState(); - Card bearCopy = findCardWithName(simGame, bearCardName); - assertEquals(1, bearCopy.getAmountOfKeyword("Unblockable")); - } - - public void testEnchantedAbilities() { - String bearCardName = "Runeclaw Bear"; - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - Card bear = addCard(bearCardName, p); - bear.setSickness(false); - Card lifelink = addCard("Lifelink", p); - lifelink.enchantEntity(bear); - game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); - game.getAction().checkStateEffects(true); - assertEquals(1, bear.getAmountOfKeyword("Lifelink")); - - GameSimulator sim = createSimulator(game, p); - Game simGame = sim.getSimulatedGameState(); - Card bearCopy = findCardWithName(simGame, bearCardName); - assertEquals(1, bearCopy.getAmountOfKeyword("Lifelink")); - } - - public void testEtbTriggers() { - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - addCard("Black Knight", p); - for (int i = 0; i < 5; i++) - addCard("Swamp", p); - - String merchantCardName = "Gray Merchant of Asphodel"; - Card c = addCardToZone(merchantCardName, p, ZoneType.Hand); - game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p); - game.getAction().checkStateEffects(true); - - SpellAbility playMerchantSa = c.getSpellAbilities().get(0); - playMerchantSa.setActivatingPlayer(p); - - GameSimulator sim = createSimulator(game, p); - int origScore = sim.getScoreForOrigGame().value; - int score = sim.simulateSpellAbility(playMerchantSa).value; - assertTrue(String.format("score=%d vs. origScore=%d", score, origScore), score > origScore); - Game simGame = sim.getSimulatedGameState(); - assertEquals(24, simGame.getPlayers().get(1).getLife()); - assertEquals(16, simGame.getPlayers().get(0).getLife()); - } - - public void testSimulateUnmorph() { - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - Card ripper = createCard("Ruthless Ripper", p); - ripper.setState(CardStateName.FaceDown, true); - p.getZone(ZoneType.Battlefield).add(ripper); - - game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p); - game.getAction().checkStateEffects(true); - - assertEquals(20, game.getPlayers().get(0).getLife()); - - GameSimulator sim = createSimulator(game, p); - Game simGame = sim.getSimulatedGameState(); - - SpellAbility unmorphSA = findSAWithPrefix(ripper, "Morph—Reveal a black card"); - assertNotNull(unmorphSA); - sim.simulateSpellAbility(unmorphSA); - assertEquals(18, simGame.getPlayers().get(0).getLife()); - } - - public void testFindingOwnCard() { - Game game = initAndCreateGame(); - Player p0 = game.getPlayers().get(0); - Player p1 = game.getPlayers().get(1); - addCardToZone("Skull Fracture", p0, ZoneType.Hand); - addCardToZone("Runeclaw Bear", p0, ZoneType.Hand); - Card fractureP1 = addCardToZone("Skull Fracture", p1, ZoneType.Hand); - addCard("Swamp", p1); - game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p1); - game.getAction().checkStateEffects(true); - - GameSimulator sim = createSimulator(game, p1); - Game simGame = sim.getSimulatedGameState(); - - SpellAbility fractureSa = fractureP1.getSpellAbilities().get(0); - assertNotNull(fractureSa); - fractureSa.getTargets().add(p0); - sim.simulateSpellAbility(fractureSa); - assertEquals(1, simGame.getPlayers().get(0).getCardsIn(ZoneType.Hand).size()); - assertEquals(0, simGame.getPlayers().get(1).getCardsIn(ZoneType.Hand).size()); - } - - public void testPlaneswalkerAbilities() { - Game game = initAndCreateGame(); - Player p = game.getPlayers().get(1); - Card sorin = addCard("Sorin, Solemn Visitor", p); - sorin.addCounter(CounterType.LOYALTY, 5, sorin, false); - - game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p); - game.getAction().checkStateEffects(true); - - CardCollection cards = ComputerUtilAbility.getAvailableCards(game, p); - List
+<#list cardList?keys as key>
+ ${cardList[key]} ${key} +#list> + |
+