JayBeams  0.1
Another project to have fun coding.
ut_delete_order_message.cpp
Go to the documentation of this file.
2 
3 #include <boost/test/unit_test.hpp>
4 #include <type_traits>
5 
6 /**
7  * @test Verify that jb::pitch2::delete_order_message works as expected.
8  */
9 BOOST_AUTO_TEST_CASE(delete_order_message_basic) {
10  using namespace jb::pitch2;
11  BOOST_CHECK_EQUAL(true, std::is_pod<delete_order_message>::value);
12  BOOST_CHECK_EQUAL(sizeof(delete_order_message), std::size_t(14));
13 
14  char const buf[] = u8"\x0E" // Length (14)
15  "\x29" // Message Type (41)
16  "\x18\xD2\x06\x00" // Time Offset (447,000)
17  "\x05\x40\x5B\x77\x8F\x56\x1D\x0B" // Order Id
18  ;
20  BOOST_REQUIRE_EQUAL(sizeof(buf) - 1, sizeof(msg));
21  std::memcpy(&msg, buf, sizeof(msg));
22  BOOST_CHECK_EQUAL(int(msg.length.value()), 14);
23  BOOST_CHECK_EQUAL(int(msg.message_type.value()), 41);
24  BOOST_CHECK_EQUAL(msg.time_offset.value(), 447000);
25  BOOST_CHECK_EQUAL(msg.order_id.value(), 0x0B1D568F775B4005ULL);
26 
27  std::ostringstream os;
28  os << msg;
29  BOOST_CHECK_EQUAL(
30  os.str(), std::string("length=14,message_type=41,time_offset=447000,"
31  "order_id=800891482924597253"));
32 }
boost::endian::little_uint8_buf_t length
boost::endian::little_uint32_buf_t time_offset
Represent the &#39;Delete Order&#39; message in the PITCH-2.X protocol.
boost::endian::little_uint8_buf_t message_type
boost::endian::little_uint64_buf_t order_id
BOOST_AUTO_TEST_CASE(delete_order_message_basic)