From 0b76cfb2df0d43f8769bca85d7aa186ecfadcf66 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Fri, 8 Mar 2019 18:15:47 -0500 Subject: [PATCH] Adding test for EN_getnodevalue --- tests/test_hydrqual.cpp | 2 +- tests/test_node.cpp | 78 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 tests/test_node.cpp diff --git a/tests/test_hydrqual.cpp b/tests/test_hydrqual.cpp index d5295c5..60a2b50 100644 --- a/tests/test_hydrqual.cpp +++ b/tests/test_hydrqual.cpp @@ -18,7 +18,7 @@ //#endif -#define BOOST_TEST_MODULE hydqual +#define BOOST_TEST_MODULE hydrqual #include "test_shared.hpp" diff --git a/tests/test_node.cpp b/tests/test_node.cpp new file mode 100644 index 0000000..35c08b9 --- /dev/null +++ b/tests/test_node.cpp @@ -0,0 +1,78 @@ +// +// test_node.cpp +// +// Date Created: February 8, 2019 +// +// Author: Michael E. Tryby +// US EPA - ORD/NRMRL +// + + +#define BOOST_TEST_MODULE "node" + +#include "test_shared.hpp" + + +using namespace std; +using namespace boost; + + + +BOOST_AUTO_TEST_SUITE (test_node) + + +BOOST_FIXTURE_TEST_CASE(test_node_getvalue, FixtureOpenClose) +{ + const auto junc_props = { + EN_ELEVATION, + EN_BASEDEMAND, + EN_PATTERN, + EN_EMITTER, + EN_INITQUAL, + //demand + //head + //pressure + //quality + }; + const int num_props = 5; + + std::vector test (num_props); + double *value = test.data(); + + std::vector ref = {710.0, 150.0, 1.0, 0.0, 0.5}; + + + for (EN_NodeProperty p : junc_props) { + error = EN_getnodevalue(ph, 2, p, value++); + BOOST_REQUIRE(error == 0); + } + + BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end()); + + + const auto tank_props = { + EN_ELEVATION, + EN_INITQUAL, + EN_TANKLEVEL, + EN_INITVOLUME, + EN_MIXMODEL, + EN_MIXZONEVOL, + //demand + //head + //pressure + //quality + EN_TANKDIAM, + EN_MINVOLUME, + EN_MAXVOLUME, + EN_VOLCURVE, + EN_MINLEVEL, + EN_MAXLEVEL, + EN_MIXFRACTION, + EN_TANK_KBULK, + EN_TANKVOLUME + }; + +} + + +BOOST_AUTO_TEST_SUITE_END()