Page 1 of 1

Trouble writing a test for counters added at upkeep

PostPosted: 20 Nov 2018, 22:47
by catsmdogs
With manual testing I can see that Assemble the Legion gets muster counters when expected, and cumulative upkeep cards like Reality Twist get age counters when expected, and the cost to keep it accumulates.

But in a unit test I don't see the counters rising. Any bugs in my test?

Code: Select all
   
    @Test
    public void testTrackCounters() {
        addCard(Zone.BATTLEFIELD, playerA, "Island", 20);
        addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
        addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
        addCard(Zone.HAND, playerA, "Reality Twist", 1);
        addCard(Zone.HAND, playerA, "Assemble the Legion", 1);

        castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Assemble the Legion");
        castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reality Twist");

        setChoice(playerA, "Yes");  // Pay cumulative upkeep?
        setChoice(playerA, "Yes");  // Pay cumulative upkeep?
        setChoice(playerA, "Yes");  // Pay cumulative upkeep?

        setStopAt(4, PhaseStep.PRECOMBAT_MAIN);
        execute();

        // Counter counts are not equal (Assemble the Legion:MUSTER) expected:<3> but was:<1>
        assertCounterCount(playerA, "Assemble the Legion", CounterType.MUSTER, 3);

        // Counter counts are not equal (Reality Twist:AGE) expected:<3> but was:<1>
        assertCounterCount(playerA, "Reality Twist", CounterType.AGE, 3);
    }

Re: Trouble writing a test for counters added at upkeep

PostPosted: 21 Nov 2018, 00:53
by catsmdogs
u/emerald000 got back to me on the xmage subreddit: the setStopAt takes half-turns compared to the way I was thinking of turns.

(This forum didn't like a brand new user posting an off-site link)