Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/tests/test_Net.h
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | for (size_t j = 0; j < clients.size(); ++j) | ||||
if (clients[j]->GetCurrState() != state) | if (clients[j]->GetCurrState() != state) | ||||
return false; | return false; | ||||
return true; | return true; | ||||
} | } | ||||
void connect(CNetServer& server, const std::vector<CNetClient*>& clients) | void connect(CNetServer& server, const std::vector<CNetClient*>& clients) | ||||
{ | { | ||||
TS_ASSERT(server.SetupConnection(PS_DEFAULT_PORT)); | TS_ASSERT(server.SetupConnection(PS_DEFAULT_PORT)); | ||||
for (size_t j = 0; j < clients.size(); ++j) | for (CNetClient* client: clients) | ||||
TS_ASSERT(clients[j]->SetupConnection("127.0.0.1", PS_DEFAULT_PORT, nullptr)); | { | ||||
client->SetupServerData("127.0.0.1", PS_DEFAULT_PORT, false); | |||||
TS_ASSERT(client->SetupConnection(nullptr)); | |||||
} | |||||
for (size_t i = 0; ; ++i) | for (size_t i = 0; ; ++i) | ||||
{ | { | ||||
// debug_printf("."); | // debug_printf("."); | ||||
for (size_t j = 0; j < clients.size(); ++j) | for (size_t j = 0; j < clients.size(); ++j) | ||||
clients[j]->Poll(); | clients[j]->Poll(); | ||||
if (clients_are_all(clients, NCS_PREGAME)) | if (clients_are_all(clients, NCS_PREGAME)) | ||||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | void test_rejoin_DISABLED() | ||||
debug_printf("==== Connecting client 2B\n"); | debug_printf("==== Connecting client 2B\n"); | ||||
CGame client2BGame(false); | CGame client2BGame(false); | ||||
CNetClient client2B(&client2BGame, false); | CNetClient client2B(&client2BGame, false); | ||||
client2B.SetUserName(L"bob"); | client2B.SetUserName(L"bob"); | ||||
clients.push_back(&client2B); | clients.push_back(&client2B); | ||||
TS_ASSERT(client2B.SetupConnection("127.0.0.1", PS_DEFAULT_PORT, nullptr)); | client2B.SetupServerData("127.0.0.1", PS_DEFAULT_PORT, false); | ||||
TS_ASSERT(client2B.SetupConnection(nullptr)); | |||||
for (size_t i = 0; ; ++i) | for (size_t i = 0; ; ++i) | ||||
{ | { | ||||
debug_printf("[%u]\n", client2B.GetCurrState()); | debug_printf("[%u]\n", client2B.GetCurrState()); | ||||
client2B.Poll(); | client2B.Poll(); | ||||
if (client2B.GetCurrState() == NCS_PREGAME) | if (client2B.GetCurrState() == NCS_PREGAME) | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator