Fixes problems with EN_addnode() (#543)

See issue #542 . Also modifies unit test test_node to check that fixup works.
This commit is contained in:
Lew Rossman
2019-10-16 15:07:14 -04:00
committed by Sam Hatchett
parent 5f7fd55a36
commit 344700a136
2 changed files with 19 additions and 9 deletions

View File

@@ -25,17 +25,21 @@ BOOST_FIXTURE_TEST_CASE(test_adddelete_node, FixtureInitClose)
error = EN_addnode(ph, (char *)"N2", EN_JUNCTION, &index);
BOOST_REQUIRE(error == 0);
error = EN_addnode(ph, (char *)"N4", EN_TANK, &index);
BOOST_REQUIRE(error == 0);
error = EN_addnode(ph, (char *)"N3", EN_RESERVOIR, &index);
BOOST_REQUIRE(error == 0);
error = EN_addnode(ph, (char *)"N1", EN_JUNCTION, &index);
BOOST_REQUIRE(error == 0);
error = EN_getnodeindex(ph, (char *)"N1", &index);
BOOST_REQUIRE(error == 0);
BOOST_REQUIRE(index == 2);
error = EN_getnodeindex(ph, (char *)"N2", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
error = EN_addnode(ph, (char *)"N4", EN_TANK, &index);
BOOST_REQUIRE(error == 0);
error = EN_getnodeindex(ph, (char *)"N4", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);