Improving server test mode for faster testing

This commit is contained in:
lotodore
2011-02-11 12:59:42 +00:00
parent 6a2e993ac3
commit dd3c003d7e
2 changed files with 11 additions and 11 deletions
+10 -10
View File
@@ -41,17 +41,17 @@
using namespace std;
//#define SERVER_TEST
//#define POKERTH_SERVER_TEST
#ifdef SERVER_TEST
#ifdef POKERTH_SERVER_TEST
#define SERVER_DELAY_NEXT_GAME_SEC 0
#define SERVER_DEAL_FLOP_CARDS_DELAY_SEC 0
#define SERVER_DEAL_TURN_CARD_DELAY_SEC 0
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 0
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 0
#define SERVER_SHOW_CARDS_DELAY_SEC 0
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 0
#define SERVER_COMPUTER_ACTION_DELAY_SEC 0
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 1
#else
#define SERVER_DELAY_NEXT_GAME_SEC 10
#define SERVER_DEAL_FLOP_CARDS_DELAY_SEC 5
@@ -59,8 +59,8 @@ using namespace std;
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 2
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 2
#define SERVER_SHOW_CARDS_DELAY_SEC 2
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 2
#define SERVER_COMPUTER_ACTION_DELAY_SEC 2
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 2
#endif
#define SERVER_START_GAME_TIMEOUT_SEC 10
@@ -1310,14 +1310,14 @@ ServerGameStateWaitPlayerAction::~ServerGameStateWaitPlayerAction()
void
ServerGameStateWaitPlayerAction::Enter(boost::shared_ptr<ServerGame> server)
{
#ifdef SERVER_TEST
int timeoutSec = 0;
if (server->GetGameData().playerActionTimeoutSec > 0) // zero means unlimited thinking time
{
#ifdef POKERTH_SERVER_TEST
int timeoutSec = SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
#else
int timeoutSec = server->GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
int timeoutSec = server->GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
#endif
if (timeoutSec != SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC) // minimum value means unlimited thinking time
{
server->GetStateTimer1().expires_from_now(boost::posix_time::seconds(timeoutSec));
server->GetStateTimer1().async_wait(
boost::bind(
@@ -1477,7 +1477,7 @@ ServerGameStateWaitNextHand::~ServerGameStateWaitNextHand()
void
ServerGameStateWaitNextHand::Enter(boost::shared_ptr<ServerGame> server)
{
#ifdef SERVER_TEST
#ifdef POKERTH_SERVER_TEST
int timeoutSec = 0;
#else
int timeoutSec = server->GetGameData().delayBetweenHandsSec;
@@ -267,7 +267,7 @@ public class RunRankingGameTest extends TestBase {
assertTrue(gameEnd.after(gameStart));
// Do not consider daylight saving time, just calculate the raw difference.
long gameDurationMsec = gameEnd.getTime() - gameStart.getTime();
assertTrue(gameDurationMsec > 60 * 1000); // game duration should be larger than 1 minute.
assertTrue(gameDurationMsec > 10 * 1000); // game duration should be larger than 10 seconds.
assertTrue(gameDurationMsec < 60 * 60 * 1000); // game duration should be smaller than 1 hour.
// Check database entries for the players in the game.