File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,16 @@ BOOST_AUTO_TEST_CASE(lockedpool_tests_mock)
166166 BOOST_CHECK (pool.stats ().total == 0 );
167167 BOOST_CHECK (pool.stats ().locked == 0 );
168168
169+ // Ensure unreasonable requests are refused without allocating anything
170+ void *invalid_toosmall = pool.alloc (0 );
171+ BOOST_CHECK (invalid_toosmall == nullptr );
172+ BOOST_CHECK (pool.stats ().used == 0 );
173+ BOOST_CHECK (pool.stats ().free == 0 );
174+ void *invalid_toobig = pool.alloc (LockedPool::ARENA_SIZE+1 );
175+ BOOST_CHECK (invalid_toobig == nullptr );
176+ BOOST_CHECK (pool.stats ().used == 0 );
177+ BOOST_CHECK (pool.stats ().free == 0 );
178+
169179 void *a0 = pool.alloc (LockedPool::ARENA_SIZE / 2 );
170180 BOOST_CHECK (a0);
171181 BOOST_CHECK (pool.stats ().locked == LockedPool::ARENA_SIZE);
You can’t perform that action at this time.
0 commit comments