Cleaning up include statements
Removing inclusion of malloc.h. Adding crtdbg.h
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "epanet2.h"
|
#include "epanet2.h"
|
||||||
|
|
||||||
void writeConsole(char *s)
|
void writeConsole(char *s)
|
||||||
|
|||||||
41
src/epanet.c
41
src/epanet.c
@@ -11,12 +11,17 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#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>
|
||||||
|
|
||||||
@@ -216,26 +221,24 @@ int DLLEXPORT EN_open(EN_Project p, const char *inpFile, const char *rptFile,
|
|||||||
ERRCODE(netsize(p));
|
ERRCODE(netsize(p));
|
||||||
ERRCODE(allocdata(p));
|
ERRCODE(allocdata(p));
|
||||||
|
|
||||||
// Read input data
|
if (!errcode) {
|
||||||
ERRCODE(getdata(p));
|
// Read input data
|
||||||
|
ERRCODE(getdata(p));
|
||||||
|
|
||||||
// Close input file
|
// Close input file
|
||||||
if (p->parser.InFile != NULL)
|
if (p->parser.InFile != NULL) {
|
||||||
{
|
|
||||||
fclose(p->parser.InFile);
|
fclose(p->parser.InFile);
|
||||||
p->parser.InFile = NULL;
|
p->parser.InFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free temporary linked lists used for Patterns & Curves
|
// Free temporary linked lists used for Patterns & Curves
|
||||||
freeTmplist(p->parser.Patlist);
|
freeTmplist(p->parser.Patlist);
|
||||||
freeTmplist(p->parser.Curvelist);
|
freeTmplist(p->parser.Curvelist);
|
||||||
|
|
||||||
// If using previously saved hydraulics file then open it
|
// If using previously saved hydraulics file then open it
|
||||||
if (p->outfile.Hydflag == USE) ERRCODE(openhydfile(p));
|
if (p->outfile.Hydflag == USE) ERRCODE(openhydfile(p));
|
||||||
|
|
||||||
// Write input summary to report file
|
// Write input summary to report file
|
||||||
if (!errcode)
|
|
||||||
{
|
|
||||||
if (p->report.Summaryflag) writesummary(p);
|
if (p->report.Summaryflag) writesummary(p);
|
||||||
writetime(p, FMT104);
|
writetime(p, FMT104);
|
||||||
p->Openflag = TRUE;
|
p->Openflag = TRUE;
|
||||||
|
|||||||
@@ -10,11 +10,15 @@
|
|||||||
Last Updated: 03/17/2019
|
Last Updated: 03/17/2019
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
#ifdef _DEBUG
|
||||||
|
#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>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ typedef struct {
|
|||||||
Project *project;
|
Project *project;
|
||||||
error_handle_t *error;
|
error_handle_t *error;
|
||||||
}handle_t;
|
}handle_t;
|
||||||
|
|
||||||
// Extern functions
|
// Extern functions
|
||||||
extern char *geterrmsg(int, char *);
|
extern char *geterrmsg(int, char *);
|
||||||
// Local functions
|
// Local functions
|
||||||
|
|||||||
@@ -11,12 +11,9 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
|
||||||
#else
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|
||||||
#define HASHTABLEMAXSIZE 128000
|
#define HASHTABLEMAXSIZE 128000
|
||||||
|
|||||||
@@ -11,13 +11,9 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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"
|
||||||
|
|||||||
@@ -11,13 +11,9 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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"
|
||||||
|
|||||||
@@ -12,13 +12,9 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Last Updated: 11/27/2018
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,7 @@ Last Updated: 03/17/2019
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
|
||||||
#else
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|||||||
14
src/input1.c
14
src/input1.c
@@ -10,19 +10,23 @@ License: see LICENSE
|
|||||||
Last Updated: 03/17/2019
|
Last Updated: 03/17/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 <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef __APPLE__
|
#include <math.h>
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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
|
||||||
|
|||||||
15
src/input2.c
15
src/input2.c
@@ -10,13 +10,16 @@ License: see LICENSE
|
|||||||
Last Updated: 03/17/2019
|
Last Updated: 03/17/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 <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@@ -147,7 +150,7 @@ int readdata(Project *pr)
|
|||||||
inperr, errsum; // Error code & total error count
|
inperr, errsum; // Error code & total error count
|
||||||
|
|
||||||
// Allocate input buffer
|
// Allocate input buffer
|
||||||
parser->X = (double *)calloc(MAXTOKS, sizeof(double));
|
parser->X = (double *)calloc(MAXTOKS + 1, sizeof(double));
|
||||||
ERRCODE(MEMCHECK(parser->X));
|
ERRCODE(MEMCHECK(parser->X));
|
||||||
if (errcode) return errcode;
|
if (errcode) return errcode;
|
||||||
|
|
||||||
@@ -175,7 +178,7 @@ int readdata(Project *pr)
|
|||||||
while (fgets(line, MAXLINE, parser->InFile) != NULL)
|
while (fgets(line, MAXLINE, parser->InFile) != NULL)
|
||||||
{
|
{
|
||||||
// Make copy of line and scan for tokens
|
// Make copy of line and scan for tokens
|
||||||
strcpy(wline, line);
|
strncpy(wline, line, MAXLINE);
|
||||||
parser->Ntokens = gettokens(wline, parser->Tok, MAXTOKS, parser->Comment);
|
parser->Ntokens = gettokens(wline, parser->Tok, MAXTOKS, parser->Comment);
|
||||||
|
|
||||||
// Skip blank lines and those filled with a comment
|
// Skip blank lines and those filled with a comment
|
||||||
|
|||||||
11
src/input3.c
11
src/input3.c
@@ -10,13 +10,16 @@ License: see LICENSE
|
|||||||
Last Updated: 03/17/2019
|
Last Updated: 03/17/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 <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|||||||
@@ -15,9 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#include "mempool.h"
|
#include "mempool.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ Last Updated: 11/27/2018
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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"
|
||||||
|
|||||||
@@ -11,14 +11,18 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#ifdef _DEBUG
|
||||||
#include <string.h>
|
#define _CRTDBG_MAP_ALLOC
|
||||||
#ifndef __APPLE__
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <crtdbg.h>
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
//*** For the Windows SDK _tempnam function ***//
|
//*** For the Windows SDK _tempnam function ***//
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ Last Updated: 11/27/2018
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Last Updated: 11/27/2018
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
// Exported functions
|
// Exported functions
|
||||||
|
|||||||
@@ -11,13 +11,10 @@ Last Updated: 11/27/2018
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#ifndef __APPLE__
|
|
||||||
#include <malloc.h>
|
|
||||||
#else
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "mempool.h"
|
#include "mempool.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,10 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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
|
||||||
|
|||||||
@@ -11,13 +11,9 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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"
|
||||||
|
|||||||
@@ -18,16 +18,11 @@
|
|||||||
linsolve() -- called from netsolve() in HYDRAUL.C
|
linsolve() -- called from netsolve() in HYDRAUL.C
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#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>
|
||||||
|
|
||||||
#include <time.h> //For optional timer macros
|
#include <time.h> //For optional timer macros
|
||||||
|
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|||||||
@@ -14,9 +14,11 @@
|
|||||||
#ifndef TYPES_H
|
#ifndef TYPES_H
|
||||||
#define TYPES_H
|
#define TYPES_H
|
||||||
|
|
||||||
#include "hash.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "hash.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
Definition of 4-byte integers & reals
|
Definition of 4-byte integers & reals
|
||||||
|
|||||||
@@ -10,13 +10,7 @@
|
|||||||
// US EPA - ORD/NRMRL
|
// US EPA - ORD/NRMRL
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
//#ifdef _WIN32
|
|
||||||
//#define _CRTDBG_MAP_ALLOC
|
|
||||||
//#include <stdlib.h>
|
|
||||||
//#include <crtdbg.h>
|
|
||||||
//#else
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
//#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "errormanager.h"
|
#include "errormanager.h"
|
||||||
|
|||||||
@@ -19,18 +19,19 @@ endif(UNIX)
|
|||||||
set(toolkit_test_srcs
|
set(toolkit_test_srcs
|
||||||
test_toolkit.cpp
|
test_toolkit.cpp
|
||||||
test_project.cpp
|
test_project.cpp
|
||||||
test_hydraulics.cpp
|
# test_hydraulics.cpp
|
||||||
test_quality.cpp
|
# test_quality.cpp
|
||||||
test_report.cpp
|
# test_report.cpp
|
||||||
test_analysis.cpp
|
# test_analysis.cpp
|
||||||
test_node.cpp
|
# test_node.cpp
|
||||||
test_demand.cpp
|
# test_demand.cpp
|
||||||
test_link.cpp
|
# test_link.cpp
|
||||||
# test_pump.cpp
|
# test_pump.cpp
|
||||||
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})
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define BOOST_ALL_DYN_LINK
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include "test_toolkit.hpp"
|
#include "test_toolkit.hpp"
|
||||||
|
|||||||
@@ -56,35 +56,47 @@ BOOST_AUTO_TEST_CASE(test_save)
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
EN_Project ph_save;
|
EN_Project ph = NULL;
|
||||||
|
|
||||||
EN_createproject(&ph_save);
|
error = EN_createproject(&ph);
|
||||||
error = EN_open(ph_save, DATA_PATH_NET1, DATA_PATH_RPT, DATA_PATH_OUT);
|
|
||||||
BOOST_REQUIRE(error == 0);
|
|
||||||
|
|
||||||
error = EN_saveinpfile(ph_save, "test_reopen.inp");
|
|
||||||
BOOST_REQUIRE(error == 0);
|
|
||||||
|
|
||||||
BOOST_CHECK(boost::filesystem::exists("test_reopen.inp") == true);
|
|
||||||
|
|
||||||
error = EN_close(ph_save);
|
|
||||||
BOOST_REQUIRE(error == 0);
|
BOOST_REQUIRE(error == 0);
|
||||||
EN_deleteproject(&ph_save);
|
|
||||||
|
error = EN_open(ph, DATA_PATH_NET1, DATA_PATH_RPT, DATA_PATH_OUT);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
error = EN_saveinpfile(ph, DATA_PATH_TMP);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
BOOST_CHECK(boost::filesystem::exists(DATA_PATH_TMP) == true);
|
||||||
|
|
||||||
|
error = EN_close(ph);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
error = EN_deleteproject(&ph);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
BOOST_CHECK(ph == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_reopen, * boost::unit_test::depends_on("test_project/test_save"))
|
BOOST_AUTO_TEST_CASE(test_reopen, * boost::unit_test::depends_on("test_project/test_save"))
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
EN_Project ph_reopen;
|
EN_Project ph = NULL;
|
||||||
|
|
||||||
EN_createproject(&ph_reopen);
|
error = EN_createproject(&ph);
|
||||||
error = EN_open(ph_reopen, "test_reopen.inp", DATA_PATH_RPT, DATA_PATH_OUT);
|
BOOST_REQUIRE(error == 0);
|
||||||
BOOST_REQUIRE(error == 0);
|
|
||||||
|
|
||||||
error = EN_close(ph_reopen);
|
error = EN_open(ph, DATA_PATH_TMP, DATA_PATH_RPT, DATA_PATH_OUT);
|
||||||
BOOST_REQUIRE(error == 0);
|
BOOST_REQUIRE(error == 0);
|
||||||
EN_deleteproject(&ph_reopen);
|
|
||||||
|
error = EN_close(ph);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
EN_deleteproject(&ph);
|
||||||
|
BOOST_REQUIRE(error == 0);
|
||||||
|
|
||||||
|
BOOST_CHECK(ph == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_run)
|
BOOST_AUTO_TEST_CASE(test_run)
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
#ifndef TEST_TOOLKIT_HPP
|
#ifndef TEST_TOOLKIT_HPP
|
||||||
#define TEST_TOOLKIT_HPP
|
#define TEST_TOOLKIT_HPP
|
||||||
|
|
||||||
|
// MSVC ONLY
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define _CRTDBG_MAP_ALLOC
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <crtdbg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "epanet2_2.h"
|
#include "epanet2_2.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user