Menu

#2 Design a test framework

open
nobody
Testing (2)
3
2008-02-21
2008-02-21
Roland Abt
No

A very basic test scheme would guarantee code correctness.

One idea is to write game protocols which a general test method would replay.

Object[][] testAllinProtocol =
{ {1, "BUYIN player1 100", "WELCOME"},
{2, "BUYIN player2 100", "WELCOME"},
{3, "BUYIN player3 100", "WELCOME"},
{0, /* 3 server starts game */, ""},
{1, "BLIND 10", "OK"},
{2, "STRADDLE 20", "OK"},
{3, "ALLIN 100", "OK"}};

@test public void testAllIn() {
replayProtocol(testAllinProtocol);
assertTrue(players.nth(3).getCash() == 0);
assertTrue(pot.getCash() == 130);
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB