Merge pull request #445 from michaeltryby/dev-unittesting

Fix leaky test code
This commit is contained in:
Michael Tryby
2019-04-03 16:58:12 -04:00
committed by GitHub
28 changed files with 459 additions and 357 deletions

View File

@@ -11,12 +11,16 @@
****************************************************************************** ******************************************************************************
*/ */
#include <stdio.h> #ifdef _DEBUG
#include <stdlib.h> #define _CRTDBG_MAP_ALLOC
#include <string.h> #include <stdlib.h>
#ifndef __APPLE__ #include <crtdbg.h>
#include <malloc.h> #else
#include <stdlib.h>
#endif #endif
#include <stdio.h>
#include <string.h>
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>

View File

@@ -10,10 +10,12 @@
Last Updated: 03/17/2019 Last Updated: 03/17/2019
****************************************************************************** ******************************************************************************
*/ */
#ifndef __APPLE__ #ifdef _DEBUG
#include <malloc.h> #define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else #else
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <string.h> #include <string.h>

View File

@@ -11,8 +11,13 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#include <stdlib.h> #define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <string.h> #include <string.h>
#include "epanet_py.h" #include "epanet_py.h"

View File

@@ -11,11 +11,13 @@
****************************************************************************** ******************************************************************************
*/ */
#ifndef __APPLE__ #ifdef _DEBUG
#include <malloc.h> #define _CRTDBG_MAP_ALLOC
#else #include <stdlib.h>
#include <stdlib.h> #include <crtdbg.h>
#endif #else
#include <stdlib.h>
#endif
#include <string.h> #include <string.h>
#include "hash.h" #include "hash.h"

View File

@@ -11,13 +11,16 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -11,13 +11,16 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -12,13 +12,16 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -10,8 +10,15 @@ License: see LICENSE
Last Updated: 11/27/2018 Last Updated: 11/27/2018
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include "types.h" #include "types.h"
#include "funcs.h" #include "funcs.h"

View File

@@ -11,13 +11,16 @@ Last Updated: 04/03/2019
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -11,18 +11,23 @@ Last Updated: 04/03/2019
****************************************************************************** ******************************************************************************
*/ */
#include <stdio.h> #ifdef _DEBUG
#include <stdlib.h> #define _CRTDBG_MAP_ALLOC
#include <string.h> #include <stdlib.h>
#ifndef __APPLE__ #include <crtdbg.h>
#include <malloc.h> #else
#include <stdlib.h>
#endif #endif
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "types.h" #include "types.h"
#include "funcs.h" #include "funcs.h"
#include "hash.h" #include "hash.h"
#include "text.h" #include "text.h"
#include <math.h>
// Default values // Default values
#define MAXITER 200 // Default max. # hydraulic iterations #define MAXITER 200 // Default max. # hydraulic iterations

View File

@@ -11,12 +11,16 @@ Last Updated: 04/03/2019
****************************************************************************** ******************************************************************************
*/ */
#include <stdio.h> #ifdef _DEBUG
#include <stdlib.h> #define _CRTDBG_MAP_ALLOC
#include <string.h> #include <stdlib.h>
#ifndef __APPLE__ #include <crtdbg.h>
#include <malloc.h> #else
#include <stdlib.h>
#endif #endif
#include <stdio.h>
#include <string.h>
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -11,12 +11,16 @@ Last Updated: 03/17/2019
****************************************************************************** ******************************************************************************
*/ */
#include <stdio.h> #ifdef _DEBUG
#include <stdlib.h> #define _CRTDBG_MAP_ALLOC
#include <string.h> #include <stdlib.h>
#ifndef __APPLE__ #include <crtdbg.h>
#include <malloc.h> #else
#include <stdlib.h>
#endif #endif
#include <stdio.h>
#include <string.h>
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -14,10 +14,14 @@
****************************************************************************** ******************************************************************************
*/ */
#include <stdlib.h> #ifdef _DEBUG
#ifndef __APPLE__ #define _CRTDBG_MAP_ALLOC
#include <malloc.h> #include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif #endif
#include "mempool.h" #include "mempool.h"
/* /*

View File

@@ -11,13 +11,16 @@ Last Updated: 11/27/2018
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -11,7 +11,13 @@
****************************************************************************** ******************************************************************************
*/ */
#include <stdlib.h> #ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@@ -11,13 +11,16 @@ Last Updated: 11/27/2018
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include "mempool.h" #include "mempool.h"

View File

@@ -11,6 +11,13 @@ Last Updated: 11/27/2018
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include "types.h" #include "types.h"

View File

