Changeset View
Changeset View
Standalone View
Standalone View
src/test/streams_tests.cpp
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(streams_vector_writer) { | ||||
vch.resize(4, 0); | vch.resize(4, 0); | ||||
CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 4, a, b); | CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 4, a, b); | ||||
BOOST_CHECK((vch == std::vector<uint8_t>{{0, 0, 0, 0, 1, 2}})); | BOOST_CHECK((vch == std::vector<uint8_t>{{0, 0, 0, 0, 1, 2}})); | ||||
CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 4, a, b); | CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 4, a, b); | ||||
BOOST_CHECK((vch == std::vector<uint8_t>{{0, 0, 0, 0, 1, 2}})); | BOOST_CHECK((vch == std::vector<uint8_t>{{0, 0, 0, 0, 1, 2}})); | ||||
vch.clear(); | vch.clear(); | ||||
CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, FLATDATA(bytes)); | CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, bytes); | ||||
BOOST_CHECK((vch == std::vector<uint8_t>{{3, 4, 5, 6}})); | BOOST_CHECK((vch == std::vector<uint8_t>{{3, 4, 5, 6}})); | ||||
CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, FLATDATA(bytes)); | CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, bytes); | ||||
BOOST_CHECK((vch == std::vector<uint8_t>{{3, 4, 5, 6}})); | BOOST_CHECK((vch == std::vector<uint8_t>{{3, 4, 5, 6}})); | ||||
vch.clear(); | vch.clear(); | ||||
vch.resize(4, 8); | vch.resize(4, 8); | ||||
CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, FLATDATA(bytes), | CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, bytes, b); | ||||
b); | |||||
BOOST_CHECK((vch == std::vector<uint8_t>{{8, 8, 1, 3, 4, 5, 6, 2}})); | BOOST_CHECK((vch == std::vector<uint8_t>{{8, 8, 1, 3, 4, 5, 6, 2}})); | ||||
CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, FLATDATA(bytes), | CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, bytes, b); | ||||
b); | |||||
BOOST_CHECK((vch == std::vector<uint8_t>{{8, 8, 1, 3, 4, 5, 6, 2}})); | BOOST_CHECK((vch == std::vector<uint8_t>{{8, 8, 1, 3, 4, 5, 6, 2}})); | ||||
vch.clear(); | vch.clear(); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(streams_vector_reader) { | BOOST_AUTO_TEST_CASE(streams_vector_reader) { | ||||
std::vector<uint8_t> vch = {1, 255, 3, 4, 5, 6}; | std::vector<uint8_t> vch = {1, 255, 3, 4, 5, 6}; | ||||
VectorReader reader(SER_NETWORK, INIT_PROTO_VERSION, vch, 0); | VectorReader reader(SER_NETWORK, INIT_PROTO_VERSION, vch, 0); | ||||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |