JayBeams  0.1
Another project to have fun coding.
ut_mold_udp_pacer_config.cpp
Go to the documentation of this file.
2 
3 #include <chrono>
4 
5 #include <boost/test/unit_test.hpp>
6 
7 /**
8  * @test Verify that jb::itch5::mold_udp_pacer_config validation works
9  * as expected (also increase code coverage!).
10  */
11 BOOST_AUTO_TEST_CASE(itch5_mold_udp_pacer_config_validate) {
12  using config = jb::itch5::mold_udp_pacer_config;
13 
14  config default_validates;
15  BOOST_CHECK_NO_THROW(default_validates.validate());
16 
17  config mtu_too_small = config().maximum_transmission_unit(8);
18  BOOST_CHECK_THROW(mtu_too_small.validate(), jb::usage);
19 
20  config mtu_too_big = config().maximum_transmission_unit(100000);
21  BOOST_CHECK_THROW(mtu_too_big.validate(), jb::usage);
22 
23  config delay_too_small = config().maximum_delay_microseconds(0);
24  BOOST_CHECK_THROW(delay_too_small.validate(), jb::usage);
25 
26  using namespace std::chrono;
27  config delay_too_big = config().maximum_delay_microseconds(
28  duration_cast<microseconds>(minutes(5)).count());
29  BOOST_CHECK_THROW(delay_too_big.validate(), jb::usage);
30 }
A simple class to communicate the result of parsing the options.
Definition: usage.hpp:11
Configuration object for the jb::itch5::mold_udp_pacer class.
BOOST_AUTO_TEST_CASE(itch5_mold_udp_pacer_config_validate)
jb::config_attribute< mold_udp_pacer_config, int > maximum_transmission_unit