It is currently 16 Jun 2019, 14:46
   
Text Size

Trouble writing a test for counters added at upkeep

Moderators: TheElk801, BetaSteward, LevelX, North, noxx, JayDi, jeffwadsworth, CCGHQ Admins

Trouble writing a test for counters added at upkeep

Postby catsmdogs » 20 Nov 2018, 22:47

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);
    }
catsmdogs
 
Posts: 3
Joined: 20 Nov 2018, 22:42
Has thanked: 0 time
Been thanked: 0 time

Re: Trouble writing a test for counters added at upkeep

Postby catsmdogs » 21 Nov 2018, 00:53

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)
catsmdogs
 
Posts: 3
Joined: 20 Nov 2018, 22:42
Has thanked: 0 time
Been thanked: 0 time


Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 1 guest

Login Form