BlockRequirementTest only executes first two tests
Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins
BlockRequirementTest only executes first two tests
by escplan9 » 17 Mar 2016, 13:29
I wanted to add a test for the reported bug involving Breaker of Armies and Untamed Hunger (or any combination of Creature needs to be blocked by all able to block it + grant that creature Menace). I created the test, however I notice when I try to run the test, only the first 2 tests are executed. Then nothing else happens after many minutes. The test file:
What I see in NetBeans when trying to run the tests:
When I try to do a "Clean and build" on Mage.Tests, it also never continues beyond that point.
- Code: Select all
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.requirement;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2, icetc
*/
public class BlockRequirementTest extends CardTestPlayerBase {
@Test
public void testPrizedUnicorn() {
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2
// All creatures able to block Prized Unicorn do so.
addCard(Zone.BATTLEFIELD, playerB, "Prized Unicorn"); // 2/2
// Silvercoat Lion should be forced to block
attack(2, playerB, "Prized Unicorn");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Prized Unicorn", 1);
}
@Test
public void testPrizedUnicornAndOppressiveRays() {
addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.HAND, playerA, "Oppressive Rays");
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2
// All creatures able to block Prized Unicorn do so.
addCard(Zone.BATTLEFIELD, playerB, "Prized Unicorn"); // 2/2
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Oppressive Rays", "Silvercoat Lion");
// Silvercoat Lion has not to block because it has to pay {3} to block
attack(2, playerB, "Prized Unicorn");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Oppressive Rays", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Prized Unicorn", 1);
}
/**
* Joraga Invocation is bugged big time. He cast it with 2 creatures out. I
* only had one untapped creature. Blocked one of his, hit Done, error
* message popped up saying the other one needed to be blocked in an
* infinite loop. Had to shut down the program via Task Manager.
*/
@Test
public void testJoragaInvocationTest() {
addCard(Zone.BATTLEFIELD, playerB, "Forest", 6);
// Each creature you control gets +3/+3 until end of turn and must be blocked this turn if able.
addCard(Zone.HAND, playerB, "Joraga Invocation");
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox"); // 2/4
// Swampwalk
addCard(Zone.BATTLEFIELD, playerA, "Bog Wraith"); // 3/3
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Joraga Invocation");
// Silvercoat Lion has not to block because it has to pay {3} to block
attack(2, playerB, "Silvercoat Lion");
attack(2, playerB, "Pillarfield Ox");
block(2, playerA, "Bog Wraith", "Pillarfield Ox");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 15);
assertGraveyardCount(playerB, "Joraga Invocation", 1);
assertPowerToughness(playerB, "Silvercoat Lion", 5, 5);
assertPowerToughness(playerB, "Pillarfield Ox", 5, 7);
assertGraveyardCount(playerA, "Bog Wraith", 1);
}
/**
* Elemental Uprising - "it must be blocked this turn if able", not working
*
* The bug just happened for me today as well - the problem is "must be
* blocked" is not being enforced correctly. During opponent's main phase he
* casted Elemental Uprising targeting an untapped land. He attacked with
* two creatures, I had one creature to block with, and did not block the
* land-creature targeted by Elemental Uprising. Instead I blocked a 2/2 of
* his with my 2/3. I should have been forced to block the land targeted by
* Elemental Uprising.
*/
@Test
public void testElementalUprising() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2
// Target land you control becomes a 4/4 Elemental creature with haste until end of turn. It's still a land. It must be blocked this turn if able.
addCard(Zone.HAND, playerA, "Elemental Uprising");
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox"); // 2/4
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Elemental Uprising", "Mountain");
// Silvercoat Lion has not to block because it has to pay {3} to block
attack(1, playerA, "Mountain");
attack(1, playerA, "Silvercoat Lion");
block(1, playerB, "Pillarfield Ox", "Silvercoat Lion"); // Not allowed, the Mountain has to be blocked
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertGraveyardCount(playerA, "Elemental Uprising", 1);
assertPowerToughness(playerA, "Mountain", 4, 4);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
assertLife(playerB, 18);
}
/**
* Okk is red creature that can't block unless a creature with greater power also blocks.
*/
@Test
public void testOkkBlocking() {
// 3/3 Vanilla creature
addCard(Zone.BATTLEFIELD, playerA, "Hill Giant", 1);
// 4/4 Goblin:
// Okk can't attack unless a creature with greater power also attacks.
// Okk can't block unless a creature with greater power also blocks.
addCard(Zone.BATTLEFIELD, playerB, "Okk", 1); //
attack(1, playerA, "Hill Giant");
// Not allowed because of Okk's blocking restrictions
block(1, playerB, "Okk", "Hill Giant");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
// Hill giant is still alive and Played B loses 3 lives
assertPermanentCount(playerA, "Hill Giant", 1);
assertLife(playerB, 17);
}
/**
* Reported bug:
* When Breaker of Armies is granted Menace and there is only 1 valid blocker, the game enters a state
* that cannot be continued. He must be blocked by all creatures that are able, however, with menace
* the only valid blocks would be by more than one creature, so the expected behavior is no blocks can be made.
*/
@Test
public void testBreakerOfArmiesWithMenace() {
// {8}
// All creatures able to block Breaker of Armies do so.
addCard(Zone.BATTLEFIELD, playerA, "Breaker of Armies", 1); // 10/8
// 3/3 Vanilla creature
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
// {2}{B} Enchanted creature gets +2/+1 and has menace.
addCard(Zone.HAND, playerA, "Untamed Hunger", 1);
castSpell(1,PhaseStep.PRECOMBAT_MAIN, playerA, "Untamed Hunger", "Breaker of Armies");
attack(1, playerA, "Breaker of Armies");
// not allowed due to Breaker of Armies having menace
block(1, playerB, "Hill Giant", "Breaker of Armies");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
// Hill giant is still alive
assertPermanentCount(playerA, "Hill Giant", 1);
// Player B was unable to block, so goes down to 10 life
assertLife(playerB, 10);
}
}
What I see in NetBeans when trying to run the tests:
- Code: Select all
------------------------------------------------------------------------
Building Mage Tests 1.4.9
------------------------------------------------------------------------
--- maven-resources-plugin:2.7:resources (default-resources) @ mage-tests ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 0 resource
--- maven-compiler-plugin:3.2:compile (default-compile) @ mage-tests ---
Nothing to compile - all classes are up to date
--- maven-resources-plugin:2.7:testResources (default-testResources) @ mage-tests ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource
--- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ mage-tests ---
Compiling 1 source file to C:\Users\Derek\Documents\NetBeansProjects\mage\Mage.Tests\target\test-classes
--- maven-surefire-plugin:2.10:test (default-cli) @ mage-tests ---
Surefire report directory: C:\Users\Derek\Documents\NetBeansProjects\mage\Mage.Tests\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.mage.test.cards.requirement.BlockRequirementTest
INFO [2016-03-17 09:34 [09:570]] MageTestPlayerBase[main]: Loading game type: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:34 [09:576]] MageTestPlayerBase[main]: Loading plugin: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:34 [28:651]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 76 ms
INFO [2016-03-17 09:34 [29:100]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 48 ms
When I try to do a "Clean and build" on Mage.Tests, it also never continues beyond that point.
- Code: Select all
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.583 sec
Running org.mage.test.cards.replacement.ZoneChangeReplacementTest
INFO [2016-03-17 09:39 [59:596]] MageTestPlayerBase[main]: Loading game type: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:39 [59:596]] MageTestPlayerBase[main]: Loading plugin: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:39 [59:816]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 1 ms
INFO [2016-03-17 09:39 [59:961]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 6 ms
INFO [2016-03-17 09:40 [00:146]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 7 ms
INFO [2016-03-17 09:40 [00:325]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 1 ms
INFO [2016-03-17 09:40 [00:506]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 2 ms
INFO [2016-03-17 09:40 [00:677]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 4 ms
INFO [2016-03-17 09:40 [00:866]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 1 ms
INFO [2016-03-17 09:40 [01:169]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 7 ms
INFO [2016-03-17 09:40 [01:361]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 8 ms
INFO [2016-03-17 09:40 [01:740]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 15 ms
INFO [2016-03-17 09:40 [02:012]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 5 ms
INFO [2016-03-17 09:40 [02:186]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 1 ms
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.59 sec
Running org.mage.test.cards.requirement.AttackRequirementTest
INFO [2016-03-17 09:40 [02:187]] MageTestPlayerBase[main]: Loading game type: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:40 [02:188]] MageTestPlayerBase[main]: Loading plugin: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:40 [02:424]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 5 ms
INFO [2016-03-17 09:40 [02:615]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 4 ms
INFO [2016-03-17 09:40 [02:791]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 2 ms
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.603 sec
Running org.mage.test.cards.requirement.BlockRequirementTest
INFO [2016-03-17 09:40 [02:792]] MageTestPlayerBase[main]: Loading game type: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:40 [02:793]] MageTestPlayerBase[main]: Loading plugin: mage.game.TwoPlayerMatch
INFO [2016-03-17 09:40 [02:986]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 3 ms
INFO [2016-03-17 09:40 [03:180]] CardTestPlayerAPIImpl[main]: Test has been executed. Execution time: 5 ms
Re: BlockRequirementTest only executes first two tests
by escplan9 » 17 Mar 2016, 14:30
For now I just added @Ignore for the recent test. Once I do that, all the other tests in the file run without a problem. I imagine it is because the bug in question prevents the game from being able to continue that is cannot even be tested in such a way right now. It's just weird it seems to only run the first two tests in that file with the new test present.
- Code: Select all
/**
* Reported bug:
* When Breaker of Armies is granted Menace and there is only 1 valid blocker, the game enters a state
* that cannot be continued. He must be blocked by all creatures that are able, however, with menace
* the only valid blocks would be by more than one creature, so the expected behavior is no blocks can be made.
*
* NOTE: Temporarily IGNORING this test since it breaks
*/
@Ignore
@Test
public void testBreakerOfArmiesWithMenace() {
// {8}
// All creatures able to block Breaker of Armies do so.
addCard(Zone.BATTLEFIELD, playerA, "Breaker of Armies", 1); // 10/8
// 3/3 Vanilla creature
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
// {2}{B} Enchanted creature gets +2/+1 and has menace.
addCard(Zone.HAND, playerA, "Untamed Hunger", 1);
castSpell(1,PhaseStep.PRECOMBAT_MAIN, playerA, "Untamed Hunger", "Breaker of Armies");
attack(1, playerA, "Breaker of Armies");
// not allowed due to Breaker of Armies having menace
block(1, playerB, "Hill Giant", "Breaker of Armies");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
// Hill giant is still alive
assertPermanentCount(playerA, "Hill Giant", 1);
// Player B was unable to block, so goes down to 10 life
assertLife(playerB, 10);
}
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest