memgraph/tests/concurrent/dynamic_bitset_set.cpp
Kruno Tomola Fabro 9bd845a62e Added max_no_threads.
It is meant for easily change no threads in concurrent tests.
2016-09-13 18:08:34 +01:00

25 lines
588 B
C++

#include "common.h"
constexpr size_t THREADS_NO = std::min(max_no_threads, 8);
constexpr size_t op_per_thread = 1e5;
constexpr size_t key_range = op_per_thread * THREADS_NO * 3;
int main()
{
DynamicBitset<> db;
auto set = collect_set(run<std::vector<bool>>(THREADS_NO, [&](auto index) {
auto rand = rand_gen(key_range);
std::vector<bool> set(key_range);
for (size_t i = 0; i < op_per_thread; i++) {
size_t num = rand();
db.set(num);
set[num] = true;
}
return set;
}));
check_set(db, set);
}