mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06: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:
commit
3968d23a5a
@ -55,8 +55,11 @@
|
||||
#include <string.h>
|
||||
#define CHECK(value, expected) \
|
||||
{ \
|
||||
if ((value) != (expected)) \
|
||||
std::abort(); \
|
||||
if ((value) != (expected)) { \
|
||||
std::cerr << "Test failure: "; \
|
||||
std::cerr << "expected value " << expected << " != " << value << std::endl; \
|
||||
throw std::runtime_error("Test failed"); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECK_CLOSE(value, expected, reltol) \
|
||||
@ -64,18 +67,13 @@
|
||||
if (std::fabs((expected) - (value)) > 1e-14 && \
|
||||
std::fabs(((expected) - (value))/((expected) + (value))) > reltol) \
|
||||
{ \
|
||||
std::cout << "Test failure: "; \
|
||||
std::cout << "expected value " << expected << " is not close to value " << value << std::endl; \
|
||||
std::abort(); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define REQUIRE(cond) \
|
||||
{ \
|
||||
if (!(cond)) \
|
||||
std::abort(); \
|
||||
std::cerr << "Test failure: "; \
|
||||
std::cerr << "expected value " << expected << " is not close to value " << value << std::endl; \
|
||||
throw std::runtime_error("Test failed"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
BEGIN_PROPERTIES
|
||||
|
||||
NEW_TYPE_TAG(TestEclOutputTypeTag, INHERITS_FROM(BlackOilModel, EclBaseProblem));
|
||||
|
Loading…
Reference in New Issue
Block a user