diff --git a/test/algorithms/simulation/sidb/random_layout_generator.cpp b/test/algorithms/simulation/sidb/random_layout_generator.cpp index 5e0cd8b2c..df8496cf2 100644 --- a/test/algorithms/simulation/sidb/random_layout_generator.cpp +++ b/test/algorithms/simulation/sidb/random_layout_generator.cpp @@ -457,74 +457,70 @@ TEST_CASE("Random siqad::coord_t layout generation", "[generate_random_layout]") }); } - // - // SECTION("given corner coordinates and number of placed SiDBs, and allow positive charges") - // { - // const generate_random_layout_params params{{{0, 0, 0}, {90, 90, 0}}, - // 100, - // positive_charges::FORBIDDEN}; - // - // const auto result_lyt = generate_random_layout(sidb_cell_clk_lyt{}, params); - // - // CHECK(result_lyt.num_cells() == 100); - // result_lyt.foreach_cell( - // [](const auto& cell) - // { - // CHECK(cell.x < 91); - // CHECK(cell.y < 91); - // CHECK(cell.z == 0); - // }); - // // check if all cells are not closer than two cells (Euclidean distance). - // result_lyt.foreach_cell( - // [&result_lyt](const auto& cell_one) - // { - // result_lyt.foreach_cell( - // [&cell_one, &result_lyt](const auto& cell_two) - // { - // if (cell_one != cell_two) - // { - // CHECK(euclidean_distance(result_lyt, cell_one, cell_two) >= 2); - // } - // }); - // }); - // } - // - // SECTION("given previous layouts") - // { - // const generate_random_layout_params params{ - // {{0, 0, 1}, {9, 9, 1}}, 10, positive_charges::FORBIDDEN, 2, static_cast(10E6), 3}; - // const auto result_lyts = generate_multiple_random_layouts(sidb_cell_clk_lyt{}, params); - // CHECK(result_lyts.size() == 3); - // - // for (const auto& lyt : result_lyts) - // { - // lyt.foreach_cell( - // [](const auto& cell) - // { - // CHECK(cell.x < 10); - // CHECK(cell.x >= 0); - // CHECK(cell.y < 10); - // CHECK(cell.y >= 0); - // CHECK(cell.z == 1); - // }); - // } - // } - // - // SECTION("Check uniqueness of two layouts") - // { - // const generate_random_layout_params params{ - // {{0, 0, 1}, {9, 9, 0}}, 10, positive_charges::FORBIDDEN, 2, static_cast(10E6), 2}; - // const auto result_lyts = generate_multiple_random_layouts(sidb_cell_clk_lyt{}, params); - // REQUIRE(result_lyts.size() == 2); - // - // const auto& first_lyt = result_lyts.front(); - // const auto& second_lyt = result_lyts.back(); - // - // first_lyt.foreach_cell( - // [&second_lyt](const auto& cell_first) - // { second_lyt.foreach_cell([&cell_first](const auto& cell_second) { CHECK(cell_first != cell_second); - // }); - // }); - // } - //} + SECTION("given corner coordinates and number of placed SiDBs, and allow positive charges") + { + const generate_random_layout_params params{{{0, 0, 0}, {90, 90, 0}}, + 100, + positive_charges::FORBIDDEN}; + + const auto result_lyt = generate_random_layout(sidb_cell_clk_lyt{}, params); + + CHECK(result_lyt.num_cells() == 100); + result_lyt.foreach_cell( + [](const auto& cell) + { + CHECK(cell.x < 91); + CHECK(cell.y < 91); + CHECK(cell.z <= 1); + }); + // check if all cells are not closer than two cells (Euclidean distance). + result_lyt.foreach_cell( + [&result_lyt](const auto& cell_one) + { + result_lyt.foreach_cell( + [&cell_one, &result_lyt](const auto& cell_two) + { + if (cell_one != cell_two) + { + CHECK(euclidean_distance(result_lyt, cell_one, cell_two) >= 2); + } + }); + }); + } + + SECTION("given previous layouts") + { + const generate_random_layout_params params{ + {{0, 0, 1}, {9, 9, 1}}, 10, positive_charges::FORBIDDEN, 2, static_cast(10E6), 3}; + const auto result_lyts = generate_multiple_random_layouts(sidb_cell_clk_lyt{}, params); + CHECK(result_lyts.size() == 3); + + for (const auto& lyt : result_lyts) + { + lyt.foreach_cell( + [](const auto& cell) + { + CHECK(cell.x < 10); + CHECK(cell.x >= 0); + CHECK(cell.y < 10); + CHECK(cell.y >= 0); + CHECK(cell.z <= 1); + }); + } + } + + SECTION("Check uniqueness of two layouts") + { + const generate_random_layout_params params{ + {{0, 0, 1}, {9, 9, 0}}, 10, positive_charges::FORBIDDEN, 2, static_cast(10E6), 2}; + const auto result_lyts = generate_multiple_random_layouts(sidb_cell_clk_lyt{}, params); + REQUIRE(result_lyts.size() == 2); + + const auto& first_lyt = result_lyts.front(); + const auto& second_lyt = result_lyts.back(); + + first_lyt.foreach_cell( + [&second_lyt](const auto& cell_first) + { second_lyt.foreach_cell([&cell_first](const auto& cell_second) { CHECK(cell_first != cell_second); }); }); + } }