From 4ca66cc7fed14e52f86864829b411df2ad974340 Mon Sep 17 00:00:00 2001 From: 0tkl <118708188+0tkl@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:55:23 +0800 Subject: [PATCH] handle error codes in tests --- tests/test_demand.cpp | 4 +++- tests/test_overflow.cpp | 4 +++- tests/test_pda.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_demand.cpp b/tests/test_demand.cpp index f39d8f7..52388aa 100644 --- a/tests/test_demand.cpp +++ b/tests/test_demand.cpp @@ -7,7 +7,7 @@ Authors: see AUTHORS Copyright: see AUTHORS License: see LICENSE - Last Updated: 03/21/2019 + Last Updated: 08/02/2023 ****************************************************************************** */ @@ -27,7 +27,9 @@ BOOST_AUTO_TEST_CASE(test_categories_save) EN_Project ph = NULL; error = EN_createproject(&ph); + BOOST_REQUIRE(error == 0); error = EN_open(ph, DATA_PATH_NET1, DATA_PATH_RPT, DATA_PATH_OUT); + BOOST_REQUIRE(error == 0); error = EN_getnodeindex(ph, (char *)"12", &Nindex); BOOST_REQUIRE(error == 0); diff --git a/tests/test_overflow.cpp b/tests/test_overflow.cpp index 5ad60a4..8c3e005 100644 --- a/tests/test_overflow.cpp +++ b/tests/test_overflow.cpp @@ -7,7 +7,7 @@ Authors: see AUTHORS Copyright: see AUTHORS License: see LICENSE - Last Updated: 06/16/2019 + Last Updated: 08/02/2023 ****************************************************************************** */ @@ -32,7 +32,9 @@ BOOST_AUTO_TEST_CASE(test_tank_overflow) EN_Project ph = NULL; error = EN_createproject(&ph); + BOOST_REQUIRE(error == 0); error = EN_open(ph, DATA_PATH_NET1, DATA_PATH_RPT, ""); + BOOST_REQUIRE(error == 0); // Get index of the tank and its inlet/outlet pipe error = EN_getnodeindex(ph, (char *)"2", &Nindex); diff --git a/tests/test_pda.cpp b/tests/test_pda.cpp index b7c1636..6091def 100644 --- a/tests/test_pda.cpp +++ b/tests/test_pda.cpp @@ -7,7 +7,7 @@ Authors: see AUTHORS Copyright: see AUTHORS License: see LICENSE - Last Updated: 07/20/2019 + Last Updated: 08/02/2023 ****************************************************************************** */ @@ -30,7 +30,9 @@ BOOST_AUTO_TEST_CASE(test_pda_model) EN_Project ph = NULL; error = EN_createproject(&ph); + BOOST_REQUIRE(error == 0); error = EN_open(ph, DATA_PATH_NET1, DATA_PATH_RPT, ""); + BOOST_REQUIRE(error == 0); // Set Demand Multiplier to 10 to cause negative pressures error = EN_setoption(ph, EN_DEMANDMULT, 10);