diff --git a/src/recipes/RemoveFlatten.cpp b/src/recipes/RemoveFlatten.cpp index c28c4794e9611cdedd0bd8c76a1e6d7580dc17b6..8c1bf1bcf0bf79fda275867ff6430d5a937da172 100644 --- a/src/recipes/RemoveFlatten.cpp +++ b/src/recipes/RemoveFlatten.cpp @@ -22,7 +22,6 @@ namespace Aidge { void removeFlatten(std::shared_ptr<Node> flatten) { - GraphView::replace({flatten}, {}); } diff --git a/unit_tests/recipes/Test_removeFlatten.cpp b/unit_tests/recipes/Test_removeFlatten.cpp index 572fd121a277731f457e04fc54aa63eef24af2c4..928adc82b7f6a03b94f6217b9de3a4eb114c1818 100644 --- a/unit_tests/recipes/Test_removeFlatten.cpp +++ b/unit_tests/recipes/Test_removeFlatten.cpp @@ -38,10 +38,12 @@ TEST_CASE("[cpu/recipies] RemoveFlatten", "[RemoveFlatten][recipies]") { removeFlatten(g); fmt::print("debug {}", __LINE__); - CHECK(g->getOrderedInputs().size() == 1); CHECK(g->getOrderedOutputs().size() == 1); - CHECK(g->getOrderedInputs()[0].first == fc0); CHECK(g->getOrderedOutputs()[0].first == flatten); + + CHECK(g->getOrderedInputs().size() == 1); + CHECK(g->getOrderedInputs()[0].first == fc0); + CHECK(fc0->getParent(0) == nullptr); CHECK(fc0->getChildren(0).size() == 1); CHECK(g->getRootNode() == fc0); @@ -54,9 +56,11 @@ TEST_CASE("[cpu/recipies] RemoveFlatten", "[RemoveFlatten][recipies]") { fmt::print("debug {}", __LINE__); CHECK(g->getOrderedInputs().size() == 1); - CHECK(g->getOrderedOutputs().size() == 1); CHECK(g->getOrderedInputs()[0].first == fc0); + + CHECK(g->getOrderedOutputs().size() == 1); CHECK(g->getOrderedOutputs()[0].first == fc0); + CHECK(fc0->getParent(0) == nullptr); CHECK(fc0->getChildren(0).size() == 0); CHECK(g->getRootNode() == fc0); @@ -69,9 +73,11 @@ TEST_CASE("[cpu/recipies] RemoveFlatten", "[RemoveFlatten][recipies]") { fmt::print("debug {}", __LINE__); CHECK(g->getOrderedInputs().size() == 1); - CHECK(g->getOrderedOutputs().size() == 1); CHECK(g->getOrderedInputs()[0].first == fc0); + + CHECK(g->getOrderedOutputs().size() == 1); CHECK(g->getOrderedOutputs()[0].first == fc1); + CHECK(fc1->getParent(0) == fc0); CHECK(fc0->getChildren(0)[0] == fc1); CHECK(g->getRootNode() == fc0); @@ -87,11 +93,13 @@ TEST_CASE("[cpu/recipies] RemoveFlatten", "[RemoveFlatten][recipies]") { fmt::print("debug {}", __LINE__); CHECK(g->getOrderedInputs().size() == 0); + CHECK(g->getOrderedOutputs().size() == 1); - CHECK(g->getOrderedInputs()[0].first == fc0); CHECK(g->getOrderedOutputs()[0].first == fc0); + CHECK(fc0->getParent(0) == prod); CHECK(fc0->getChildren(0).size() == 0); + CHECK(g->getRootNode() == prod); } }