@@ -11,13 +11,17 @@ Last Updated: 11/27/2018
****************************************************************************** ******************************************************************************
*/ */
#include <stdio.h> #ifdef _DEBUG
#ifndef __APPLE__ #define _CRTDBG_MAP_ALLOC
#include <malloc.h> #include <stdlib.h>
#include <crtdbg.h>
#else #else
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <stdio.h>
#include <math.h> #include <math.h>
#include "mempool.h" #include "mempool.h"
#include "types.h" #include "types.h"

View File

@@ -11,13 +11,15 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
#define snprintf _snprintf #define snprintf _snprintf

View File

@@ -11,13 +11,15 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include "types.h" #include "types.h"
#include "funcs.h" #include "funcs.h"

View File

@@ -18,13 +18,16 @@
linsolve() -- called from netsolve() in HYDRAUL.C linsolve() -- called from netsolve() in HYDRAUL.C
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <math.h> #include <math.h>
#include <limits.h> #include <limits.h>

View File

@@ -30,7 +30,8 @@ set(toolkit_test_srcs
test_pattern.cpp test_pattern.cpp
test_curve.cpp test_curve.cpp
test_control.cpp test_control.cpp
test_net_builder.cpp) test_net_builder.cpp
)
add_executable(test_toolkit ${toolkit_test_srcs}) add_executable(test_toolkit ${toolkit_test_srcs})

View File

@@ -22,9 +22,10 @@ BOOST_AUTO_TEST_SUITE (test_analysis)
BOOST_FIXTURE_TEST_CASE(test_anlys_getoption, FixtureOpenClose) BOOST_FIXTURE_TEST_CASE(test_anlys_getoption, FixtureOpenClose)
{ {
int i; int i;
double array[12];
std::vector<double> test; std::vector<double> test(12);
double *array = test.data();
std::vector<double> ref = {40.0, 0.001, 0.01, 0.5, 1.0, 0.0, 0.0, 0.0, 75.0, 0.0, 0.0, 0.0}; std::vector<double> ref = {40.0, 0.001, 0.01, 0.5, 1.0, 0.0, 0.0, 0.0, 75.0, 0.0, 0.0, 0.0};
error = EN_solveH(ph); error = EN_solveH(ph);
@@ -35,23 +36,24 @@ BOOST_FIXTURE_TEST_CASE(test_anlys_getoption, FixtureOpenClose)
for (i=EN_TRIALS; i<=EN_DEMANDCHARGE; i++) { for (i=EN_TRIALS; i<=EN_DEMANDCHARGE; i++) {
error = EN_getoption(ph, i, &array[i]); error = EN_getoption(ph, i, array++);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
} }
test.assign(array, array + 12);
BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end()); BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end());
error = EN_getoption(ph, 18, &array[0]); double temp;
error = EN_getoption(ph, 18, &temp);
BOOST_CHECK(error == 251); BOOST_CHECK(error == 251);
} }
BOOST_FIXTURE_TEST_CASE(test_anlys_gettimeparam, FixtureOpenClose) BOOST_FIXTURE_TEST_CASE(test_anlys_gettimeparam, FixtureOpenClose)
{ {
int i; int i;
long array[16];
std::vector<long> test; std::vector<long> test(16);
long *array = test.data();
std::vector<long> ref = {86400, 3600, 300, 7200, 0, 3600, 0, 360, 0, 25, 0, 86400, 86400, 0, 3600, 0}; std::vector<long> ref = {86400, 3600, 300, 7200, 0, 3600, 0, 360, 0, 25, 0, 86400, 86400, 0, 3600, 0};
error = EN_solveH(ph); error = EN_solveH(ph);
@@ -62,14 +64,15 @@ BOOST_FIXTURE_TEST_CASE(test_anlys_gettimeparam, FixtureOpenClose)
for (i=EN_DURATION; i<=EN_NEXTEVENTTANK; i++) { for (i=EN_DURATION; i<=EN_NEXTEVENTTANK; i++) {
error = EN_gettimeparam(ph, i, &array[i]); error = EN_gettimeparam(ph, i, array++);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
} }
test.assign(array, array + 16);
BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end()); BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end());
error = EN_gettimeparam(ph, 18, &array[0]); long temp;
error = EN_gettimeparam(ph, 18, &temp);
BOOST_CHECK(error == 251); BOOST_CHECK(error == 251);
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()

View File

