Renaming files, adding test for getstatistics
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// test_project.cpp
|
||||
// test_hydrqual.cpp
|
||||
//
|
||||
// Date Created: January 24, 2018
|
||||
// Date Created: February 28, 2019
|
||||
//
|
||||
// Author: Michael E. Tryby
|
||||
// US EPA - ORD/NRMRL
|
||||
@@ -27,7 +27,7 @@ using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (test_hyd_qual)
|
||||
BOOST_AUTO_TEST_SUITE (test_hydrqual)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_solveH_solveQ, FixtureOpenClose)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ BOOST_FIXTURE_TEST_CASE(test_hydr_savefile, FixtureOpenClose)
|
||||
BOOST_CHECK(filesystem::exists(hyd_file) == true);
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_hydr_usefile, FixtureOpenClose, * unit_test::depends_on("test_hyd_qual/test_hydr_savefile"))
|
||||
BOOST_FIXTURE_TEST_CASE(test_hydr_usefile, FixtureOpenClose, * unit_test::depends_on("test_hydrqual/test_hydr_savefile"))
|
||||
{
|
||||
string hyd_file("test_savefile.hyd");
|
||||
|
||||
@@ -36,7 +36,7 @@ boost::test_tools::predicate_result check_string(std::string test, std::string r
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (test_project)
|
||||
BOOST_AUTO_TEST_SUITE (test_proj)
|
||||
|
||||
BOOST_AUTO_TEST_CASE (test_proj_create_delete)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(test_proj_savefile)
|
||||
EN_deleteproject(&ph_save);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_proj_reopen, * unit_test::depends_on("test_project/test_proj_savefile"))
|
||||
BOOST_AUTO_TEST_CASE(test_proj_reopen, * unit_test::depends_on("test_proj/test_proj_savefile"))
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -138,8 +138,7 @@ BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(test_project_fixture)
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(test_proj_fixture)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_proj_title, FixtureOpenClose)
|
||||
{
|
||||
@@ -214,6 +213,7 @@ BOOST_FIXTURE_TEST_CASE(test_setdemandpattern, FixtureOpenClose)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_addpattern, FixtureOpenClose)
|
||||
{
|
||||
int pat_index, n_patterns_1, n_patterns_2;
|
||||
59
tests/test_rprtanlys.cpp
Normal file
59
tests/test_rprtanlys.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// test_rprtanlys.cpp
|
||||
//
|
||||
// Date Created: February 28, 2019
|
||||
//
|
||||
// Author: Michael E. Tryby
|
||||
// US EPA - ORD/NRMRL
|
||||
//
|
||||
|
||||
//#define BOOST_TEST_DYN_LINK
|
||||
|
||||
#ifdef _WIN32
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_TEST_MODULE hydqual
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "test_fixtures.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (test_rprtanlys)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_rprt_anlysstats, FixtureOpenClose)
|
||||
{
|
||||
int i;
|
||||
double array[5];
|
||||
|
||||
std::vector<double> test;
|
||||
vector<double> ref = {3.0, 7.0799498320679432e-06, 1.6680242187483429e-08,
|
||||
0.0089173150106518495, 0.99999998187144024};
|
||||
|
||||
error = EN_solveH(ph);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_solveQ(ph);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
|
||||
for (i=EN_ITERATIONS; i<=EN_MASSBALANCE; i++) {
|
||||
error = EN_getstatistic(ph, i, &array[i]);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
}
|
||||
|
||||
test.assign(array, array + 5);
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end());
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
Reference in New Issue
Block a user