|
|
@ -60,4 +60,50 @@ struct dynarray_test : public test_scaffold { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_afdglys543(new dynarray_test{}); |
|
|
|
append_test dummy_afdglys543(new dynarray_test{}); |
|
|
|
|
|
|
|
struct dynarray2_test : public test_scaffold { |
|
|
|
uint32_t seed; |
|
|
|
|
|
|
|
dynarray2_test() { |
|
|
|
name = __FILE__ ":2_seed"; |
|
|
|
seed = std::random_device{}(); |
|
|
|
name += std::to_string(seed); |
|
|
|
} |
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
using val = gp::dynarray<int, 100>; |
|
|
|
cheap_rand setter(seed); |
|
|
|
|
|
|
|
std::unique_ptr<gp::array<char, 4096*4096>> store = std::make_unique<gp::array<char, 4096*4096>>(); |
|
|
|
gp::buddy alloc{&*store->begin(), store->size()}; |
|
|
|
|
|
|
|
gp::vector<val> vals{alloc}; |
|
|
|
std::uniform_int_distribution<int> dist(0,49); |
|
|
|
std::uniform_int_distribution<int> coin(false,true); |
|
|
|
bool happened = false; |
|
|
|
for(int i = 0; i < 1000; i++) { |
|
|
|
val a; |
|
|
|
if(coin(setter)) { |
|
|
|
a.emplace_back(dist(setter)); |
|
|
|
} |
|
|
|
a.emplace_back(dist(setter)); |
|
|
|
for(int j = 0; j < 1000; j++) { |
|
|
|
val b; |
|
|
|
if(coin(setter)) { |
|
|
|
b.emplace_back(dist(setter)); |
|
|
|
} |
|
|
|
b.emplace_back(dist(setter)); |
|
|
|
if(a == b) { |
|
|
|
if(! (a != b)) { |
|
|
|
happened = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return !happened; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_5dfqlys543(new dynarray2_test{}); |