mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
Merge pull request #2249 from joakim-hove/test-throw
Throw std::runtime_error() instead of std::abort() in test failure
This commit is contained in:
+10
-12
@@ -55,8 +55,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define CHECK(value, expected) \
|
#define CHECK(value, expected) \
|
||||||
{ \
|
{ \
|
||||||
if ((value) != (expected)) \
|
if ((value) != (expected)) { \
|
||||||
std::abort(); \
|
std::cerr << "Test failure: "; \
|
||||||
|
std::cerr << "expected value " << expected << " != " << value << std::endl; \
|
||||||
|
throw std::runtime_error("Test failed"); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_CLOSE(value, expected, reltol) \
|
#define CHECK_CLOSE(value, expected, reltol) \
|
||||||
@@ -64,18 +67,13 @@
|
|||||||
if (std::fabs((expected) - (value)) > 1e-14 && \
|
if (std::fabs((expected) - (value)) > 1e-14 && \
|
||||||
std::fabs(((expected) - (value))/((expected) + (value))) > reltol) \
|
std::fabs(((expected) - (value))/((expected) + (value))) > reltol) \
|
||||||
{ \
|
{ \
|
||||||
std::cout << "Test failure: "; \
|
std::cerr << "Test failure: "; \
|
||||||
std::cout << "expected value " << expected << " is not close to value " << value << std::endl; \
|
std::cerr << "expected value " << expected << " is not close to value " << value << std::endl; \
|
||||||
std::abort(); \
|
throw std::runtime_error("Test failed"); \
|
||||||
} \
|
} \
|
||||||
} \
|
|
||||||
|
|
||||||
#define REQUIRE(cond) \
|
|
||||||
{ \
|
|
||||||
if (!(cond)) \
|
|
||||||
std::abort(); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROPERTIES
|
BEGIN_PROPERTIES
|
||||||
|
|
||||||
NEW_TYPE_TAG(TestEclOutputTypeTag, INHERITS_FROM(BlackOilModel, EclBaseProblem));
|
NEW_TYPE_TAG(TestEclOutputTypeTag, INHERITS_FROM(BlackOilModel, EclBaseProblem));
|
||||||
|
|||||||
Reference in New Issue
Block a user