@@ -61,8 +61,8 @@ BOOST_FIXTURE_TEST_CASE(test_curve_comments, FixtureOpenClose)
BOOST_REQUIRE(n2 == n1); BOOST_REQUIRE(n2 == n1);
for (i = 0; i < n1; i++) for (i = 0; i < n1; i++)
{ {
BOOST_REQUIRE(X1[i] == X2[i]); BOOST_CHECK(X1[i] == X2[i]);
BOOST_REQUIRE(Y1[i] == Y2[i]); BOOST_CHECK(Y1[i] == Y2[i]);
} }
} }

View File

@@ -11,6 +11,14 @@
****************************************************************************** ******************************************************************************
*/ */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#endif
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "test_toolkit.hpp" #include "test_toolkit.hpp"
@@ -35,6 +43,9 @@ BOOST_AUTO_TEST_CASE(test_init_close)
struct FixtureInitClose { struct FixtureInitClose {
FixtureInitClose() { FixtureInitClose() {
error = 0;
ph = NULL;
EN_createproject(&ph); EN_createproject(&ph);
EN_init(ph, DATA_PATH_RPT, DATA_PATH_OUT, EN_GPM, EN_HW); EN_init(ph, DATA_PATH_RPT, DATA_PATH_OUT, EN_GPM, EN_HW);
} }
@@ -50,55 +61,55 @@ struct FixtureInitClose {
//BOOST_AUTO_TEST_CASE(net_builder_I) // BOOST_AUTO_TEST_CASE(net_builder_I)
//{ // {
// int error = 0; // int error = 0;
// int flag = 00; // int flag = 00;
// long t, tstep; // long t, tstep;
// int i, ind, Lindex, Nindex, Cindex; // int i, ind, Lindex, Nindex, Cindex;
// double h_orig, h_build, h_build_loaded; // double h_orig, h_build, h_build_loaded;
// //
// // first we load Net1.inp, run it and record the head in Tank 2 at the end of the simulation (h_orig) // // first we load Net1.inp, run it and record the head in Tank 2 at the end of the simulation (h_orig)
// EN_Project ph = NULL; // EN_Project ph = NULL;
// EN_createproject(&ph); // EN_createproject(&ph);
// //
// std::string path_inp = std::string(DATA_PATH_NET1); // std::string path_inp = std::string(DATA_PATH_NET1);
// std::string path_rpt = std::string(DATA_PATH_RPT); // std::string path_rpt = std::string(DATA_PATH_RPT);
// std::string path_out = std::string(DATA_PATH_OUT); // std::string path_out = std::string(DATA_PATH_OUT);
// //
// error = EN_open(ph, path_inp.c_str(), path_rpt.c_str(), path_out.c_str()); // error = EN_open(ph, path_inp.c_str(), path_rpt.c_str(), path_out.c_str());
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// error = EN_getnodeindex(ph, (char *)"2", &Nindex); // error = EN_getnodeindex(ph, (char *)"2", &Nindex);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// error = EN_openH(ph); // error = EN_openH(ph);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// error = EN_initH(ph, flag); // error = EN_initH(ph, flag);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// do { // do {
// error = EN_runH(ph, &t); // error = EN_runH(ph, &t);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// // this is the head at the end of the simulation after loading the original Net1.inp // // this is the head at the end of the simulation after loading the original Net1.inp
// error = EN_getnodevalue(ph, Nindex, EN_HEAD, &h_orig); // error = EN_getnodevalue(ph, Nindex, EN_HEAD, &h_orig);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// error = EN_nextH(ph, &tstep); // error = EN_nextH(ph, &tstep);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// } while (tstep > 0); // } while (tstep > 0);
// //
// error = EN_closeH(ph); // error = EN_closeH(ph);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// error = EN_close(ph); // error = EN_close(ph);
// BOOST_REQUIRE(error == 0); // BOOST_REQUIRE(error == 0);
// //
// EN_deleteproject(&ph); // EN_deleteproject(&ph);
//} // }
BOOST_FIXTURE_TEST_CASE(test_build_net1, FixtureInitClose) BOOST_FIXTURE_TEST_CASE(test_build_net1, FixtureInitClose)
{ {

View File

@@ -11,6 +11,8 @@
****************************************************************************** ******************************************************************************
*/ */
#include <string.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@@ -109,37 +111,39 @@ BOOST_AUTO_TEST_SUITE(test_proj_fixture)
BOOST_FIXTURE_TEST_CASE(test_title, FixtureOpenClose) BOOST_FIXTURE_TEST_CASE(test_title, FixtureOpenClose)
{ {
// How is the API user supposed to know array size? // How is the API user supposed to know array size?
char c_test[3][80], c_ref[3][80]; char c_test[3][80];
strncpy(c_ref[0], " EPANET Example Network 1", 26); // ref is an automatic variable and therefore doesn't need to be deleted
strncpy(c_ref[1], "A simple example of modeling chlorine decay. Both bulk and", 59); std::string ref[3] = {
strncpy(c_ref[2], "wall reactions are included. ", 30); " EPANET Example Network 1",
"A simple example of modeling chlorine decay. Both bulk and",
"wall reactions are included. "};
error = EN_gettitle(ph, c_test[0], c_test[1], c_test[2]); error = EN_gettitle(ph, c_test[0], c_test[1], c_test[2]);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
std::string test (c_test[i]); std::string test (c_test[i]);
std::string ref (c_ref[i]); BOOST_CHECK(check_string(test, ref[i]));
BOOST_CHECK(check_string(test, ref)); }
}
// Need a test for EN_settitle // Need a test for EN_settitle
} }
BOOST_FIXTURE_TEST_CASE(test_getcount, FixtureOpenClose) BOOST_FIXTURE_TEST_CASE(test_getcount, FixtureOpenClose)
{ {
int i, array[7]; int i;
std::vector<int> test; std::vector<int> test(7);
std::vector<int> ref = { 11, 2, 13, 1, 1, 2, 0 }; int *array = test.data();
std::vector<int> ref = { 11, 2, 13, 1, 1, 2, 0 };
for (i=EN_NODECOUNT; i<=EN_RULECOUNT; i++) { for (i=EN_NODECOUNT; i<=EN_RULECOUNT; i++) {
error = EN_getcount(ph, i, &array[i]); error = EN_getcount(ph, i, array++);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
} }
test.assign(array, array + 7);
BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end()); BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end());
error = EN_getcount(ph, 7, &i); error = EN_getcount(ph, 7, &i);

View File

@@ -21,9 +21,10 @@ BOOST_AUTO_TEST_SUITE (test_report)
BOOST_FIXTURE_TEST_CASE(test_rprt_anlysstats, FixtureOpenClose) BOOST_FIXTURE_TEST_CASE(test_rprt_anlysstats, FixtureOpenClose)
{ {
int i; int i;
double array[5];
std::vector<double> test; std::vector<double> test(5);
double *array = test.data();
std::vector<double> ref = {3.0, 7.0799498320679432e-06, 1.6680242187483429e-08, std::vector<double> ref = {3.0, 7.0799498320679432e-06, 1.6680242187483429e-08,
0.0089173150106518495, 0.99999998187144024}; 0.0089173150106518495, 0.99999998187144024};
@@ -35,15 +36,13 @@ BOOST_FIXTURE_TEST_CASE(test_rprt_anlysstats, FixtureOpenClose)
for (i=EN_ITERATIONS; i<=EN_MASSBALANCE; i++) { for (i=EN_ITERATIONS; i<=EN_MASSBALANCE; i++) {
error = EN_getstatistic(ph, i, &array[i]); error = EN_getstatistic(ph, i, array++);
BOOST_REQUIRE(error == 0); BOOST_REQUIRE(error == 0);
} }
test.assign(array, array + 5);
// BOOST_CHECK_EQUAL_COLLECTIONS(ref.begin(), ref.end(), test.begin(), test.end());
BOOST_CHECK(check_cdd_double(test, ref, 3)); BOOST_CHECK(check_cdd_double(test, ref, 3));
error = EN_getstatistic(ph, 8, &array[0]); double temp;
error = EN_getstatistic(ph, 8, &temp);
BOOST_CHECK(error == 251); BOOST_CHECK(error == 251);
} }

View File

@@ -14,7 +14,6 @@
#ifndef TEST_TOOLKIT_HPP #ifndef TEST_TOOLKIT_HPP
#define TEST_TOOLKIT_HPP #define TEST_TOOLKIT_HPP
#include "epanet2_2.h" #include "epanet2_2.h"
@@ -25,6 +24,9 @@
struct FixtureOpenClose{ struct FixtureOpenClose{
FixtureOpenClose() { FixtureOpenClose() {
error = 0;
ph = NULL;
EN_createproject(&ph); EN_createproject(&ph);
error = EN_open(ph, DATA_PATH_NET1, DATA_PATH_RPT, DATA_PATH_OUT); error = EN_open(ph, DATA_PATH_NET1, DATA_PATH_RPT, DATA_PATH_OUT);
} }
@@ -41,6 +43,9 @@ struct FixtureOpenClose{
struct FixtureAfterStep{ struct FixtureAfterStep{
FixtureAfterStep() { FixtureAfterStep() {
error = 0;
ph = NULL;
flag = 0; flag = 0;
tstop = 10800; tstop = 10800;