mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
test: Add test for array serialization
This commit is contained in:
parent
d49d198840
commit
1e5b86171e
1 changed files with 12 additions and 0 deletions
|
@ -85,6 +85,8 @@ BOOST_AUTO_TEST_CASE(sizes)
|
|||
BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 1>{0}, 0), 1U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 2>{0, 0}, 0), 2U);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(varints)
|
||||
|
@ -179,6 +181,16 @@ BOOST_AUTO_TEST_CASE(vector_bool)
|
|||
BOOST_CHECK((HashWriter{} << vec1).GetHash() == (HashWriter{} << vec2).GetHash());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(array)
|
||||
{
|
||||
std::array<uint8_t, 32> array1{1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1};
|
||||
DataStream ds;
|
||||
ds << array1;
|
||||
std::array<uint8_t, 32> array2;
|
||||
ds >> array2;
|
||||
BOOST_CHECK(array1 == array2);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(noncanonical)
|
||||
{
|
||||
// Write some non-canonical CompactSize encodings, and
|
||||
|
|
Loading…
Add table
Reference in a new issue