Cleaning more.
This commit is contained in:
@ -383,7 +383,7 @@ void test_pokerDealerBurn_should_SendCardsToTheGrave(void) {
|
||||
|
||||
}
|
||||
|
||||
void test_pokerGetCallValue_should_CalculateTheCallValue(void) {
|
||||
void test_pokerBetGetCurrentCallValue_should_CalculateTheCallValue(void) {
|
||||
poker_t poker;
|
||||
uint8_t first, second;
|
||||
pokerInit(&poker);
|
||||
@ -392,21 +392,21 @@ void test_pokerGetCallValue_should_CalculateTheCallValue(void) {
|
||||
pokerPlayerChipsAdd(poker.players + first, 10000);
|
||||
pokerPlayerChipsAdd(poker.players + second, 10000);
|
||||
|
||||
TEST_ASSERT_EQUAL_INT32(0, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(0, pokerBetGetCurrentCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, first, 100);
|
||||
TEST_ASSERT_EQUAL_INT32(100, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(100, pokerBetGetCurrentCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, second, 150);
|
||||
TEST_ASSERT_EQUAL_INT32(150, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(150, pokerBetGetCurrentCallValue(&poker));
|
||||
|
||||
pokerPotAdd(&poker);
|
||||
TEST_ASSERT_EQUAL_INT32(150, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(150, pokerBetGetCurrentCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(0, poker.pots[1].chips);
|
||||
pokerBetForPlayer(&poker, second, 50);
|
||||
TEST_ASSERT_EQUAL_INT32(200, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(200, pokerBetGetCurrentCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(50, poker.pots[1].chips);
|
||||
}
|
||||
|
||||
void test_pokerGetCallValue_should_SkipOutPlayers(void) {
|
||||
void test_pokerBetGetCurrentCallValue_should_SkipOutPlayers(void) {
|
||||
poker_t poker;
|
||||
uint8_t i;
|
||||
pokerInit(&poker);
|
||||
@ -423,11 +423,11 @@ void test_pokerGetCallValue_should_SkipOutPlayers(void) {
|
||||
pokerPlayerChipsAdd(poker.players + i, 10000);
|
||||
pokerBetForPlayer(&poker, i, 200);
|
||||
|
||||
TEST_ASSERT_EQUAL_INT32(500, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(500, pokerBetGetCurrentCallValue(&poker));
|
||||
poker.players[1].state |= POKER_PLAYER_STATE_OUT;
|
||||
TEST_ASSERT_EQUAL_INT32(300, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(300, pokerBetGetCurrentCallValue(&poker));
|
||||
poker.players[0].state |= POKER_PLAYER_STATE_OUT;
|
||||
TEST_ASSERT_EQUAL_INT32(200, pokerGetCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL_INT32(200, pokerBetGetCurrentCallValue(&poker));
|
||||
}
|
||||
|
||||
void test_pokerDeal_should_DealCardsToThePlayer(void) {
|
||||
@ -670,20 +670,20 @@ void test_pokerBetGetRemainingPlayer_should_ReturnRemainingBetters(void) {
|
||||
TEST_ASSERT_EQUAL(0x04, pokerBetGetRemainingPlayer(&poker));
|
||||
|
||||
// Blind + 2
|
||||
pokerBetForPlayer(&poker, 0x04, pokerGetCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, 0x04, pokerBetGetCurrentCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL(0x00, pokerBetGetRemainingPlayer(&poker));
|
||||
|
||||
// Blind + 3
|
||||
pokerBetForPlayer(&poker, 0x00, pokerGetCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, 0x00, pokerBetGetCurrentCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL(0x01, pokerBetGetRemainingPlayer(&poker));
|
||||
|
||||
// Blind + 4 / Small Blind
|
||||
pokerBetForPlayer(&poker, 0x01, pokerGetCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, 0x01, pokerBetGetCurrentCallValue(&poker));
|
||||
TEST_ASSERT_EQUAL(0x02, pokerBetGetRemainingPlayer(&poker));
|
||||
|
||||
// Blind + 5 / Big Blind
|
||||
pokerBetForPlayer(
|
||||
&poker, 0x02, pokerGetCallValue(&poker) - poker.players[0x01].currentBet
|
||||
&poker, 0x02, pokerBetGetCurrentCallValue(&poker) - poker.players[0x01].currentBet
|
||||
);
|
||||
TEST_ASSERT_EQUAL(0x03, pokerBetGetRemainingPlayer(&poker));
|
||||
|
||||
@ -724,24 +724,24 @@ void test_pokerBetGetNextPlayer_should_GetTheNextBetter(void) {
|
||||
TEST_ASSERT_EQUAL_UINT8(0x04, poker.better);
|
||||
|
||||
// Blind+2
|
||||
pokerBetForPlayer(&poker, poker.better, pokerGetCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, poker.better, pokerBetGetCurrentCallValue(&poker));
|
||||
poker.better = pokerBetGetNextPlayer(&poker);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x00, poker.better);
|
||||
|
||||
// BLind+3
|
||||
pokerBetForPlayer(&poker, poker.better, pokerGetCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, poker.better, pokerBetGetCurrentCallValue(&poker));
|
||||
poker.better = pokerBetGetNextPlayer(&poker);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x01, poker.better);
|
||||
|
||||
// Dealer
|
||||
pokerBetForPlayer(&poker, poker.better, pokerGetCallValue(&poker));
|
||||
pokerBetForPlayer(&poker, poker.better, pokerBetGetCurrentCallValue(&poker));
|
||||
poker.better = pokerBetGetNextPlayer(&poker);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x02, poker.better);
|
||||
|
||||
// Small blind
|
||||
pokerBetForPlayer(
|
||||
&poker, poker.better,
|
||||
pokerGetCallValue(&poker) - poker.players[0x02].currentBet
|
||||
pokerBetGetCurrentCallValue(&poker) - poker.players[0x02].currentBet
|
||||
);
|
||||
poker.better = pokerBetGetNextPlayer(&poker);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x03, poker.better);
|
||||
@ -749,7 +749,7 @@ void test_pokerBetGetNextPlayer_should_GetTheNextBetter(void) {
|
||||
// Big Blind
|
||||
pokerBetForPlayer(
|
||||
&poker, poker.better,
|
||||
pokerGetCallValue(&poker) - poker.players[0x03].currentBet
|
||||
pokerBetGetCurrentCallValue(&poker) - poker.players[0x03].currentBet
|
||||
);
|
||||
poker.better = pokerBetGetNextPlayer(&poker);
|
||||
TEST_ASSERT_EQUAL_UINT8(0xFF, poker.better);
|
||||
@ -1025,7 +1025,7 @@ void test_pokerTurnBet_should_ReturnARaiseAction(void) {
|
||||
TEST_ASSERT_EQUAL_FLOAT(1.0f, turn.confidence);
|
||||
}
|
||||
|
||||
void test_pokerHandGetFull_should_ReturnTheFullHand(void) {
|
||||
void test_pokerPlayerGetFullHand_should_ReturnTheFullHand(void) {
|
||||
poker_t poker;
|
||||
pokerplayer_t *player;
|
||||
uint8_t i;
|
||||
@ -1046,7 +1046,7 @@ void test_pokerHandGetFull_should_ReturnTheFullHand(void) {
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_SPADES_NINE, poker.community[3]);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_SPADES_EIGHT, poker.community[4]);
|
||||
|
||||
pokerHandGetFull(&poker, player, cards);
|
||||
pokerPlayerGetFullHand(&poker, player, cards);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_SPADES_QUEEN, cards[0]);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_SPADES_JACK, cards[1]);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_SPADES_TEN, cards[2]);
|
||||
@ -1063,7 +1063,7 @@ void test_pokerHandGetFull_should_ReturnTheFullHand(void) {
|
||||
player->cards[0] = CARD_DIAMONDS_KING;
|
||||
player->cards[1] = CARD_HEARTS_QUEEN;
|
||||
|
||||
pokerHandGetFull(&poker, player, cards);
|
||||
pokerPlayerGetFullHand(&poker, player, cards);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_CLUBS_THREE, cards[0]);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_DIAMONDS_TWO, cards[1]);
|
||||
TEST_ASSERT_EQUAL_UINT8(CARD_SPADES_EIGHT, cards[2]);
|
||||
@ -1602,7 +1602,7 @@ int test_poker() {
|
||||
RUN_TEST(test_pokerPlayerAdd_should_ResetThePlayer);
|
||||
RUN_TEST(test_pokerDealerTurn_should_TurnCardsFromTheDeck);
|
||||
RUN_TEST(test_pokerDealerBurn_should_SendCardsToTheGrave);
|
||||
RUN_TEST(test_pokerGetCallValue_should_CalculateTheCallValue);
|
||||
RUN_TEST(test_pokerBetGetCurrentCallValue_should_CalculateTheCallValue);
|
||||
RUN_TEST(test_pokerDeal_should_DealCardsToThePlayer);
|
||||
RUN_TEST(test_pokerPlayerChipsAdd_should_AddChipsToThePlayer);
|
||||
RUN_TEST(test_pokerPlayerChipsAdd_should_TurnOutStateOff);
|
||||
@ -1627,7 +1627,7 @@ int test_poker() {
|
||||
RUN_TEST(test_pokerTurnBet_should_ReturnAnAllInAction);
|
||||
RUN_TEST(test_pokerTurnBet_should_ReturnACallAction);
|
||||
RUN_TEST(test_pokerTurnBet_should_ReturnARaiseAction);
|
||||
RUN_TEST(test_pokerHandGetFull_should_ReturnTheFullHand);
|
||||
RUN_TEST(test_pokerPlayerGetFullHand_should_ReturnTheFullHand);
|
||||
RUN_TEST(test_pokerWinnerFillRemaining_should_FillTheRestOfTheArray);
|
||||
RUN_TEST(test_pokerWinnerGetForPlayer_should_CalculateHighCard);
|
||||
RUN_TEST(test_pokerWinnerGetForPlayer_should_CalculatePair);
|
||||
|
Reference in New Issue
Block a user