Skip to content

Commit

Permalink
Ported test case from STEEM
Browse files Browse the repository at this point in the history
  • Loading branch information
pmconrad committed Dec 28, 2018
1 parent fb75dc9 commit 90f8ad5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/serialization_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,24 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )

} FC_CAPTURE_LOG_AND_RETHROW ( (0) ) }

BOOST_AUTO_TEST_CASE( unpack_recursion_test )
{
try
{
std::stringstream ss;
int recursion_level = 100000;
uint64_t allocation_per_level = 500000;

for ( int i = 0; i < recursion_level; i++ )
{
fc::raw::pack( ss, fc::unsigned_int( allocation_per_level ) );
fc::raw::pack( ss, static_cast< uint8_t >( fc::variant::array_type ) );
}

std::vector< fc::variant > v;
BOOST_REQUIRE_THROW( fc::raw::unpack( ss, v ), fc::assert_exception );
}
FC_LOG_AND_RETHROW();
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 90f8ad5

Please sign in to comment.