Update errror code from 250 to 252

This commit is contained in:
Michael Tryby
2019-04-17 09:39:24 -04:00
parent f161ecaa72
commit d1979e7ed0
7 changed files with 28 additions and 25 deletions

2
.gitignore vendored
View File

@@ -223,6 +223,8 @@ temp/
# Testing Stuff # Testing Stuff
nrtestsuite/ nrtestsuite/
tests/data/ tests/data/
tests/outfile/data/en*
#Cmake stuff #Cmake stuff
__cmake_systeminformation/ __cmake_systeminformation/

View File

@@ -1734,7 +1734,7 @@ int DLLEXPORT EN_addnode(EN_Project p, char *id, int nodeType)
if (hyd->OpenHflag || qual->OpenQflag) return 262; if (hyd->OpenHflag || qual->OpenQflag) return 262;
// Check if id contains invalid characters // Check if id contains invalid characters
if (!cstr_isvalid(id)) return 250; if (!cstr_isvalid(id)) return 252;
// Check if a node with same id already exists // Check if a node with same id already exists
if (EN_getnodeindex(p, id, &i) == 0) return 215; if (EN_getnodeindex(p, id, &i) == 0) return 215;
@@ -2021,7 +2021,7 @@ int DLLEXPORT EN_setnodeid(EN_Project p, int index, char *newid)
if (index <= 0 || index > net->Nnodes) return 203; if (index <= 0 || index > net->Nnodes) return 203;
n = strlen(newid); n = strlen(newid);
if (n < 1 || n > MAXID) return 209; if (n < 1 || n > MAXID) return 209;
if (!cstr_isvalid(newid)) return 250; if (!cstr_isvalid(newid)) return 252;
// Check if another node with same name exists // Check if another node with same name exists
if (hashtable_find(net->NodeHashTable, newid) > 0) return 215; if (hashtable_find(net->NodeHashTable, newid) > 0) return 215;
@@ -2945,7 +2945,7 @@ int DLLEXPORT EN_addlink(EN_Project p, char *id, int linkType,
if (p->hydraul.OpenHflag || p->quality.OpenQflag) return 262; if (p->hydraul.OpenHflag || p->quality.OpenQflag) return 262;
// Check if id contains invalid characters // Check if id contains invalid characters
if (!cstr_isvalid(id)) return 250; if (!cstr_isvalid(id)) return 252;
// Check if a link with same id already exists // Check if a link with same id already exists
if (EN_getlinkindex(p, id, &i) == 0) return 215; if (EN_getlinkindex(p, id, &i) == 0) return 215;
@@ -3208,7 +3208,7 @@ int DLLEXPORT EN_setlinkid(EN_Project p, int index, char *newid)
if (index <= 0 || index > net->Nlinks) return 204; if (index <= 0 || index > net->Nlinks) return 204;
n = strlen(newid); n = strlen(newid);
if (n < 1 || n > MAXID) return 211; if (n < 1 || n > MAXID) return 211;
if (!cstr_isvalid(newid)) return 250; if (!cstr_isvalid(newid)) return 252;
// Check if another link with same name exists // Check if another link with same name exists
if (hashtable_find(net->LinkHashTable, newid) > 0) return 215; if (hashtable_find(net->LinkHashTable, newid) > 0) return 215;
@@ -3960,7 +3960,7 @@ int DLLEXPORT EN_addpattern(EN_Project p, char *id)
if (EN_getpatternindex(p, id, &i) == 0) return 215; if (EN_getpatternindex(p, id, &i) == 0) return 215;
// Check is id name contains invalid characters // Check is id name contains invalid characters
if (!cstr_isvalid(id)) return 250; if (!cstr_isvalid(id)) return 252;
// Check that id name is not too long // Check that id name is not too long
if (strlen(id) > MAXID) return 250; if (strlen(id) > MAXID) return 250;
@@ -4087,7 +4087,7 @@ int DLLEXPORT EN_setpatternid(EN_Project p, int index, char *id)
if (index < 1 || index > p->network.Npats) return 205; if (index < 1 || index > p->network.Npats) return 205;
// Check is id name contains invalid characters // Check is id name contains invalid characters
if (!cstr_isvalid(id)) return 250; if (!cstr_isvalid(id)) return 252;
if (strlen(id) > MAXID) return 250; if (strlen(id) > MAXID) return 250;
@@ -4236,7 +4236,7 @@ int DLLEXPORT EN_addcurve(EN_Project p, char *id)
if (EN_getcurveindex(p, id, &i) == 0) return 215; if (EN_getcurveindex(p, id, &i) == 0) return 215;
// Check is id name contains invalid characters // Check is id name contains invalid characters
if (!cstr_isvalid(id)) return 250; if (!cstr_isvalid(id)) return 252;
// Check that id name is not too long // Check that id name is not too long
if (strlen(id) > MAXID) return 250; if (strlen(id) > MAXID) return 250;
@@ -4359,7 +4359,7 @@ int DLLEXPORT EN_setcurveid(EN_Project p, int index, char *id)
if (index < 1 || index > p->network.Ncurves) return 205; if (index < 1 || index > p->network.Ncurves) return 205;
// Check is id name contains invalid characters // Check is id name contains invalid characters
if (!cstr_isvalid(id)) return 250; if (!cstr_isvalid(id)) return 252;
if (strlen(id) > MAXID) return 250; if (strlen(id) > MAXID) return 250;
for (i = 1; i <= p->network.Ncurves; i++) for (i = 1; i <= p->network.Ncurves; i++)

View File

@@ -49,6 +49,7 @@ DAT(240,"nonexistent source")
DAT(241,"nonexistent control") DAT(241,"nonexistent control")
DAT(250,"invalid format") DAT(250,"invalid format")
DAT(251,"invalid parameter code") DAT(251,"invalid parameter code")
DAT(252,"invalid ID name")
DAT(253,"nonexistent demand category") DAT(253,"nonexistent demand category")
DAT(254,"node with no coordinates") DAT(254,"node with no coordinates")
DAT(257,"nonexistent rule") DAT(257,"nonexistent rule")

View File

@@ -75,17 +75,17 @@ BOOST_FIXTURE_TEST_CASE(test_curve_id_isvalid, FixtureInitClose)
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
error = EN_addcurve(ph, (char *)"C 2"); error = EN_addcurve(ph, (char *)"C 2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
error = EN_addcurve(ph, (char *)"C\"2"); error = EN_addcurve(ph, (char *)"C\"2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
error = EN_addcurve(ph, (char *)"C;2"); error = EN_addcurve(ph, (char *)"C;2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
EN_getcurveindex(ph, (char *)"C1", &index); EN_getcurveindex(ph, (char *)"C1", &index);
error = EN_setcurveid(ph, index, (char *)"C;2"); error = EN_setcurveid(ph, index, (char *)"C;2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
} }

View File

@@ -68,17 +68,17 @@ BOOST_FIXTURE_TEST_CASE(test_link_id_isvalid, FixtureInitClose)
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
error = EN_addlink(ph, (char *)"L 2", EN_PIPE, (char *)"N1", (char *)"N2"); error = EN_addlink(ph, (char *)"L 2", EN_PIPE, (char *)"N1", (char *)"N2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
error = EN_addlink(ph, (char *)"L\"2", EN_PIPE, (char *)"N1", (char *)"N2"); error = EN_addlink(ph, (char *)"L\"2", EN_PIPE, (char *)"N1", (char *)"N2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
error = EN_addlink(ph, (char *)"L;2", EN_PIPE, (char *)"N1", (char *)"N2"); error = EN_addlink(ph, (char *)"L;2", EN_PIPE, (char *)"N1", (char *)"N2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
EN_getlinkindex(ph, (char *)"L1", &index); EN_getlinkindex(ph, (char *)"L1", &index);
error = EN_setlinkid(ph, index, (char *)"L;1"); error = EN_setlinkid(ph, index, (char *)"L;1");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
} }
BOOST_AUTO_TEST_CASE(test_setlinktype) BOOST_AUTO_TEST_CASE(test_setlinktype)

View File

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

View File

@@ -155,17 +155,17 @@ BOOST_FIXTURE_TEST_CASE(test_pat_id_isvalid, FixtureInitClose)
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
error = EN_addpattern(ph, (char *)"P 2"); error = EN_addpattern(ph, (char *)"P 2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
error = EN_addpattern(ph, (char *)"P\"2"); error = EN_addpattern(ph, (char *)"P\"2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
error = EN_addpattern(ph, (char *)"P;2"); error = EN_addpattern(ph, (char *)"P;2");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
EN_getpatternindex(ph, (char *)"P1", &index); EN_getpatternindex(ph, (char *)"P1", &index);
error = EN_setpatternid(ph, index, (char *)"P;1"); error = EN_setpatternid(ph, index, (char *)"P;1");
BOOST_REQUIRE(error == 250); BOOST_REQUIRE(error == 252);
} }