3 #include <boost/test/unit_test.hpp> 15 std::memset(buffer, 0,
sizeof(buffer));
16 std::memcpy(buffer,
"AB ", 4);
17 auto actual = decoder<true, tested>::r(16, buffer, 0);
18 BOOST_CHECK_EQUAL(actual.c_str(),
"AB");
20 actual = decoder<false, tested>::r(16, buffer, 0);
21 BOOST_CHECK_EQUAL(actual.c_str(),
"AB");
23 BOOST_CHECK_NO_THROW((decoder<true, tested>::r(16, buffer, 2)));
25 (decoder<true, tested>::r(16, buffer, 13)), std::runtime_error);
26 BOOST_CHECK_NO_THROW((decoder<false, tested>::r(16, buffer, 13)));
30 std::memset(buffer, 0,
sizeof(buffer));
31 std::memcpy(buffer,
"ABCD", 4);
32 auto actual = decoder<true, tested>::r(16, buffer, 0);
33 BOOST_CHECK_EQUAL(actual.c_str(),
"ABCD");
35 actual = decoder<false, tested>::r(16, buffer, 0);
36 BOOST_CHECK_EQUAL(actual.c_str(),
"ABCD");
45 struct simple_validator {
46 bool operator()(
char const* rhs)
const {
47 return std::string(rhs) ==
"AA" or std::string(rhs) ==
"ABCD";
55 std::memset(buffer, 0,
sizeof(buffer));
56 std::memcpy(buffer,
"ABCD", 4);
58 BOOST_CHECK_EQUAL(actual.c_str(),
"ABCD");
60 std::memset(buffer, 0,
sizeof(buffer));
61 std::memcpy(buffer,
"ABC", 4);
77 std::memset(buffer, 0,
sizeof(buffer));
78 std::memcpy(buffer,
"AB ", 4);
81 std::ostringstream os;
83 BOOST_CHECK_EQUAL(os.str(),
"AB");
87 std::memset(buffer, 0,
sizeof(buffer));
88 std::memcpy(buffer,
"ABCD", 4);
91 std::ostringstream os;
93 BOOST_CHECK_EQUAL(os.str(),
"ABCD");
Contains classes and functions to parse NASDAQ ITCH-5.0 messages, more information about ITCH-5...
Define the interface to decode ITCH-5.0 messages and message fields.
BOOST_AUTO_TEST_CASE(decode_short_string_field)