diff options
| author | tobtoht <tob@featherwallet.org> | 2026-04-27 23:09:10 +0000 |
|---|---|---|
| committer | tobtoht <tob@featherwallet.org> | 2026-04-27 23:09:10 +0000 |
| commit | 586e82bcc0f9491a14bb9b824248925d09f68c75 (patch) | |
| tree | 6a94f6cf2c507aa82c9dc9221fe78dd1196e524d /tests | |
| parent | 64b19b4b9a0004b0e7f8466d77c6597878778ebc (diff) | |
| parent | 54229196bd11913ef0ac2c44b9f090cf619d29d8 (diff) | |
| download | monzero-core-586e82bcc0f9491a14bb9b824248925d09f68c75.tar.gz monzero-core-586e82bcc0f9491a14bb9b824248925d09f68c75.tar.xz monzero-core-586e82bcc0f9491a14bb9b824248925d09f68c75.zip | |
Merge pull request #10367
5422919 Improve unpack reserve handling (Lee Clagett)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit_tests/serialization.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp index fdf603272..0cf0275e5 100644 --- a/tests/unit_tests/serialization.cpp +++ b/tests/unit_tests/serialization.cpp @@ -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> |
