9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
22 #include <boost/functional/hash.hpp>
34 return left.
col < right.
col;
51 cl.
cells.push_back(cell);
62 boost::hash_combine(cl.
hash, c.
col);
68 using CellC = std::vector<Cell>;
70 using ClusterC = std::vector<Cluster>;
76 size_t nclusters = 100;
77 int startSeed = 204769;
80 std::cout <<
"Grid_1D_rand test with parameters:" << std::endl;
81 std::cout <<
" minsize = " << minsize << std::endl;
82 std::cout <<
" maxsize = " << maxsize << std::endl;
83 std::cout <<
" minspace = " << minspace << std::endl;
84 std::cout <<
" maxspace = " << maxspace << std::endl;
85 std::cout <<
" nclusters = " << nclusters << std::endl;
86 std::cout <<
" startSeed = " << startSeed << std::endl;
87 std::cout <<
" ntries = " << ntries << std::endl;
89 while (ntries-- > 0) {
90 std::mt19937_64
rnd(startSeed++);
91 std::uniform_int_distribution<size_t> distr_size(minsize, maxsize);
92 std::uniform_int_distribution<size_t> distr_space(minspace, maxspace);
98 for (
size_t i = 0;
i < nclusters;
i++) {
100 col += distr_space(rnd);
101 size_t size = distr_size(rnd);
102 for (
size_t j = 0;
j <
size;
j++) {
104 cells.push_back(cell);
109 for (Cluster& cl : clusters) {
113 std::shuffle(cells.begin(), cells.end(),
rnd);
115 ClusterC newCls = Ccl::createClusters<CellC, ClusterC, 1>(cells);
117 for (Cluster& cl : newCls) {
124 BOOST_CHECK_EQUAL(clusters.size(), newCls.size());
125 for (
size_t i = 0;
i < clusters.size();
i++) {
126 BOOST_CHECK_EQUAL(clusters.at(
i).hash, newCls.at(
i).hash);