From 90d6d742823b3f00163bc406b830a29edf40a5ec Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 22 Aug 2023 00:40:33 -0600 Subject: [PATCH] Add tests for `sf::TcpSocket` --- test/Network/TcpSocket.test.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/test/Network/TcpSocket.test.cpp b/test/Network/TcpSocket.test.cpp index 4d9079bf..583b04b0 100644 --- a/test/Network/TcpSocket.test.cpp +++ b/test/Network/TcpSocket.test.cpp @@ -1,8 +1,27 @@ #include +// Other 1st party headers +#include + +#include + #include -static_assert(!std::is_copy_constructible_v); -static_assert(!std::is_copy_assignable_v); -static_assert(std::is_nothrow_move_constructible_v); -static_assert(std::is_nothrow_move_assignable_v); +TEST_CASE("[Network] sf::TcpSocket") +{ + SECTION("Type traits") + { + STATIC_CHECK(!std::is_copy_constructible_v); + STATIC_CHECK(!std::is_copy_assignable_v); + STATIC_CHECK(std::is_nothrow_move_constructible_v); + STATIC_CHECK(std::is_nothrow_move_assignable_v); + } + + SECTION("Construction") + { + const sf::TcpSocket tcpSocket; + CHECK(tcpSocket.getLocalPort() == 0); + CHECK(!tcpSocket.getRemoteAddress().has_value()); + CHECK(tcpSocket.getRemotePort() == 0); + } +}