Adding tests for save and use hydraulics file
This commit is contained in:
@@ -220,7 +220,7 @@ typedef struct Project *EN_Project;
|
||||
|
||||
Do not call this function while the hydraulics solver is open.
|
||||
*/
|
||||
int DLLEXPORT EN_usehydfile(EN_Project ph, char *filename);
|
||||
int DLLEXPORT EN_usehydfile(EN_Project ph, const char *filename);
|
||||
|
||||
/**
|
||||
@brief Opens a project's hydraulic solver.
|
||||
@@ -343,7 +343,7 @@ typedef struct Project *EN_Project;
|
||||
called ::EN_solveH or the ::EN_initH - ::EN_runH - ::EN_nextH sequence with the initflag
|
||||
argument of ::EN_initH set to `EN_SAVE` or `EN_SAVE_AND_INIT`.
|
||||
*/
|
||||
int DLLEXPORT EN_savehydfile(EN_Project ph, char *filename);
|
||||
int DLLEXPORT EN_savehydfile(EN_Project ph, const char *filename);
|
||||
|
||||
/**
|
||||
@brief Closes the hydraulic solver freeing all of its allocated memory.
|
||||
|
||||
@@ -583,7 +583,7 @@ int DLLEXPORT EN_closeH(EN_Project p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DLLEXPORT EN_savehydfile(EN_Project p, char *filename)
|
||||
int DLLEXPORT EN_savehydfile(EN_Project p, const char *filename)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: filename = name of file to which hydraulic results are saved
|
||||
** Output: none
|
||||
@@ -611,7 +611,7 @@ int DLLEXPORT EN_savehydfile(EN_Project p, char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DLLEXPORT EN_usehydfile(EN_Project p, char *filename)
|
||||
int DLLEXPORT EN_usehydfile(EN_Project p, const char *filename)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: filename = name of previously saved hydraulics file
|
||||
** Output: none
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#define BOOST_TEST_MODULE "hydqual"
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "test_fixtures.hpp"
|
||||
|
||||
@@ -26,7 +27,7 @@ using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (test_hydraulics_quality)
|
||||
BOOST_AUTO_TEST_SUITE (test_hyd_qual)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_solveH_solveQ, FixtureOpenClose)
|
||||
{
|
||||
@@ -131,4 +132,30 @@ BOOST_FIXTURE_TEST_CASE(test_progressive_step, FixtureOpenClose)
|
||||
|
||||
}
|
||||
|
||||
// saveH
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_hydr_savefile, FixtureOpenClose)
|
||||
{
|
||||
string hyd_file("test_savefile.hyd");
|
||||
|
||||
error = EN_solveH(ph);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_savehydfile(ph, hyd_file.c_str());
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
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"))
|
||||
{
|
||||
string hyd_file("test_savefile.hyd");
|
||||
|
||||
error = EN_usehydfile(ph, hyd_file.c_str());
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_solveQ(ph);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user