Changeset View
Changeset View
Standalone View
Standalone View
src/test/serialize_tests.cpp
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(varints) { | ||||
// decode | // decode | ||||
for (int i = 0; i < 100000; i++) { | for (int i = 0; i < 100000; i++) { | ||||
int j = -1; | int j = -1; | ||||
ss >> VARINT(j, VarIntMode::NONNEGATIVE_SIGNED); | ss >> VARINT(j, VarIntMode::NONNEGATIVE_SIGNED); | ||||
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i); | BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i); | ||||
} | } | ||||
for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) { | for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) { | ||||
uint64_t j = -1; | uint64_t j = std::numeric_limits<uint64_t>::max(); | ||||
ss >> VARINT(j); | ss >> VARINT(j); | ||||
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i); | BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i); | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(varints_bitpatterns) { | BOOST_AUTO_TEST_CASE(varints_bitpatterns) { | ||||
CDataStream ss(SER_DISK, 0); | CDataStream ss(SER_DISK, 0); | ||||
ss << VARINT(0, VarIntMode::NONNEGATIVE_SIGNED); | ss << VARINT(0, VarIntMode::NONNEGATIVE_SIGNED); | ||||
▲ Show 20 Lines • Show All 221 Lines • Show Last 20 Lines |