Merge pull request #457 from michaeltryby/dev

Minor update to unit tests
This commit is contained in:
Michael Tryby
2019-04-12 16:17:53 -04:00
committed by GitHub
4 changed files with 287 additions and 222 deletions

View File

View File

@@ -20,6 +20,41 @@
BOOST_AUTO_TEST_SUITE (test_link)
BOOST_FIXTURE_TEST_CASE(test_adddelete_link, FixtureInitClose)
{
int index;
// Build a network
EN_addnode(ph, (char *)"N1", EN_JUNCTION);
EN_addnode(ph, (char *)"N2", EN_JUNCTION);
EN_addnode(ph, (char *)"N3", EN_RESERVOIR);
error = EN_addlink(ph, (char *)"L1", EN_PUMP, (char *)"N3", (char *)"N1");
BOOST_REQUIRE(error == 0);
error = EN_addlink(ph, (char *)"L2", EN_PIPE, (char *)"N1", (char *)"N3");
BOOST_REQUIRE(error == 0);
error = EN_getlinkindex(ph, (char *)"L2", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletelink(ph, index, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
error = EN_addlink(ph, (char *)"L3", EN_PIPE, (char *)"N1", (char *)"N2");
BOOST_REQUIRE(error == 0);
error = EN_getlinkindex(ph, (char *)"L1", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletelink(ph, index, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
error = EN_getlinkindex(ph, (char *)"L3", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletelink(ph, index, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
}
BOOST_AUTO_TEST_CASE(test_setlinktype)
{
int error = 0;

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 03/21/2019
Last Updated: 04/12/2019
******************************************************************************
*/

View File

@@ -18,6 +18,35 @@
BOOST_AUTO_TEST_SUITE (test_node)
BOOST_FIXTURE_TEST_CASE(test_adddelete_node, FixtureInitClose)
{
int index;
error = EN_addnode(ph, (char *)"N2", EN_JUNCTION);
BOOST_REQUIRE(error == 0);
error = EN_addnode(ph, (char *)"N3", EN_RESERVOIR);
BOOST_REQUIRE(error == 0);
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);
BOOST_REQUIRE(error == 0);
error = EN_getnodeindex(ph, (char *)"N4", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
error = EN_getnodeindex(ph, (char *)"N3", &index);
BOOST_REQUIRE(error == 0);
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
}
BOOST_FIXTURE_TEST_CASE(test_junc_props, FixtureOpenClose)
{
int index;
@@ -297,4 +326,5 @@ BOOST_AUTO_TEST_CASE(test_reopen_comment, * boost::unit_test::depends_on("node_c
EN_deleteproject(&ph);
}
BOOST_AUTO_TEST_SUITE_END()