JayBeams  0.1
Another project to have fun coding.
ut_make_socket_udp_common.cpp
Go to the documentation of this file.
2 
4 #include <boost/test/unit_test.hpp>
5 
6 using namespace ::testing;
8 
9 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_basic) {
10  boost::asio::io_service io;
11 
12  // Create a mock socket and configure it with different options ...
13  mock_udp_socket socket(io);
15 }
16 
17 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_debug) {
18  boost::asio::io_service io;
19 
20  // Create a mock socket and configure it with different options ...
21  mock_udp_socket socket(io);
22  EXPECT_CALL(socket, set_option(An<boost::asio::socket_base::debug const&>()));
24  socket, jb::itch5::udp_config_common().debug(true));
25 }
26 
27 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_linger) {
28  boost::asio::io_service io;
29 
30  // Create a mock socket and configure it with different options ...
31  mock_udp_socket socket(io);
32  EXPECT_CALL(
33  socket, set_option(An<boost::asio::socket_base::linger const&>()));
35  socket, jb::itch5::udp_config_common().linger(true).linger_seconds(30));
36 }
37 
38 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_rcvbuf) {
39  boost::asio::io_service io;
40 
41  // Create a mock socket and configure it with different options ...
42  mock_udp_socket socket(io);
43  EXPECT_CALL(
44  socket,
45  set_option(An<boost::asio::socket_base::receive_buffer_size const&>()));
47  socket, jb::itch5::udp_config_common().receive_buffer_size(8192));
48 }
49 
50 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_sndbuf) {
51  boost::asio::io_service io;
52 
53  // Create a mock socket and configure it with different options ...
54  mock_udp_socket socket(io);
55  EXPECT_CALL(
56  socket,
57  set_option(An<boost::asio::socket_base::send_buffer_size const&>()));
59  socket, jb::itch5::udp_config_common().send_buffer_size(8192));
60 }
61 
62 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_rcvlow) {
63  boost::asio::io_service io;
64 
65  // Create a mock socket and configure it with different options ...
66  mock_udp_socket socket(io);
67  EXPECT_CALL(
68  socket,
69  set_option(An<boost::asio::socket_base::receive_low_watermark const&>()));
71  socket, jb::itch5::udp_config_common().receive_low_watermark(8192));
72 }
73 
74 BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_sndlow) {
75  boost::asio::io_service io;
76 
77  // Create a mock socket and configure it with different options ...
78  mock_udp_socket socket(io);
79  EXPECT_CALL(
80  socket,
81  set_option(An<boost::asio::socket_base::send_low_watermark const&>()));
83  socket, jb::itch5::udp_config_common().send_low_watermark(8192));
84 }
A Mock Object for the socket class.
BOOST_AUTO_TEST_CASE(itch5_make_socket_udp_common_basic)
void make_socket_udp_common(socket_t &s, udp_config_common const &cfg)
Configure a UDP socket.
Common configuration parameters for both UDP senders and receivers.