From dd3c003d7e817f5d179b47c339f9450caa46dfb1 Mon Sep 17 00:00:00 2001 From: lotodore Date: Fri, 11 Feb 2011 12:59:42 +0000 Subject: [PATCH] Improving server test mode for faster testing --- src/net/common/servergamestate.cpp | 20 +++++++++---------- .../src/pokerth_test/RunRankingGameTest.java | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/net/common/servergamestate.cpp b/src/net/common/servergamestate.cpp index a96277ff..06878401 100644 --- a/src/net/common/servergamestate.cpp +++ b/src/net/common/servergamestate.cpp @@ -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 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 server) { -#ifdef SERVER_TEST +#ifdef POKERTH_SERVER_TEST int timeoutSec = 0; #else int timeoutSec = server->GetGameData().delayBetweenHandsSec; diff --git a/tests/src/pokerth_test/RunRankingGameTest.java b/tests/src/pokerth_test/RunRankingGameTest.java index 20650d5d..03ecb4aa 100644 --- a/tests/src/pokerth_test/RunRankingGameTest.java +++ b/tests/src/pokerth_test/RunRankingGameTest.java @@ -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.