Refactors the API's demand editing functions
This commit is contained in:
@@ -84,31 +84,38 @@ BOOST_AUTO_TEST_CASE(test_categories_reopen, * boost::unit_test::depends_on("tes
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_adddemand, FixtureSingleNode)
|
||||
{
|
||||
int key, demand_key;
|
||||
int Dindex, nD;
|
||||
|
||||
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand", &demand_key);
|
||||
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand");
|
||||
BOOST_CHECK(error != 0);
|
||||
|
||||
error = EN_addpattern(ph, (char *)"PrimaryPattern");
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand", &demand_key);
|
||||
error = EN_adddemand(ph, node_qhut, 100.0, "PrimaryPattern", "PrimaryDemand");
|
||||
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);
|
||||
error = EN_adddemand(ph, node_qhut, 10.0, "SecondaryPattern", "SecondaryDemand");
|
||||
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);
|
||||
error = EN_adddemand(ph, node_qhut, 1.0, "TertiaryPattern", "TertiaryDemand");
|
||||
BOOST_CHECK(error == 0);
|
||||
|
||||
error = EN_getdemandindex(ph, node_qhut, "TertiaryDemand", &Dindex);
|
||||
BOOST_CHECK(error == 0);
|
||||
|
||||
error = EN_removedemand(ph, node_qhut, key);
|
||||
error = EN_deletedemand(ph, node_qhut, Dindex);
|
||||
BOOST_CHECK(error == 0);
|
||||
|
||||
error = EN_getnumdemands(ph, node_qhut, &nD);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
BOOST_CHECK(nD == 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user