Still working on updating code to new poker code.
This commit is contained in:
@ -60,10 +60,6 @@ void test_pokerResetRound_should_ResetThePlayers(void) {
|
||||
POKER_PLAYER_STATE_HAS_BET_THIS_ROUND, poker.players[i].state
|
||||
);
|
||||
TEST_ASSERT_BITS_LOW(POKER_PLAYER_STATE_SHOWING, poker.players[i].state);
|
||||
TEST_ASSERT_EQUAL_UINT8(
|
||||
0xFF - POKER_PLAYER_STATE_FOLDED - POKER_PLAYER_STATE_HAS_BET_THIS_ROUND,
|
||||
poker.players[i].state
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,6 +673,32 @@ void test_pokerPlayerGetCallBet_should_GetCallBet(void) {
|
||||
TEST_ASSERT_EQUAL_INT32(0, pokerPlayerGetCallBet(&poker,poker.players+p2));
|
||||
}
|
||||
|
||||
void test_pokerInRoundGetCount(void) {
|
||||
poker_t poker;
|
||||
uint8_t p0, p1, p2;
|
||||
|
||||
pokerInit(&poker);
|
||||
p0 = pokerPlayerAdd(&poker);
|
||||
p1 = pokerPlayerAdd(&poker);
|
||||
p2 = pokerPlayerAdd(&poker);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT8(0x00, pokerInRoundGetCount(&poker));
|
||||
|
||||
pokerPlayerChipsAdd(poker.players + p0, 10000);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x01, pokerInRoundGetCount(&poker));
|
||||
pokerPlayerChipsAdd(poker.players + p1, 10000);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x02, pokerInRoundGetCount(&poker));
|
||||
pokerPlayerChipsAdd(poker.players + p2, 10000);
|
||||
TEST_ASSERT_EQUAL_UINT8(0x03, pokerInRoundGetCount(&poker));
|
||||
|
||||
poker.players[0].state |= POKER_PLAYER_STATE_FOLDED;
|
||||
TEST_ASSERT_EQUAL_UINT8(0x02, pokerInRoundGetCount(&poker));
|
||||
poker.players[1].state |= POKER_PLAYER_STATE_FOLDED;
|
||||
TEST_ASSERT_EQUAL_UINT8(0x01, pokerInRoundGetCount(&poker));
|
||||
poker.players[2].state |= POKER_PLAYER_STATE_OUT;
|
||||
TEST_ASSERT_EQUAL_UINT8(0x00, pokerInRoundGetCount(&poker));
|
||||
}
|
||||
|
||||
void test_pokerPlayerBetPot_should_AddChipsToThePot(void) {
|
||||
poker_t poker;
|
||||
pokerpot_t *pot;
|
||||
@ -1418,7 +1440,6 @@ void test_pokerWinnerDetermine_should_DecideTheWinnerCorrectly(void) {
|
||||
TEST_ASSERT_EQUAL_UINT8(1, participants[1]);
|
||||
}
|
||||
|
||||
|
||||
int test_poker() {
|
||||
UNITY_BEGIN();
|
||||
|
||||
@ -1448,6 +1469,7 @@ int test_poker() {
|
||||
RUN_TEST(test_pokerPlayerGetRemainingBetter_should_ReturnRemainingBetters);
|
||||
RUN_TEST(test_pokerPlayerGetNextBetter_should_GetTheNextBetter);
|
||||
RUN_TEST(test_pokerPlayerGetCallBet_should_GetCallBet);
|
||||
RUN_TEST(test_pokerInRoundGetCount);
|
||||
RUN_TEST(test_pokerPlayerBetPot_should_AddChipsToThePot);
|
||||
RUN_TEST(test_pokerPlayerBetPot_should_UpdatePlayerState);
|
||||
RUN_TEST(test_pokerPlayerBet_should_BetToTheActivePot);
|
||||
|
@ -5,6 +5,6 @@
|
||||
|
||||
#pragma once
|
||||
#include <unity.h>
|
||||
#include <poker2/poker.h>
|
||||
#include <poker/poker.h>
|
||||
|
||||
int test_poker2();
|
||||
int test_poker();
|
@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "poker/card.h"
|
||||
#include "poker2/poker.h"
|
||||
#include "poker/poker.h"
|
||||
|
||||
int main() {
|
||||
return (
|
||||
test_card() ||
|
||||
test_poker2()
|
||||
test_poker()
|
||||
) || 0;
|
||||
}
|
Reference in New Issue
Block a user