Changes in testing framework. Added support for fixed targets. Added test to damage itself by Lightning Bolt. Ignored some old tests.

This commit is contained in:
magenoxx 2011-11-15 19:43:37 +04:00
parent f0cc3d1d0f
commit 60b6fe5a79
13 changed files with 132 additions and 23 deletions

View file

@ -11,14 +11,33 @@ public class LightningBoltTest extends CardTestBase {
@Test
public void testDamageOpponent() {
System.out.println("TEST: testDamageOpponent");
addCard(Constants.Zone.HAND, playerA, "Mountain");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
playLand(playerA, "Mountain");
castSpell(playerA, "Lightning Bolt");
// not specifying target, AI should choose opponent by itself
execute();
assertLife(playerA, 20);
assertLife(playerB, 17);
}
@Test
public void testDamageSelf() {
System.out.println("TEST: testDamageSelf");
addCard(Constants.Zone.HAND, playerA, "Mountain");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
playLand(playerA, "Mountain");
castSpell(playerA, "Lightning Bolt");
addFixedTarget(playerA, "Lightning Bolt", playerA);
playerA.setAllowBadMoves(true);
execute();
assertLife(playerA, 17);
assertLife(playerB, 20);
}
}

View file

@ -11,6 +11,7 @@ import mage.game.TwoPlayerDuel;
import mage.player.ai.ComputerPlayer;
import mage.players.Player;
import mage.sets.Sets;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.MageTestBase;
@ -27,7 +28,8 @@ public class PlayGameTest extends MageTestBase {
private static List<String> colorChoices = Arrays.asList("bu", "bg", "br", "bw", "ug", "ur", "uw", "gr", "gw", "rw", "bur", "buw", "bug", "brg", "brw", "bgw", "wur", "wug", "wrg", "rgu");
@Test
@Ignore
@Test
public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(Constants.MultiplayerAttackOption.LEFT, Constants.RangeOfInfluence.ALL);

View file

@ -4,6 +4,7 @@ import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
@ -16,6 +17,7 @@ import org.mage.test.serverside.base.CardTestBase;
public class BugTapsItselfTest extends CardTestBase {
@Test
@Ignore
public void testVersusInfectCreature() throws Exception {
useWhiteDefault();
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blinding Mage");

View file

@ -66,8 +66,8 @@ public abstract class CardTestBase extends CardTestAPIImpl {
Game game = new TwoPlayerDuel(Constants.MultiplayerAttackOption.LEFT, Constants.RangeOfInfluence.ALL);
playerA = aiTypeA.equals(CardTestBase.AIType.MinimaxHybrid) ?
createPlayer("ComputerA", "Computer - minimax hybrid") :
createPlayer("ComputerA", "Computer - mad");
createPlayer("PlayerA", "Computer - minimax hybrid") :
createPlayer("PlayerA", "Computer - mad");
playerA.setTestMode(true);
logger.info("Loading deck...");
Deck deck = Deck.load(Sets.loadDeck("RB Aggro.dck"));
@ -79,8 +79,8 @@ public abstract class CardTestBase extends CardTestAPIImpl {
game.loadCards(deck.getCards(), playerA.getId());
playerB = aiTypeB.equals(CardTestBase.AIType.MinimaxHybrid) ?
createPlayer("ComputerB", "Computer - minimax hybrid") :
createPlayer("ComputerB", "Computer - mad");
createPlayer("PlayerB", "Computer - minimax hybrid") :
createPlayer("PlayerB", "Computer - mad");
playerB.setTestMode(true);
Deck deck2 = Deck.load(Sets.loadDeck("RB Aggro.dck"));
if (deck2.getCards().size() < 40) {

View file

@ -363,8 +363,8 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP
player.addAction("cast:"+cardName);
}
public void castSpell(Player player, String cardName, String target) {
player.addAction("cast:"+cardName + ";" + target);
public void addFixedTarget(Player player, String cardName, Player target) {
player.addAction("cast:"+cardName + ";name=" + target.getName());
}
public void useAbility(Player player, String cardName) {

View file

@ -1,6 +1,7 @@
package org.mage.test.serverside.cards.effects;
import mage.filter.Filter;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
@ -12,6 +13,7 @@ import org.mage.test.serverside.base.CardTestBase;
public class BoostContinuousEffectTest extends CardTestBase {
@Test
@Ignore
public void testHonorOfThePoor() throws Exception {
load("M11/Honor of the Pure.test");
execute();

View file

@ -2,6 +2,7 @@ package org.mage.test.serverside.cards.single.mbs;
import mage.Constants;
import mage.filter.Filter;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestAPI;
import org.mage.test.serverside.base.CardTestBase;
@ -24,6 +25,7 @@ public class BurntheImpureTest extends CardTestBase {
* @throws Exception
*/
@Test
@Ignore
public void testVersusInfectCreature() throws Exception {
// $include red.default
useRedDefault();