Fixing bug in gettimeparam

This commit is contained in:
Michael Tryby
2019-03-01 15:16:27 -05:00
parent fca0df7a7b
commit 9f1b46b66a
3 changed files with 36 additions and 4 deletions

View File

@@ -85,4 +85,30 @@ BOOST_FIXTURE_TEST_CASE(test_anlys_getoption, FixtureOpenClose)
BOOST_CHECK(error == 251);
}
BOOST_FIXTURE_TEST_CASE(test_anlys_gettimeparam, FixtureOpenClose)
{
int i;
long array[16];
std::vector<long> test;
vector<long> ref = {86400, 3600, 300, 7200, 0, 3600, 0, 360, 0, 25, 0, 86400, 86400, 0, 3600, 0};
error = EN_solveH(ph);
BOOST_REQUIRE(error == 0);
error = EN_solveQ(ph);
BOOST_REQUIRE(error == 0);
for (i=EN_DURATION; i<=EN_NEXTEVENTTANK; i++) {
error = EN_gettimeparam(ph, i, &array[i]);
BOOST_REQUIRE(error == 0);
}
test.assign(array, array + 16);
BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end());
error = EN_gettimeparam(ph, 18, &array[0]);
BOOST_CHECK(error == 251);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -13,7 +13,7 @@
// the test and the ref vectors.
boost::test_tools::predicate_result check_cdd_double(std::vector<double>& test,
std::vector<double>& ref, long cdd_tol){
float tmp, min_cdd = 10.0;
double tmp, min_cdd = 10.0;
// TODO: What if the vectors aren't the same length?