JayBeams  0.1
Another project to have fun coding.
ut_ipo_quoting_period_update_message.cpp
Go to the documentation of this file.
3 
4 #include <boost/test/unit_test.hpp>
5 
6 /**
7  * @test Verify that the jb::itch5::ipo_quoting_period_update_message
8  * decoder works as expected.
9  */
10 BOOST_AUTO_TEST_CASE(decode_ipo_quoting_period_update_message) {
11  using namespace jb::itch5;
12  using namespace std::chrono;
13 
16  auto expected_release =
17  duration_cast<seconds>(hours(13) + minutes(43) + seconds(25));
18 
20  buf.second, buf.first, 0);
21  BOOST_CHECK_EQUAL(
23  BOOST_CHECK_EQUAL(x.header.stock_locate, 0);
24  BOOST_CHECK_EQUAL(x.header.tracking_number, 1);
25  BOOST_CHECK_EQUAL(x.header.timestamp.ts.count(), expected_ts.count());
26  BOOST_CHECK_EQUAL(x.stock, "HSART");
27  BOOST_CHECK_EQUAL(
28  x.ipo_quotation_release_time.seconds().count(), expected_release.count());
29  BOOST_CHECK_EQUAL(x.ipo_quotation_release_qualifier, u'A');
30  BOOST_CHECK_EQUAL(x.ipo_price, price4_t(1230500));
31 
33  buf.second, buf.first, 0);
34  BOOST_CHECK_EQUAL(
36  BOOST_CHECK_EQUAL(x.header.stock_locate, 0);
37  BOOST_CHECK_EQUAL(x.header.tracking_number, 1);
38  BOOST_CHECK_EQUAL(x.header.timestamp.ts.count(), expected_ts.count());
39  BOOST_CHECK_EQUAL(x.stock, "HSART");
40  BOOST_CHECK_EQUAL(
41  x.ipo_quotation_release_time.seconds().count(), expected_release.count());
42  BOOST_CHECK_EQUAL(x.ipo_quotation_release_qualifier, u'A');
43  BOOST_CHECK_EQUAL(x.ipo_price, price4_t(1230500));
44 }
45 
46 /**
47  * @test Verify that jb::itch5::ipo_quoting_period_update_message iostream
48  * operator works as expected.
49  */
50 BOOST_AUTO_TEST_CASE(stream_ipo_quoting_period_update_message) {
51  using namespace std::chrono;
52  using namespace jb::itch5;
53 
56  buf.second, buf.first, 0);
57  std::ostringstream os;
58  os << tmp;
59  BOOST_CHECK_EQUAL(
60  os.str(), "message_type=K,stock_locate=0"
61  ",tracking_number=1,timestamp=113231.123456789"
62  ",stock=HSART"
63  ",ipo_quotation_release_time=13:43:25"
64  ",ipo_quotation_release_qualifier=A"
65  ",ipo_price=123.0500");
66 }
67 
68 /**
69  * @test Verify that ipo_quotation_release_qualifier_t works as expected.
70  */
71 BOOST_AUTO_TEST_CASE(simple_ipo_quotation_release_qualifier) {
72  using namespace jb::itch5;
73  BOOST_CHECK_NO_THROW(ipo_quotation_release_qualifier_t(u'A'));
74  BOOST_CHECK_NO_THROW(ipo_quotation_release_qualifier_t(u'C'));
75  BOOST_CHECK_THROW(
76  ipo_quotation_release_qualifier_t(u'*'), std::runtime_error);
77 }
static T r(std::size_t size, void const *msg, std::size_t offset)
Read a single message or field.
Contains classes and functions to parse NASDAQ ITCH-5.0 messages, more information about ITCH-5...
BOOST_AUTO_TEST_CASE(decode_ipo_quoting_period_update_message)
std::chrono::nanoseconds expected_ts()
Return the expected timestamp for all the test messages.
Definition: data.cpp:19
std::pair< char const *, std::size_t > ipo_quoting_period_update()
Definition: data.cpp:87
char_list_field< u 'A', u 'C'> ipo_quotation_release_qualifier_t
Represent the &#39;IPO Quotation Release Qualifier&#39; field on a &#39;IPO Quoting Period Update&#39; message...