mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 07:31:35 +02:00
Improve unpack reserve handling
(cherry picked from commit 54229196bd11913ef0ac2c44b9f090cf619d29d8)
This commit is contained in:
@@ -304,6 +304,20 @@ TEST(Serialization, serializes_vector_int64_as_fixed_int)
|
||||
ASSERT_EQ(57, blob.size());
|
||||
}
|
||||
|
||||
TEST(Serialization, deserializes_vector_reserve)
|
||||
{
|
||||
std::vector<int64_t> v;
|
||||
string blob;
|
||||
|
||||
tools::write_varint(std::back_inserter(blob), unsigned(100));
|
||||
blob.append(std::string(100, 0));
|
||||
|
||||
ASSERT_LT(v.capacity(), 20);
|
||||
ASSERT_FALSE(serialization::parse_binary(blob, v));
|
||||
ASSERT_LT(v.capacity(), 100); // could fail if lib allocates more in reserve call
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user