Fix bug and test remove demand
This commit is contained in:
@@ -2560,7 +2560,7 @@ int DLLEXPORT EN_removedemand(EN_Project p, int node_index, int demand_key)
|
|||||||
|
|
||||||
list_t *dlist = Node[node_index].D;
|
list_t *dlist = Node[node_index].D;
|
||||||
|
|
||||||
remove_node(dlist, search_list(dlist, demand_key));
|
remove_node(dlist, demand_key);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE(test_categories_reopen, * boost::unit_test::depends_on("tes
|
|||||||
|
|
||||||
BOOST_FIXTURE_TEST_CASE(test_adddemand, FixtureSingleNode)
|
BOOST_FIXTURE_TEST_CASE(test_adddemand, FixtureSingleNode)
|
||||||
{
|
{
|
||||||
int demand_key;
|
int key, demand_key;
|
||||||
|
|
||||||
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand", &demand_key);
|
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand", &demand_key);
|
||||||
BOOST_CHECK(error != 0);
|
BOOST_CHECK(error != 0);
|
||||||
@@ -94,6 +94,21 @@ BOOST_FIXTURE_TEST_CASE(test_adddemand, FixtureSingleNode)
|
|||||||
|
|
||||||
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand", &demand_key);
|
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand", &demand_key);
|
||||||
BOOST_CHECK(error == 0);
|
BOOST_CHECK(error == 0);
|
||||||
|
|
||||||
|
error = EN_addpattern(ph, (char *)"SecondaryPattern");
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
error = EN_adddemand(ph, node_qhut, 10.0, "SecondaryPattern", "SecondaryDemand", &key);
|
||||||
|
BOOST_CHECK(error == 0);
|
||||||
|
|
||||||
|
error = EN_addpattern(ph, (char *)"TertiaryPattern");
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
error = EN_adddemand(ph, node_qhut, 1.0, "TertiaryPattern", "TertiaryDemand", &demand_key);
|
||||||
|
BOOST_CHECK(error == 0);
|
||||||
|
|
||||||
|
error = EN_removedemand(ph, node_qhut, key);
|
||||||
|
BOOST_CHECK(error == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user