Even more tests.
This commit is contained in:
@ -486,6 +486,52 @@ void test_pokerPlayerDoesNeedToBetThisRound_should_CheckCallValue(void) {
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
}
|
||||
|
||||
void test_pokerPlayerDoesNeedToBetThisRound_should_CheckWhetherHasBetYet(void) {
|
||||
poker2_t poker;
|
||||
uint8_t first, second;
|
||||
pokerInit(&poker);
|
||||
first = pokerPlayerAdd(&poker);
|
||||
second = pokerPlayerAdd(&poker);
|
||||
pokerPlayerChipsAdd(poker.players + first, 10000);
|
||||
pokerPlayerChipsAdd(poker.players + second, 10000);
|
||||
|
||||
TEST_ASSERT_EQUAL(true, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(true, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
|
||||
pokerPlayerBet(&poker, first, 100);
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(true, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
|
||||
pokerPlayerBet(&poker, second, 100);
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
}
|
||||
|
||||
void test_pokerPlayerDoesNeedToBetThisRound_should_IgnoreFoldedPlayers(void) {
|
||||
poker2_t poker;
|
||||
uint8_t first, second;
|
||||
pokerInit(&poker);
|
||||
first = pokerPlayerAdd(&poker);
|
||||
second = pokerPlayerAdd(&poker);
|
||||
pokerPlayerChipsAdd(poker.players + first, 10000);
|
||||
pokerPlayerChipsAdd(poker.players + second, 10000);
|
||||
|
||||
TEST_ASSERT_EQUAL(true, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(true, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
|
||||
pokerPlayerBet(&poker, first, 100);
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(true, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
|
||||
poker.players[second].state |= POKER_PLAYER_STATE_FOLDED;
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
|
||||
pokerPlayerBet(&poker, first, 100);
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, first));
|
||||
TEST_ASSERT_EQUAL(false, pokerPlayerDoesNeedToBetThisRound(&poker, second));
|
||||
}
|
||||
|
||||
void test_pokerPlayerBetPot_should_AddChipsToThePot(void) {
|
||||
poker2_t poker;
|
||||
poker2pot_t *pot;
|
||||
@ -572,6 +618,8 @@ int test_poker() {
|
||||
RUN_TEST(test_pokerPlayerDealAll_should_NotDealToOutPlayers);
|
||||
RUN_TEST(test_pokerPlayerDealAll_should_NotDealToFoldedPlayers);
|
||||
RUN_TEST(test_pokerPlayerDoesNeedToBetThisRound_should_CheckCallValue);
|
||||
RUN_TEST(test_pokerPlayerDoesNeedToBetThisRound_should_CheckWhetherHasBetYet);
|
||||
RUN_TEST(test_pokerPlayerDoesNeedToBetThisRound_should_IgnoreFoldedPlayers);
|
||||
RUN_TEST(test_pokerPlayerBetPot_should_AddChipsToThePot);
|
||||
RUN_TEST(test_pokerPlayerBetPot_should_UpdatePlayerState);
|
||||
RUN_TEST(test_pokerPlayerBet_should_BetToTheActivePot);
|
||||
|
Reference in New Issue
Block a user