Merge pull request #457 from michaeltryby/dev
Minor update to unit tests
This commit is contained in:
0
tests/outfile/data/enP1kAlM
Normal file
0
tests/outfile/data/enP1kAlM
Normal file
@@ -20,6 +20,41 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (test_link)
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_adddelete_link, FixtureInitClose)
|
||||
{
|
||||
int index;
|
||||
|
||||
// Build a network
|
||||
EN_addnode(ph, (char *)"N1", EN_JUNCTION);
|
||||
EN_addnode(ph, (char *)"N2", EN_JUNCTION);
|
||||
EN_addnode(ph, (char *)"N3", EN_RESERVOIR);
|
||||
|
||||
error = EN_addlink(ph, (char *)"L1", EN_PUMP, (char *)"N3", (char *)"N1");
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_addlink(ph, (char *)"L2", EN_PIPE, (char *)"N1", (char *)"N3");
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_getlinkindex(ph, (char *)"L2", &index);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_deletelink(ph, index, EN_UNCONDITIONAL);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_addlink(ph, (char *)"L3", EN_PIPE, (char *)"N1", (char *)"N2");
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_getlinkindex(ph, (char *)"L1", &index);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_deletelink(ph, index, EN_UNCONDITIONAL);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_getlinkindex(ph, (char *)"L3", &index);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_deletelink(ph, index, EN_UNCONDITIONAL);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_setlinktype)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
Project: OWA EPANET
|
||||
Version: 2.2
|
||||
Module: test_net_builder.cpp
|
||||
Description: Tests EPANET toolkit api functions
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 03/21/2019
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
Project: OWA EPANET
|
||||
Version: 2.2
|
||||
Module: test_net_builder.cpp
|
||||
Description: Tests EPANET toolkit api functions
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 04/12/2019
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#define BOOST_TEST_MODULE net_builder
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
@@ -400,10 +400,10 @@ BOOST_AUTO_TEST_CASE(test_reopen_net2, *boost::unit_test::depends_on("test_net_b
|
||||
//cout << "\n Link L2 Flow: " << q2_1 << " " << q2_2;
|
||||
|
||||
// Compare old & new results
|
||||
// BOOST_CHECK(abs(p1_1 - p1_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(q1_1 - q1_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(p2_1 - p2_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(q2_1 - q2_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(p1_1 - p1_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(q1_1 - q1_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(p2_1 - p2_2) < 1.e-5);
|
||||
// BOOST_CHECK(abs(q2_1 - q2_2) < 1.e-5);
|
||||
|
||||
// Close project
|
||||
EN_close(ph);
|
||||
|
||||
@@ -18,6 +18,35 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE (test_node)
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_adddelete_node, FixtureInitClose)
|
||||
{
|
||||
int index;
|
||||
|
||||
error = EN_addnode(ph, (char *)"N2", EN_JUNCTION);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_addnode(ph, (char *)"N3", EN_RESERVOIR);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_getnodeindex(ph, (char *)"N2", &index);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_addnode(ph, (char *)"N4", EN_TANK);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
error = EN_getnodeindex(ph, (char *)"N4", &index);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_getnodeindex(ph, (char *)"N3", &index);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_deletenode(ph, index, EN_UNCONDITIONAL);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_junc_props, FixtureOpenClose)
|
||||
{
|
||||
int index;
|
||||
@@ -297,4 +326,5 @@ BOOST_AUTO_TEST_CASE(test_reopen_comment, * boost::unit_test::depends_on("node_c
|
||||
EN_deleteproject(&ph);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user