aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2026-03-14 12:24:55 -0400
committerLee *!* Clagett <code@leeclagett.com>2026-04-27 17:57:21 -0400
commit54229196bd11913ef0ac2c44b9f090cf619d29d8 (patch)
tree1ba50b674dade4470bd69779e06ef9cba3c05618 /tests
parent23b420a992417abb6131b3d152d7e32adf224351 (diff)
downloadmonzero-core-54229196bd11913ef0ac2c44b9f090cf619d29d8.tar.gz
monzero-core-54229196bd11913ef0ac2c44b9f090cf619d29d8.tar.xz
monzero-core-54229196bd11913ef0ac2c44b9f090cf619d29d8.zip
Improve unpack reserve handling
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/serialization.cpp14
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>