#include "gp/containers/dynarray.hpp" #include "gp/containers/vector.hpp" #include "gp/algorithms/sort.hpp" #include "test_scaffold.h" #include "allocator.hpp" #include #include #include #include #include typedef std::mt19937_64 cheap_rand; struct dynarray_test : public test_scaffold { uint32_t seed; dynarray_test() { name = __FILE__ ":1_seed"; seed = std::random_device{}(); name += std::to_string(seed); } virtual int run() { using val = gp::dynarray; cheap_rand setter(seed); std::unique_ptr> store = std::make_unique>(); gp::buddy alloc{&*store->begin(), store->size()}; gp::vector vals{alloc}; std::uniform_int_distribution dist(0,99); for(int i = 0; i < 1000; i++) { val insert{}; int max = dist(setter); for(int b = 0; b < max; b++) { insert.emplace_back(b); } vals.emplace_back(insert); } for(int i = 0; i < vals.size(); i++) { for(int j = i+1; j < vals.size(); j++) { if(!(vals[i] != vals[j])) { if(vals[i] == vals[j]) { vals.remove(vals.begin()+j); j--; } } } } gp::sort(vals.begin(), vals.end(), [](const val& a, const val& b){ return a.size() < b.size(); }); return vals.size() > 100; } }; append_test dummy_afdglys543(new dynarray_test{});