Convert all remaining enums to enum classes (!)
This commit is contained in:
@@ -27,7 +27,7 @@ SCENARIO("IpAddress", "[NETWORK][IPADDRESS]")
|
||||
{
|
||||
WHEN("We get the IP of Nazara")
|
||||
{
|
||||
std::vector<Nz::HostnameInfo> hostnameInfos = Nz::IpAddress::ResolveHostname(Nz::NetProtocol_IPv4, "nazara.digitalpulsesoftware.net");
|
||||
std::vector<Nz::HostnameInfo> hostnameInfos = Nz::IpAddress::ResolveHostname(Nz::NetProtocol::IPv4, "nazara.digitalpulsesoftware.net");
|
||||
|
||||
THEN("Result is not null")
|
||||
{
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#include <Nazara/Network/RUdpConnection.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
SCENARIO("RUdpConnection", "[NETWORK][RUDPCONNECTION]")
|
||||
{
|
||||
GIVEN("Two RUdpConnection, one client, one server")
|
||||
{
|
||||
// Disabled for now
|
||||
|
||||
/*Nz::UInt16 port = 64266;
|
||||
Nz::RUdpConnection server;
|
||||
REQUIRE(server.Listen(Nz::NetProtocol_IPv4, port));
|
||||
|
||||
Nz::IpAddress serverIP(Nz::IpAddress::LoopbackIpV4.ToIPv4(), port);
|
||||
REQUIRE(serverIP.IsValid());
|
||||
|
||||
Nz::RUdpConnection client;
|
||||
REQUIRE(client.Listen(Nz::NetProtocol_IPv4, port + 1));
|
||||
|
||||
Nz::IpAddress clientIP = client.GetBoundAddress();
|
||||
REQUIRE(client.Connect(serverIP));
|
||||
REQUIRE(clientIP.IsValid());
|
||||
|
||||
WHEN("We send data from client")
|
||||
{
|
||||
Nz::NetPacket packet(1);
|
||||
Nz::Vector3f vector123(1.f, 2.f, 3.f);
|
||||
packet << vector123;
|
||||
REQUIRE(client.Send(serverIP, Nz::PacketPriority_Immediate, Nz::PacketReliability_Reliable, packet));
|
||||
client.Update();
|
||||
|
||||
THEN("We should get it on the server")
|
||||
{
|
||||
Nz::RUdpMessage rudpMessage;
|
||||
server.Update();
|
||||
|
||||
REQUIRE(server.PollMessage(&rudpMessage));
|
||||
|
||||
Nz::Vector3f result;
|
||||
rudpMessage.data >> result;
|
||||
REQUIRE(result == vector123);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ SCENARIO("SocketPoller", "[NETWORK][SOCKETPOLLER]")
|
||||
Nz::TcpServer server;
|
||||
server.EnableBlocking(false);
|
||||
|
||||
REQUIRE(server.Listen(Nz::NetProtocol_IPv4, port) == Nz::SocketState_Bound);
|
||||
REQUIRE(server.Listen(Nz::NetProtocol::IPv4, port) == Nz::SocketState::Bound);
|
||||
|
||||
Nz::IpAddress serverIP(Nz::IpAddress::LoopbackIpV4.ToIPv4(), port);
|
||||
REQUIRE(serverIP.IsValid());
|
||||
@@ -27,7 +27,7 @@ SCENARIO("SocketPoller", "[NETWORK][SOCKETPOLLER]")
|
||||
|
||||
WHEN("We register the server socket to the poller")
|
||||
{
|
||||
REQUIRE(serverPoller.RegisterSocket(server, Nz::SocketPollEvent_Read));
|
||||
REQUIRE(serverPoller.RegisterSocket(server, Nz::SocketPollEvent::Read));
|
||||
|
||||
THEN("The poller should have registered our socket")
|
||||
{
|
||||
@@ -37,7 +37,7 @@ SCENARIO("SocketPoller", "[NETWORK][SOCKETPOLLER]")
|
||||
{
|
||||
Nz::SocketState state = clientToServer.Connect(serverIP);
|
||||
|
||||
CHECK(state != Nz::SocketState_NotConnected);
|
||||
CHECK(state != Nz::SocketState::NotConnected);
|
||||
|
||||
AND_THEN("We wait on our selector, it should return true")
|
||||
{
|
||||
@@ -48,7 +48,7 @@ SCENARIO("SocketPoller", "[NETWORK][SOCKETPOLLER]")
|
||||
|
||||
WHEN("We register the client socket to the poller")
|
||||
{
|
||||
REQUIRE(serverPoller.RegisterSocket(serverToClient, Nz::SocketPollEvent_Read));
|
||||
REQUIRE(serverPoller.RegisterSocket(serverToClient, Nz::SocketPollEvent::Read));
|
||||
|
||||
THEN("The poller should have registered our socket")
|
||||
{
|
||||
|
||||
@@ -19,13 +19,13 @@ SCENARIO("TCP", "[NETWORK][TCP]")
|
||||
Nz::TcpServer server;
|
||||
server.EnableBlocking(false);
|
||||
|
||||
REQUIRE(server.Listen(Nz::NetProtocol_IPv4, port) == Nz::SocketState_Bound);
|
||||
REQUIRE(server.Listen(Nz::NetProtocol::IPv4, port) == Nz::SocketState::Bound);
|
||||
|
||||
Nz::IpAddress serverIP(Nz::IpAddress::LoopbackIpV4.ToIPv4(), port);
|
||||
REQUIRE(serverIP.IsValid());
|
||||
|
||||
Nz::TcpClient client;
|
||||
REQUIRE(client.Connect(serverIP) == Nz::SocketState_Connecting);
|
||||
REQUIRE(client.Connect(serverIP) == Nz::SocketState::Connecting);
|
||||
|
||||
Nz::IpAddress clientIP = client.GetRemoteAddress();
|
||||
CHECK(clientIP.IsValid());
|
||||
|
||||
@@ -12,14 +12,14 @@ SCENARIO("UdpSocket", "[NETWORK][UDPSOCKET]")
|
||||
std::uniform_int_distribution<Nz::UInt16> dis(1025, 65535);
|
||||
|
||||
Nz::UInt16 port = dis(rd);
|
||||
Nz::UdpSocket server(Nz::NetProtocol_IPv4);
|
||||
REQUIRE(server.Bind(port) == Nz::SocketState_Bound);
|
||||
Nz::UdpSocket server(Nz::NetProtocol::IPv4);
|
||||
REQUIRE(server.Bind(port) == Nz::SocketState::Bound);
|
||||
|
||||
Nz::IpAddress serverIP(Nz::IpAddress::LoopbackIpV4.ToIPv4(), port);
|
||||
REQUIRE(serverIP.IsValid());
|
||||
|
||||
Nz::UdpSocket client(Nz::NetProtocol_IPv4);
|
||||
REQUIRE(client.Bind(port + 1) == Nz::SocketState_Bound);
|
||||
Nz::UdpSocket client(Nz::NetProtocol::IPv4);
|
||||
REQUIRE(client.Bind(port + 1) == Nz::SocketState::Bound);
|
||||
|
||||
Nz::IpAddress clientIP = client.GetBoundAddress();
|
||||
REQUIRE(clientIP.IsValid());
|
||||
|
||||
Reference in New Issue
Block a user