Commit b02a48f0 authored by hydratim's avatar hydratim

Rebased onto upstream/master and modified test

parent 0d42ab85
......@@ -123,19 +123,6 @@ TEST(listener_test, listener_bind_port_free) {
ASSERT_TRUE(true);
}
TEST(listener_test, listener_bind_ephemeral_v6_port) {
Pistache::Port port(0);
Pistache::Address address(Pistache::Ipv6::any(), port);
Pistache::Tcp::Listener listener;
if (not listener.systemSupportsIpv6()) {
Pistache::Flags<Pistache::Tcp::Options> options;
listener.init(1, options);
listener.setHandler(Pistache::Http::make_handler<DummyHandler>());
listener.bind(address);
}
ASSERT_TRUE(true);
}
// Listener should not crash if an additional member is added to the listener class. This test
// is there to prevent regression for PR 303
......@@ -194,6 +181,7 @@ TEST(listener_test, listener_bind_port_not_free_throw_runtime) {
}
}
// Listener should be able to bind port 0 directly to get an ephemeral port.
TEST(listener_test, listener_bind_ephemeral_port) {
Pistache::Port port(0);
......@@ -206,3 +194,20 @@ TEST(listener_test, listener_bind_ephemeral_port) {
Pistache::Port bound_port = listener.getPort();
ASSERT_TRUE(bound_port > (uint16_t)0);
}
TEST(listener_test, listener_bind_ephemeral_v6_port) {
Pistache::Port port(0);
Pistache::Address address(Pistache::Ipv6::any(), port);
Pistache::Tcp::Listener listener;
if (not listener.systemSupportsIpv6()) {
Pistache::Flags<Pistache::Tcp::Options> options;
listener.setHandler(Pistache::Http::make_handler<DummyHandler>());
listener.bind(address);
Pistache::Port bound_port = listener.getPort();
ASSERT_TRUE(bound_port > (uint16_t)0);
}
ASSERT_TRUE(true);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment