|
@ -3,6 +3,7 @@ |
|
|
#include "gp/array.hpp"
|
|
|
#include "gp/array.hpp"
|
|
|
#include "gp/indexed_array.hpp"
|
|
|
#include "gp/indexed_array.hpp"
|
|
|
#include "gp/allocator/aggregator.hpp"
|
|
|
#include "gp/allocator/aggregator.hpp"
|
|
|
|
|
|
#include "gp/allocator/arena.hpp"
|
|
|
#include "gp/allocator/buddy.hpp"
|
|
|
#include "gp/allocator/buddy.hpp"
|
|
|
#include "gp/allocator/dummy.hpp"
|
|
|
#include "gp/allocator/dummy.hpp"
|
|
|
#include "gp/algorithm/repeat.hpp"
|
|
|
#include "gp/algorithm/repeat.hpp"
|
|
@ -414,6 +415,35 @@ struct aggregator_test : public test_scaffold { |
|
|
} |
|
|
} |
|
|
auto duration = std::chrono::steady_clock::now() - start; |
|
|
auto duration = std::chrono::steady_clock::now() - start; |
|
|
} |
|
|
} |
|
|
|
|
|
void* a = allocator.allocate(8); |
|
|
|
|
|
gp_config::assertion(allocator.try_reallocate(a, 16) == false, "could reallocate? was it implemented?"); |
|
|
|
|
|
gp_config::assertion(allocator.deallocate(nullptr) == false, "error, could free an invalid pointer"); |
|
|
|
|
|
allocator.deallocate(a); |
|
|
|
|
|
{ |
|
|
|
|
|
gp::ring_list<int, gp::aggregator, false> list{allocator}; |
|
|
|
|
|
list.insert(8); |
|
|
|
|
|
list.insert(16); |
|
|
|
|
|
list.insert(32); |
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
gp::array<char, 256> work_array; |
|
|
|
|
|
gp::arena<> alloc_work(work_array.begin().data, work_array.size()); |
|
|
|
|
|
gp::ring_list<int, gp::arena<>, false> list{alloc_work}; |
|
|
|
|
|
gp_config::assertion(list.insert(8) == true, "could allocate in list with good enough allocator"); |
|
|
|
|
|
gp_config::assertion(list.insert(8) == true, "could allocate in list with good enough allocator"); |
|
|
|
|
|
gp_config::assertion(list.insert(8) == true, "could allocate in list with good enough allocator"); |
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
gp::array<char, sizeof(int)> once_array; |
|
|
|
|
|
gp::arena<> alloc_once(once_array.begin().data, once_array.size()); |
|
|
|
|
|
gp::ring_list<int, gp::arena<>, false> list{alloc_once}; |
|
|
|
|
|
gp_config::assertion(list.insert(8) == false, "could allocate in list with insufficient allocator"); |
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
gp::arena<> alloc_none(nullptr, 0); |
|
|
|
|
|
gp::ring_list<int, gp::arena<>, false> list{alloc_none}; |
|
|
|
|
|
gp_config::assertion(list.insert(8) == false, "could allocate in list with fake allocator"); |
|
|
|
|
|
} |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|