Changeset View
Changeset View
Standalone View
Standalone View
src/test/allocator_tests.cpp
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
private: | private: | ||||
int count; | int count; | ||||
int lockedcount; | int lockedcount; | ||||
}; | }; | ||||
BOOST_AUTO_TEST_CASE(lockedpool_tests_mock) { | BOOST_AUTO_TEST_CASE(lockedpool_tests_mock) { | ||||
// Test over three virtual arenas, of which one will succeed being locked | // Test over three virtual arenas, of which one will succeed being locked | ||||
std::unique_ptr<LockedPageAllocator> x(new TestLockedPageAllocator(3, 1)); | auto x = std::make_unique<TestLockedPageAllocator>(3, 1); | ||||
LockedPool pool(std::move(x)); | LockedPool pool(std::move(x)); | ||||
BOOST_CHECK(pool.stats().total == 0); | BOOST_CHECK(pool.stats().total == 0); | ||||
BOOST_CHECK(pool.stats().locked == 0); | BOOST_CHECK(pool.stats().locked == 0); | ||||
// Ensure unreasonable requests are refused without allocating anything | // Ensure unreasonable requests are refused without allocating anything | ||||
void *invalid_toosmall = pool.alloc(0); | void *invalid_toosmall = pool.alloc(0); | ||||
BOOST_CHECK(invalid_toosmall == nullptr); | BOOST_CHECK(invalid_toosmall == nullptr); | ||||
BOOST_CHECK(pool.stats().used == 0); | BOOST_CHECK(pool.stats().used == 0); | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |