aboutsummaryrefslogtreecommitdiffstats
path: root/unittests/Host/SocketTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Host/SocketTest.cpp')
-rw-r--r--unittests/Host/SocketTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/Host/SocketTest.cpp b/unittests/Host/SocketTest.cpp
index d8fdc593ed46..59f59fc0ada7 100644
--- a/unittests/Host/SocketTest.cpp
+++ b/unittests/Host/SocketTest.cpp
@@ -220,3 +220,14 @@ TEST_F(SocketTest, UDPConnect) {
EXPECT_TRUE(error.Success());
EXPECT_TRUE(socket_up->IsValid());
}
+
+TEST_F(SocketTest, TCPListen0GetPort) {
+ Socket *server_socket;
+ Predicate<uint16_t> port_predicate;
+ port_predicate.SetValue(0, eBroadcastNever);
+ Status err =
+ Socket::TcpListen("10.10.12.3:0", false, server_socket, &port_predicate);
+ std::unique_ptr<TCPSocket> socket_up((TCPSocket*)server_socket);
+ EXPECT_TRUE(socket_up->IsValid());
+ EXPECT_NE(socket_up->GetLocalPortNumber(), 0);
+}