Skip to content

Commit

Permalink
Merge pull request #129 from USEPA/bug_fixes
Browse files Browse the repository at this point in the history
Use of wrong variable for iteration: Addresses #128
  • Loading branch information
cbuahin authored Jun 22, 2023
2 parents b7aff8c + d87d765 commit 48ca812
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/outfile/swmm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ int EXPORT_OUT_API SMO_getSystemSeries(SMO_Handle p_handle, SMO_systemAttribute
errorcode = 411;
else {
// loop over and build time series
for (k = 0; k < length; k++)
for (k = 0; k < len; k++)
temp[k] = getSystemValue(p_data, startPeriod + k, attr);

*outValueArray = temp;
Expand Down
20 changes: 20 additions & 0 deletions tests/outfile/test_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,26 @@ BOOST_FIXTURE_TEST_CASE(test_getSubcatchSeries, Fixture) {
BOOST_CHECK(check_cdd_float(test_vec, ref_vec, 3));
}

BOOST_FIXTURE_TEST_CASE(test_getSystemSeries, Fixture) {
error = SMO_getSystemSeries(p_handle, SMO_runoff_flow, 0, 10, &array,
&array_dim);
BOOST_REQUIRE(error == 0);

const int ref_dim = 10;
float ref_array[ref_dim] = {
0.0f, 6.216825f, 13.030855f, 24.252975f, 14.172027f, 4.1949716f,
0.322329f, 0.056010f, 0.024938f, 0.012474f};

std::vector<float> ref_vec;
ref_vec.assign(ref_array, ref_array + 10);

std::vector<float> test_vec;
test_vec.assign(array, array + array_dim);

BOOST_CHECK(check_cdd_float(test_vec, ref_vec, 3));
}


BOOST_FIXTURE_TEST_CASE(test_getSubcatchResult, Fixture) {
error = SMO_getSubcatchResult(p_handle, 1, 1, &array, &array_dim);
BOOST_REQUIRE(error == 0);
Expand Down

0 comments on commit 48ca812

Please sign in to comment.