File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -553,3 +553,21 @@ TEST(limit, unpacker_array_over)
553553 EXPECT_TRUE (false );
554554 }
555555}
556+
557+ TEST (limit, unpacker_reserve)
558+ {
559+ msgpack::unpacker u (nullptr , nullptr , MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
560+ msgpack::unpack_limit ());
561+ std::size_t original_capacity = u.buffer_capacity ();
562+ u.reserve_buffer (original_capacity + 1u );
563+ EXPECT_EQ ((original_capacity + COUNTER_SIZE) * 2 - COUNTER_SIZE, u.buffer_capacity ());
564+ }
565+
566+ TEST (limit, unpacker_reserve_more_than_twice)
567+ {
568+ msgpack::unpacker u (nullptr , nullptr , MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
569+ msgpack::unpack_limit ());
570+ std::size_t original_capacity = u.buffer_capacity ();
571+ u.reserve_buffer (original_capacity * 3 );
572+ EXPECT_EQ ((original_capacity + COUNTER_SIZE) * 4 - COUNTER_SIZE, u.buffer_capacity ());
573+ }
You can’t perform that action at this time.
0 commit comments