diff options
author | Howaner <franzi.moos@googlemail.com> | 2015-03-10 20:05:46 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2015-03-10 20:05:46 +0100 |
commit | ab420f6cfc8519fb2ec0caa7fb242517244ffcea (patch) | |
tree | c31c3538db081516d81959ed8ad00259175441a9 /tests/Network | |
parent | Changed return type from AbsorbWater() to void. (diff) | |
parent | Fixed client kick/crash if many block changes happend (diff) | |
download | cuberite-Sponge.tar cuberite-Sponge.tar.gz cuberite-Sponge.tar.bz2 cuberite-Sponge.tar.lz cuberite-Sponge.tar.xz cuberite-Sponge.tar.zst cuberite-Sponge.zip |
Diffstat (limited to 'tests/Network')
-rw-r--r-- | tests/Network/EchoServer.cpp | 15 | ||||
-rw-r--r-- | tests/Network/Google.cpp | 15 | ||||
-rw-r--r-- | tests/Network/NameLookup.cpp | 12 |
3 files changed, 39 insertions, 3 deletions
diff --git a/tests/Network/EchoServer.cpp b/tests/Network/EchoServer.cpp index 728db0b7c..2a420fbac 100644 --- a/tests/Network/EchoServer.cpp +++ b/tests/Network/EchoServer.cpp @@ -7,6 +7,7 @@ #include <iostream> #include <string> #include "OSSupport/Network.h" +#include "OSSupport/NetworkSingleton.h" @@ -98,7 +99,7 @@ class cEchoServerCallbacks: -int main() +static void DoTest(void) { LOGD("EchoServer: starting up"); cServerHandlePtr Server = cNetwork::Listen(9876, std::make_shared<cEchoServerCallbacks>()); @@ -118,10 +119,22 @@ int main() LOG("Server terminating."); Server->Close(); ASSERT(!Server->IsListening()); + Server.reset(); LOGD("Server has been closed."); +} + + + + + +int main() +{ + DoTest(); printf("Press enter to exit test.\n"); + AString line; std::getline(std::cin, line); + cNetworkSingleton::Get().Terminate(); LOG("Network test finished."); return 0; diff --git a/tests/Network/Google.cpp b/tests/Network/Google.cpp index 2b8830c24..ab366f9e2 100644 --- a/tests/Network/Google.cpp +++ b/tests/Network/Google.cpp @@ -7,6 +7,7 @@ #include <thread> #include "OSSupport/Event.h" #include "OSSupport/Network.h" +#include "OSSupport/NetworkSingleton.h" @@ -96,7 +97,7 @@ public: -int main() +static void DoTest(void) { cEvent evtFinish; @@ -109,7 +110,19 @@ int main() LOGD("Connect request has been queued."); evtFinish.Wait(); +} + + + + + +int main() +{ + DoTest(); + + cNetworkSingleton::Get().Terminate(); LOGD("Network test finished"); + return 0; } diff --git a/tests/Network/NameLookup.cpp b/tests/Network/NameLookup.cpp index 822a96baf..4781a59ec 100644 --- a/tests/Network/NameLookup.cpp +++ b/tests/Network/NameLookup.cpp @@ -7,6 +7,7 @@ #include <thread> #include "OSSupport/Event.h" #include "OSSupport/Network.h" +#include "OSSupport/NetworkSingleton.h" @@ -45,7 +46,7 @@ public: -int main() +static void DoTest(void) { cEvent evtFinish; @@ -70,7 +71,16 @@ int main() LOGD("IP lookup has been successfully queued"); evtFinish.Wait(); LOGD("IP lookup finished."); +} + + + + +int main() +{ + DoTest(); + cNetworkSingleton::Get().Terminate(); LOGD("Network test finished"); return 0; } |