From 55a28de9e003f0564b3611e83aeeac966915a9d4 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Thu, 18 Apr 2019 17:34:02 -0400 Subject: [PATCH] Work in progress --- tests/test_demand_data.cpp | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tests/test_demand_data.cpp b/tests/test_demand_data.cpp index c9a7124..6428cc0 100644 --- a/tests/test_demand_data.cpp +++ b/tests/test_demand_data.cpp @@ -181,7 +181,6 @@ struct FixtureOpenClose { EN_Project ph; }; - BOOST_FIXTURE_TEST_CASE(test_demandname_getset, FixtureOpenClose) { int Nindex, ndem; @@ -206,4 +205,43 @@ BOOST_FIXTURE_TEST_CASE(test_demandname_getset, FixtureOpenClose) BOOST_CHECK(check_string(demname, "Demand category name")); } +BOOST_FIXTURE_TEST_CASE(test_demandpattern_get, FixtureOpenClose) +{ + int n, patIdx; + + error = EN_getdemandpattern(ph, 3, 1, &patIdx); + BOOST_REQUIRE(error == 0); + + error = EN_getpatternlen(ph, patIdx, &n); + BOOST_REQUIRE(error == 0); + + BOOST_CHECK(n == 12); +} + +BOOST_FIXTURE_TEST_CASE(test_demandpattern_getset, FixtureOpenClose) +{ + int n, patIdx; + + double f3[] = { 3.1, 3.2, 3.3, 3.4 }; + + // Create pattern + error = EN_addpattern(ph, (char *)"Pat3"); + BOOST_REQUIRE(error == 0); + + error = EN_setpattern(ph, 3, f3, 4); + BOOST_REQUIRE(error == 0); + + // Assign Pat3 to 3rd junction + error = EN_setdemandpattern(ph, 3, 1, 3); + BOOST_REQUIRE(error == 0); + + + error = EN_getdemandpattern(ph, 3, 1, &patIdx); + BOOST_REQUIRE(error == 0); + + error = EN_getpatternlen(ph, patIdx, &n); + BOOST_REQUIRE(error == 0); + BOOST_CHECK(n == 4); +} + BOOST_AUTO_TEST_SUITE_END()