4 #include <boost/test/unit_test.hpp> 10 boost::asio::io_service io;
13 BOOST_CHECK(socket.is_open());
25 using namespace ::testing;
26 NiceMock<mock_udp_socket> socket;
27 EXPECT_CALL(socket, open(_)).Times(1);
28 EXPECT_CALL(socket, bind(_)).Times(1);
30 socket, set_option(An<boost::asio::ip::multicast::join_group const&>()))
34 set_option(An<boost::asio::ip::multicast::enable_loopback const&>()))
42 using namespace ::testing;
43 NiceMock<mock_udp_socket> socket;
44 EXPECT_CALL(socket, open(_)).Times(1);
46 socket, bind(boost::asio::ip::udp::endpoint(
47 boost::asio::ip::address_v4(), 50000)))
50 socket, set_option(An<boost::asio::ip::multicast::join_group const&>()))
54 set_option(An<boost::asio::ip::multicast::enable_loopback const&>()))
64 using namespace ::testing;
65 NiceMock<mock_udp_socket> socket;
66 EXPECT_CALL(socket, open(_)).Times(1);
68 socket, bind(boost::asio::ip::udp::endpoint(
69 boost::asio::ip::address_v6(), 50000)))
72 socket, set_option(An<boost::asio::ip::multicast::join_group const&>()))
76 set_option(An<boost::asio::ip::multicast::enable_loopback const&>()))
85 using namespace ::testing;
86 NiceMock<mock_udp_socket> socket;
87 char const*
interface = "2001:db8:ca2:2::1";
88 EXPECT_CALL(socket, open(_)).Times(1);
90 socket, bind(boost::asio::ip::udp::endpoint(
91 boost::asio::ip::address::from_string(interface), 50000)))
94 socket, set_option(An<boost::asio::ip::multicast::join_group const&>()))
98 set_option(An<boost::asio::ip::multicast::enable_loopback const&>()))
103 socket, jb::itch5::udp_receiver_config()
106 .local_address(interface));
A Mock Object for the socket class.
socket_t make_socket_udp_recv(boost::asio::io_service &io, udp_receiver_config const &cfg)
Create a socket given the configuration parameters.
jb::config_attribute< udp_receiver_config, std::string > address
BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_recv_compile)
A configuration object for UDP receivers.
void setup_socket_udp_recv(socket_t &socket, udp_receiver_config const &cfg)
Configure a socket to receive UDP packets.