Adding element id validity check

Adding checks for element set id functions
This commit is contained in:
Michael Tryby
2019-04-16 17:29:32 -04:00
parent 22a7993c8c
commit 3186ec326c
5 changed files with 41 additions and 7 deletions

View File

@@ -69,6 +69,8 @@ BOOST_FIXTURE_TEST_CASE(test_curve_comments, FixtureOpenClose)
BOOST_FIXTURE_TEST_CASE(test_curve_id_isvalid, FixtureInitClose)
{
int index;
error = EN_addcurve(ph, "C1");
BOOST_REQUIRE(error == 0);
@@ -80,6 +82,10 @@ BOOST_FIXTURE_TEST_CASE(test_curve_id_isvalid, FixtureInitClose)
error = EN_addcurve(ph, "C;2");
BOOST_REQUIRE(error == 250);
EN_getcurveindex(ph, "C1", &index);
error = EN_setcurveid(ph, index, "C;2");
BOOST_REQUIRE(error == 250);
}

View File

@@ -55,8 +55,10 @@ BOOST_FIXTURE_TEST_CASE(test_adddelete_link, FixtureInitClose)
}
BOOST_FIXTURE_TEST_CASE(test_link_isvalid, FixtureInitClose)
BOOST_FIXTURE_TEST_CASE(test_link_id_isvalid, FixtureInitClose)
{
int index;
// Build a network
EN_addnode(ph, (char *)"N1", EN_JUNCTION);
EN_addnode(ph, (char *)"N2", EN_JUNCTION);
@@ -73,6 +75,10 @@ BOOST_FIXTURE_TEST_CASE(test_link_isvalid, FixtureInitClose)
error = EN_addlink(ph, (char *)"L;2", EN_PIPE, (char *)"N1", (char *)"N2");
BOOST_REQUIRE(error == 250);
EN_getlinkindex(ph, "L1", &index);
error = EN_setlinkid(ph, index, "L;1");
BOOST_REQUIRE(error == 250);
}
BOOST_AUTO_TEST_CASE(test_setlinktype)

View File

@@ -49,17 +49,23 @@ BOOST_FIXTURE_TEST_CASE(test_adddelete_node, FixtureInitClose)
BOOST_FIXTURE_TEST_CASE(test_node_validate_id, FixtureInitClose)
{
int index;
error = EN_addnode(ph, (char *)"N2", EN_JUNCTION);
BOOST_REQUIRE(error == 0);
error = EN_addnode(ph, (char *)"N 2", EN_JUNCTION);
error = EN_addnode(ph, (char *)"N 3", EN_JUNCTION);
BOOST_REQUIRE(error == 250);
error = EN_addnode(ph, (char *)"N\"2", EN_JUNCTION);
error = EN_addnode(ph, (char *)"N\"3", EN_JUNCTION);
BOOST_REQUIRE(error == 250);
error = EN_addnode(ph, (char *)"N;2", EN_JUNCTION);
error = EN_addnode(ph, (char *)"N;3", EN_JUNCTION);
BOOST_REQUIRE(error == 250);
EN_getnodeindex(ph, "N2", &index);
error = EN_setnodeid(ph, index, "N;2");
BOOST_REQUIRE(error = 250);
}

View File

@@ -147,8 +147,10 @@ BOOST_FIXTURE_TEST_CASE(test_pattern_comments, FixtureOpenClose)
BOOST_CHECK(check_string(comment, (char *)"Time Pattern 1"));
}
BOOST_FIXTURE_TEST_CASE(test_pat_isvalid_id, FixtureInitClose)
BOOST_FIXTURE_TEST_CASE(test_pat_id_isvalid, FixtureInitClose)
{
int index;
error = EN_addpattern(ph, "P1");
BOOST_REQUIRE(error == 0);
@@ -160,6 +162,11 @@ BOOST_FIXTURE_TEST_CASE(test_pat_isvalid_id, FixtureInitClose)
error = EN_addpattern(ph, "P;2");
BOOST_REQUIRE(error == 250);
EN_getpatternindex(ph, "P1", &index);
error = EN_setpatternid(ph, index, "P;1");
BOOST_REQUIRE(error == 250);
}