From d827477de2820cf246334acd18bcddd6b154b1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Thu, 24 Feb 2022 13:03:30 +0100 Subject: [PATCH] UnitTests/TCPTest: Don't use a random port --- tests/Engine/Network/TCPTest.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/Engine/Network/TCPTest.cpp b/tests/Engine/Network/TCPTest.cpp index 934b66fd5..a8d5a4348 100644 --- a/tests/Engine/Network/TCPTest.cpp +++ b/tests/Engine/Network/TCPTest.cpp @@ -4,24 +4,18 @@ #include #include #include -#include #include SCENARIO("TCP", "[NETWORK][TCP]") { GIVEN("Two TCP, one client, one server") { - std::random_device rd; - std::uniform_int_distribution dis(1025, 65535); - - Nz::UInt16 port = dis(rd); - Nz::TcpServer server; server.EnableBlocking(false); - REQUIRE(server.Listen(Nz::NetProtocol::IPv4, port) == Nz::SocketState::Bound); + REQUIRE(server.Listen(Nz::NetProtocol::IPv4, 0) == Nz::SocketState::Bound); - Nz::IpAddress serverIP(Nz::IpAddress::LoopbackIpV4.ToIPv4(), port); + Nz::IpAddress serverIP(Nz::IpAddress::LoopbackIpV4.ToIPv4(), server.GetBoundPort()); REQUIRE(serverIP.IsValid()); Nz::TcpClient client;