Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/tests/test_StunClient.h
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 27 Lines | void tearDown() | ||||
enet_deinitialize(); | enet_deinitialize(); | ||||
} | } | ||||
void test_local_ip() | void test_local_ip() | ||||
{ | { | ||||
CStr ip; | CStr ip; | ||||
TS_ASSERT(StunClient::FindLocalIP(ip)); | TS_ASSERT(StunClient::FindLocalIP(ip)); | ||||
// Quick validation that this looks like a valid IP address. | // Quick validation that this looks like a valid IP address. | ||||
if (ip.size() < 8 || ip.size() > 15) | if (ip.size() < 7 || ip.size() > 15) | ||||
{ | { | ||||
TS_FAIL("StunClient::FindLocalIP did not return a valid IPV4 address: wrong size"); | TS_FAIL("StunClient::FindLocalIP did not return a valid IPV4 address: wrong size"); | ||||
return; | return; | ||||
} | } | ||||
int dots = 0; | int dots = 0; | ||||
for (char c : ip) | for (char c : ip) | ||||
{ | { | ||||
if (c == '.') | if (c == '.') | ||||
Show All 26 Lines |
Wildfire Games · Phabricator