Skip to content
Snippets Groups Projects
Commit 375a6a18 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Fixed unit test

parent e6afd742
No related branches found
No related tags found
2 merge requests!212Version 0.3.0,!193Allow to specify any node as graph outputs
Pipeline #53867 passed
...@@ -108,13 +108,6 @@ TEST_CASE("clone_with_delete", "[GraphView][cloneDelete]") { ...@@ -108,13 +108,6 @@ TEST_CASE("clone_with_delete", "[GraphView][cloneDelete]") {
const size_t nbTests = 100; const size_t nbTests = 100;
size_t nbClonedWithDelete = 0; size_t nbClonedWithDelete = 0;
// Note: initial seed is chosen such that for nbTests=100, the generated
// graphs keep the same inputs/outputs despites the deleted nodes
// (meaning the deleted nodes are not input/output of the graph).
// Otherwise, the last two REQUIRE are not garanteed to be true!
// Warning: distributions are not required to behave the same way by the standard,
// therefore the seed has to work for both GCC and MSVC...
// See https://stackoverflow.com/questions/38532927/why-gcc-and-msvc-stdnormal-distribution-are-different
std::mt19937::result_type seed(243); std::mt19937::result_type seed(243);
for (int test = 0; test < nbTests; ++test) { for (int test = 0; test < nbTests; ++test) {
...@@ -124,7 +117,21 @@ TEST_CASE("clone_with_delete", "[GraphView][cloneDelete]") { ...@@ -124,7 +117,21 @@ TEST_CASE("clone_with_delete", "[GraphView][cloneDelete]") {
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 bool unicity1 = g1->add(randGraph.gen(seed, 10));
if (unicity1) { bool stableInOut = true;
for (auto node : g1->inputNodes()) {
if (node->type() == "DelFictive") {
stableInOut = false;
break;
}
}
for (auto node : g1->outputNodes()) {
if (node->type() == "DelFictive") {
stableInOut = false;
break;
}
}
if (unicity1 && stableInOut) {
randGraph.omitType = "DelFictive"; randGraph.omitType = "DelFictive";
const auto g2 = std::make_shared<GraphView>("g2"); const auto g2 = std::make_shared<GraphView>("g2");
const bool unicity2 = g2->add(randGraph.gen(seed, 10)); const bool unicity2 = g2->add(randGraph.gen(seed, 10));
......
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