Skip to content
Snippets Groups Projects
Commit 085defab authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

feat : created "failling" unit test for scheduler : a graph too big will lead...

feat : created "failling" unit test for scheduler : a graph too big will lead to an exponential exec time
parent 4c08fa6c
No related branches found
No related tags found
2 merge requests!105version 0.2.0,!100fix/scheduler_exec_time
...@@ -30,17 +30,21 @@ ...@@ -30,17 +30,21 @@
using namespace Aidge; using namespace Aidge;
TEST_CASE("randomScheduling", "[Scheduler][randomGen]") { TEST_CASE("randomScheduling", "[Scheduler][randomGen]") {
const size_t nbTests = 100; const size_t nbTests = 30;
size_t nbUnicity = 0; size_t nbUnicity = 0;
std::uniform_int_distribution<std::size_t> nb_nodes_dist(1, 100);
for (int test = 0; test < nbTests; ++test) { for (int test = 0; test < nbTests; ++test) {
std::random_device rd; std::random_device rd;
const std::mt19937::result_type seed(rd()); const std::mt19937::result_type seed(rd());
std::mt19937 gen(rd());
RandomGraph randGraph; RandomGraph randGraph;
randGraph.acyclic = true; randGraph.acyclic = true;
const auto g1 = std::make_shared<GraphView>("g1"); const auto g1 = std::make_shared<GraphView>("g1");
const bool unicity1 = g1->add(randGraph.gen(seed, 10)); const size_t nb_nodes = nb_nodes_dist(gen);
const bool unicity1 = g1->add(randGraph.gen(seed, nb_nodes));
g1->save("test_graph_"+std::to_string(test));
if (unicity1) { if (unicity1) {
for (auto& node : g1->getNodes()) { for (auto& node : g1->getNodes()) {
...@@ -69,7 +73,7 @@ TEST_CASE("randomScheduling", "[Scheduler][randomGen]") { ...@@ -69,7 +73,7 @@ TEST_CASE("randomScheduling", "[Scheduler][randomGen]") {
[&namePtrTable](auto val){ return namePtrTable.at(val); }); [&namePtrTable](auto val){ return namePtrTable.at(val); });
fmt::print("schedule: {}\n", nodesName); fmt::print("schedule: {}\n", nodesName);
REQUIRE(sch.size() == 10 + orderedInputs.size()); CHECK(sch.size() == nb_nodes + orderedInputs.size());
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment