summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoronqtam <vik.kirilov@gmail.com>2018-12-01 18:47:12 +0200
committeronqtam <vik.kirilov@gmail.com>2018-12-05 17:35:23 +0200
commitc494843840e007013e7951d9298b0bdd866568bd (patch)
treed6e3e423888daa405ac6568c59875d3007c71775
parentabb864e8028e48f08525b8cb35c61b8f373e04c6 (diff)
fixes #166 and fixes #167 - TODO: update benchmarks page
-rw-r--r--README.md2
-rw-r--r--doc/markdown/assertions.md28
-rw-r--r--doc/markdown/configuration.md6
-rw-r--r--doc/markdown/faq.md21
-rw-r--r--doc/markdown/roadmap.md10
-rw-r--r--doc/markdown/tutorial.md2
-rw-r--r--doctest/doctest.h301
-rw-r--r--doctest/parts/doctest_fwd.h250
-rw-r--r--doctest/parts/doctest_impl.h51
-rw-r--r--examples/all_features/alternative_macros.cpp2
-rw-r--r--examples/all_features/assertion_macros.cpp53
-rw-r--r--examples/all_features/asserts_used_outside_of_tests.cpp6
-rw-r--r--examples/all_features/doctest_proxy.h25
-rw-r--r--examples/all_features/test_output/all_binary.txt74
-rw-r--r--examples/all_features/test_output/assertion_macros.cpp.txt43
-rw-r--r--examples/all_features/test_output/asserts_used_outside_of_tests.cpp.txt16
-rw-r--r--examples/all_features/test_output/filter_2.txt2
-rw-r--r--scripts/playground/test.cpp4
18 files changed, 237 insertions, 659 deletions
diff --git a/README.md b/README.md
index 537796b..cfd647a 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@
</table>
</b>
-**doctest** is a new C++ testing framework but is by far the fastest both in compile times (by [**orders of magnitude**](doc/markdown/benchmarks.md)) and runtime compared to other feature-rich alternatives. It brings the ability of compiled languages such as [**D**](https://dlang.org/spec/unittest.html) / [**Rust**](https://doc.rust-lang.org/book/testing.html) / [**Nim**](https://nim-lang.org/docs/unittest.html) to have tests written directly in the production code by providing a fast, transparent and flexible test runner with a clean interface.
+**doctest** is a new C++ testing framework but is by far the fastest both in compile times (by [**orders of magnitude**](doc/markdown/benchmarks.md)) and runtime compared to other feature-rich alternatives. It brings the ability of compiled languages such as [**D**](https://dlang.org/spec/unittest.html) / [**Rust**](https://doc.rust-lang.org/book/second-edition/ch11-00-testing.html) / [**Nim**](https://nim-lang.org/docs/unittest.html) to have tests written directly in the production code by providing a fast, transparent and flexible test runner with a clean interface.
[<img src="https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png" align="right">](http://www.patreon.com/onqtam)
diff --git a/doc/markdown/assertions.md b/doc/markdown/assertions.md
index 3a994b5..69d505d 100644
--- a/doc/markdown/assertions.md
+++ b/doc/markdown/assertions.md
@@ -34,7 +34,7 @@ CHECK(thisReturnsTrue());
REQUIRE(i < 42);
```
-Negating asserts - ```<LEVEL>_FALSE(expression)``` - evaluates the expression and records the _logical NOT_ of the result.
+- Negating asserts - ```<LEVEL>_FALSE(expression)``` - evaluates the expression and records the _logical NOT_ of the result.
These forms exist as a workaround for the fact that ```!``` prefixed expressions cannot be decomposed properly.
@@ -44,7 +44,8 @@ Example:
REQUIRE_FALSE(thisReturnsFalse());
```
-Note that these asserts also have a ```_MESSAGE``` form - like ```CHECK_MESSAGE(expression, message)``` which is basically a code block ```{}``` with a scoped [**```INFO()```**](logging.md#info) logging macro together with the ```CHECK``` macro - that way the message will be relevant only to that assert. All the other binary/unary/fast asserts don't have this variation.
+- Using the [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config option can make compilation of asserts lightning fast - by up to [**XX-XX%**](benchmarks.md#cost-of-an-assertion-macro)!
+- These asserts also have a ```_MESSAGE``` form - like ```CHECK_MESSAGE(expression, message)``` which is basically a code block ```{}``` with a scoped [**```INFO()```**](logging.md#info) logging macro together with the ```CHECK``` macro - that way the message will be relevant only to that assert. The binary/unary asserts don't have this variation yet.
Examples:
@@ -62,7 +63,7 @@ For more information about the ```INFO()``` macro and logging with the streaming
These asserts don't use templates to decompose the comparison expressions for the left and right parts.
-These have the same guarantees as the expression decomposing ones - just less templates - [**25%-45% faster**](benchmarks.md#cost-of-an-assertion-macro) for compile times.
+These have the same guarantees as the expression decomposing ones but [**XX%-XX% faster**](benchmarks.md#cost-of-an-assertion-macro) for compilation.
```<LEVEL>``` is one of 3 possible: ```REQUIRE```/```CHECK```/```WARN```.
@@ -75,24 +76,7 @@ These have the same guarantees as the expression decomposing ones - just less te
- ```<LEVEL>_UNARY(expr)``` - same as ```<LEVEL>(expr)```
- ```<LEVEL>_UNARY_FALSE(expr)``` - same as ```<LEVEL>_FALSE(expr)```
-## Fast asserts
-
-These are the faster versions of the binary and unary asserts - by [**60-80%**](benchmarks.md#cost-of-an-assertion-macro) of compile time.
-
-The difference is they don't evaluate the expression in a ```try/catch``` block - if the expression throws the whole test case ends.
-
-There is also the [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config identifier that makes them even faster by another [**50-80%**](benchmarks.md#cost-of-an-assertion-macro)!
-
-```<LEVEL>``` is one of 3 possible: ```REQUIRE```/```CHECK```/```WARN```.
-
-- ```FAST_<LEVEL>_EQ(left, right)``` - almost the same as ```<LEVEL>(left == right)```
-- ```FAST_<LEVEL>_NE(left, right)``` - almost the same as ```<LEVEL>(left != right)```
-- ```FAST_<LEVEL>_GT(left, right)``` - almost the same as ```<LEVEL>(left > right)```
-- ```FAST_<LEVEL>_LT(left, right)``` - almost the same as ```<LEVEL>(left < right)```
-- ```FAST_<LEVEL>_GE(left, right)``` - almost the same as ```<LEVEL>(left >= right)```
-- ```FAST_<LEVEL>_LE(left, right)``` - almost the same as ```<LEVEL>(left <= right)```
-- ```FAST_<LEVEL>_UNARY(expr)``` - almost the same as ```<LEVEL>(expr)```
-- ```FAST_<LEVEL>_UNARY_FALSE(expr)``` - almost the same as ```<LEVEL>_FALSE(expr)```
+- Using the [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config option can make compilation of asserts lightning fast - by up to [**XX-XX%**](benchmarks.md#cost-of-an-assertion-macro)!
## Exceptions
@@ -133,7 +117,7 @@ Asserts can be used outside of a testing context (in code not called from a ```T
A ```doctest::Context``` object still has to be created somewhere and set as the default one using the ```setAsDefaultForAssertsOutOfTestCases()``` method - and then asserts will work. A handler can be registered by calling the ```setAssertHandler()``` method on the context object. If no handler is set then ```std::abort()``` is called on failure.
-The results would be best when using the [**fast asserts**](assertions.md#fast-asserts) coupled with the [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config identifier and by defining your own macro aliases - like shown [**here**](../../examples/all_features/doctest_proxy.h).
+The results would be best when using the [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config identifier.
Checkout the [**example**](../../examples/all_features/asserts_used_outside_of_tests.cpp) showcasing how that is done. For more information see the [**issue for the feature request**](https://github.com/onqtam/doctest/issues/114).
diff --git a/doc/markdown/configuration.md b/doc/markdown/configuration.md
index f34bf08..1177c23 100644
--- a/doc/markdown/configuration.md
+++ b/doc/markdown/configuration.md
@@ -93,9 +93,11 @@ This should be defined globally.
### **```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**
-This makes the fast assert macros (```FAST_CHECK_EQ(a,b)``` - with a ```FAST_``` prefix) compile [**even faster**](benchmarks.md#cost-of-an-assertion-macro)! (50-80%)
+This config option makes the assert macros (except for those dealing with exceptions) compile [**much faster**](benchmarks.md#cost-of-an-assertion-macro)! (XX-XX%)
-Each fast assert is turned into a single function call - the only downside of this is: if an assert fails and a debugger is attached - when it breaks it will be in an internal function - the user will have to go 1 level up in the callstack to see the actual assert.
+Each assert is turned into a single function call - the only downside of this is: if an assert fails and a debugger is attached - when it breaks it will be in an internal function - the user will have to go 1 level up in the callstack to see the actual assert.
+
+It also implies [**```DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS```**](#doctest_config_no_try_catch_in_asserts) (so exceptions thrown during the evaluation of an assert are not caught by the assert itself but by the testing framework - meaning that the test case is immediately aborted).
This can be defined both globally and in specific source files only.
diff --git a/doc/markdown/faq.md b/doc/markdown/faq.md
index cc34376..b4a9964 100644
--- a/doc/markdown/faq.md
+++ b/doc/markdown/faq.md
@@ -47,25 +47,26 @@ A quick and easy way to migrate most of your Catch tests to doctest is to change
```c++
#include "path/to/doctest.h"
-#undef TEST_CASE
-#define TEST_CASE(name, tags) DOCTEST_TEST_CASE(tags " " name) // will concatenate the tags and test name string literals to one
#define SECTION(name) DOCTEST_SUBCASE(name)
-using doctest::Approx; // catch exposes this by default outside of its namespace
+// only if tags are used: will concatenate them to the test name string literal
+#undef TEST_CASE
+#define TEST_CASE(name, tags) DOCTEST_TEST_CASE(tags " " name)
+
+// catch exposes this by default outside of its namespace
+using doctest::Approx;
```
### How to get the best compile-time performance with the framework?
-Using the [**fast**](assertions.md#fast-asserts) asserts in combination with [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) yelds the [**fastest**](benchmarks.md#cost-of-an-assertion-macro) compile times.
-
-There are only 2 drawbacks of this approach:
+The [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config option yelds the [**fastest possible**](benchmarks.md#cost-of-an-assertion-macro) compile times (up to XX-XX%). Also the expression-decomposing template machinery can be skipped by using the [**binary**](assertions.md#binary-and-unary-asserts) asserts.
-- using fast asserts (60-90% [**faster**](benchmarks.md#cost-of-an-assertion-macro) than ```CHECK(a==b)```) means that there is no ```try/catch``` block in each assert so if an expression throws the whole test case ends.
-- defining the [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.md#doctest_config_super_fast_asserts) config identifier will result in even [**faster**](benchmarks.md#cost-of-an-assertion-macro) fast asserts (50-80%) at the cost of only one thing: when an assert fails and a debugger is present - the framework will break inside a doctest function so the user will have to go 1 level up in the callstack to see where the actual assert is in the source code.
+There are only 2 tiny drawbacks of using this config option:
-These 2 things can be considered negligible if you are dealing mainly with arithmetic (expressions are unlikely to throw exceptions) and all the tests usually pass (you don't need to often navigate to a failing assert with a debugger attached)
+- there is no ```try/catch``` block in each assert so if an expression is thrown the whole test case ends (but is still caught and reported).
+- when an assert fails and a debugger is present - the framework will break inside a doctest function so the user will have to go 1 level up in the callstack to see where the actual assert is in the source code.
-If you want better aliases for the asserts instead of the long ones you could use [**```DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES```**](configuration.md#doctest_config_no_short_macro_names) and then define your aliases like this: ```#define CHECK_EQ DOCTEST_FAST_CHECK_EQ``` (example in [**here**](../../examples/all_features/alternative_macros.cpp) and [**here**](../../examples/all_features/doctest_proxy.h)).
+These 2 things can be considered negligible and totally worth it if you are dealing mainly with expressions unlikely to throw exceptions and all the tests usually pass (you don't need to navigate often to a failing assert with a debugger attached).
### Is doctest thread-aware?
diff --git a/doc/markdown/roadmap.md b/doc/markdown/roadmap.md
index 4099925..2ce50e6 100644
--- a/doc/markdown/roadmap.md
+++ b/doc/markdown/roadmap.md
@@ -7,7 +7,7 @@ This library is free, and will stay free but needs your support to sustain its d
Planned features for future releases - order changes constantly...
-### For 2.1:
+### For 2.3:
- finish the reporter system
- what is done:
@@ -31,7 +31,7 @@ Planned features for future releases - order changes constantly...
- documentation
- matchers - should investigate what they are - look at google test/mock and Catch (also predicates and boost test)
-### For 2.2:
+### For 2.4:
- header with extensions
- demangling with the use of the cxxabi header
@@ -61,7 +61,7 @@ Planned features for future releases - order changes constantly...
- https://www.jetbrains.com/clion/features/unit-testing.html
- https://blog.jetbrains.com/clion/2017/03/clion-2017-1-released/#catch
-### For 2.3:
+### For 2.5:
- log levels - like in [boost test](http://www.boost.org/doc/libs/1_63_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/log_level.html)
- running tests a [few times](https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#repeating-the-tests)
@@ -88,6 +88,7 @@ Planned features for future releases - order changes constantly...
- use modules - use ```std::string``` and whatever else comes from the standard - no more hand rolled traits and classes
- minimize the use of the preprocessor
+- remove backwards-compatible macros for the fast asserts
### Things that are being considered but not part of the roadmap yet:
@@ -143,7 +144,7 @@ Planned features for future releases - order changes constantly...
- http://preshing.com/20111124/always-use-a-lightweight-mutex/
- http://preshing.com/20120226/roll-your-own-lightweight-mutex/
- ability to provide a temp folder that is cleared between each test case
-- make the _MESSAGE assert macros work with variadic arguments - and maybe write the ones for binary/unary/fast asserts as well
+- make the _MESSAGE assert macros work with variadic arguments - and maybe write the ones for binary/unary asserts as well
- move from operator "<<" to "<=" for capturing the left operand when decomposing binary expressions with templates
- think about silencing warnings about unused variables when DOCTEST_CONFIG_DISABLE is used - see commit 6b61e8aa3818c5ea100cedc1bb48a60ea10df6e8 or issue #61
- also this: ```(void)(true ? (void)0 : ((void)(expression)))```
@@ -156,7 +157,6 @@ Planned features for future releases - order changes constantly...
### Things that are very unlikely to enter the roadmap:
- rethink static code analysis suppressions - users shouldn't have to use the same flags for code which uses doctest macros/types
-- think about removing the binary asserts (leaving only the fast binary asserts) because normal asserts + no try/catch in asserts are almost the same
- move the "react()" part (the one that throws for REQUIRE asserts - or for when "abort-after=<int>" is reached) to a function call in the while() part of the asserts
- stop using underscores for the begining of identifiers - the anonymous variables - against the standard...
- templated fixture test cases
diff --git a/doc/markdown/tutorial.md b/doc/markdown/tutorial.md
index 224cec0..f3856ed 100644
--- a/doc/markdown/tutorial.md
+++ b/doc/markdown/tutorial.md
@@ -72,7 +72,7 @@ Although this was a simple test it's been enough to demonstrate a few things abo
1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will respond to command line arguments. You can only use that ```#define``` in one source file for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "doctest.h"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN``` and ```#include "doctest.h"```. You can also provide your own implementation of main and drive **doctest** yourself - see [**supplying your own ```main()```**](main.md).
2. We introduce test cases with the ```TEST_CASE``` macro. It takes one argument - a free form test name (for more see [**Test cases and subcases**](testcases.md)). The test name doesn't have to be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [**command line**](commandline.md) docs for more information on running tests.
3. The name is just a string. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names.
-4. We write our individual test assertions using the ```CHECK()``` macro. Rather than a separate macro for each type of condition (equal, less than, greater than, etc.) we express the condition naturally using C++ syntax. Behind the scenes a simple expression template captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. There are other [**assertion macros**](assertions.md) not covered in this tutorial - but because of this technique the number of them is drastically reduced.
+4. We write our individual test assertions using the ```CHECK()``` macro. Rather than a separate macro for each type of condition (equal, less than, greater than, etc.) we express the condition naturally using C++ syntax. Behind the scenes a simple expression template captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. There are other [**assertion macros**](assertions.md) not covered in this tutorial - but because of this technique the number of them is drastically reduced.
## Test cases and subcases
diff --git a/doctest/doctest.h b/doctest/doctest.h
index 8087924..888ed84 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -526,9 +526,8 @@ namespace assertType {
is_throws_with = 2 * is_throws_as,
is_nothrow = 2 * is_throws_with,
- is_fast = 2 * is_nothrow, // not checked anywhere - used just to distinguish the types
- is_false = 2 * is_fast,
- is_unary = 2 * is_false,
+ is_false = 2 * is_nothrow,
+ is_unary = 2 * is_false, // not checked anywhere - used just to distinguish the types
is_eq = 2 * is_unary,
is_ne = 2 * is_eq,
@@ -596,37 +595,6 @@ namespace assertType {
DT_WARN_UNARY_FALSE = is_normal | is_false | is_unary | is_warn,
DT_CHECK_UNARY_FALSE = is_normal | is_false | is_unary | is_check,
DT_REQUIRE_UNARY_FALSE = is_normal | is_false | is_unary | is_require,
-
- DT_FAST_WARN_EQ = is_normal | is_fast | is_eq | is_warn,
- DT_FAST_CHECK_EQ = is_normal | is_fast | is_eq | is_check,
- DT_FAST_REQUIRE_EQ = is_normal | is_fast | is_eq | is_require,
- DT_FAST_WARN_NE = is_normal | is_fast | is_ne | is_warn,
- DT_FAST_CHECK_NE = is_normal | is_fast | is_ne | is_check,
- DT_FAST_REQUIRE_NE = is_normal | is_fast | is_ne | is_require,
-
- DT_FAST_WARN_GT = is_normal | is_fast | is_gt | is_warn,
- DT_FAST_CHECK_GT = is_normal | is_fast | is_gt | is_check,
- DT_FAST_REQUIRE_GT = is_normal | is_fast | is_gt | is_require,
-
- DT_FAST_WARN_LT = is_normal | is_fast | is_lt | is_warn,
- DT_FAST_CHECK_LT = is_normal | is_fast | is_lt | is_check,
- DT_FAST_REQUIRE_LT = is_normal | is_fast | is_lt | is_require,
-
- DT_FAST_WARN_GE = is_normal | is_fast | is_ge | is_warn,
- DT_FAST_CHECK_GE = is_normal | is_fast | is_ge | is_check,
- DT_FAST_REQUIRE_GE = is_normal | is_fast | is_ge | is_require,
-
- DT_FAST_WARN_LE = is_normal | is_fast | is_le | is_warn,
- DT_FAST_CHECK_LE = is_normal | is_fast | is_le | is_check,
- DT_FAST_REQUIRE_LE = is_normal | is_fast | is_le | is_require,
-
- DT_FAST_WARN_UNARY = is_normal | is_fast | is_unary | is_warn,
- DT_FAST_CHECK_UNARY = is_normal | is_fast | is_unary | is_check,
- DT_FAST_REQUIRE_UNARY = is_normal | is_fast | is_unary | is_require,
-
- DT_FAST_WARN_UNARY_FALSE = is_normal | is_fast | is_false | is_unary | is_warn,
- DT_FAST_CHECK_UNARY_FALSE = is_normal | is_fast | is_false | is_unary | is_check,
- DT_FAST_REQUIRE_UNARY_FALSE = is_normal | is_fast | is_false | is_unary | is_require
};
} // namespace assertType
@@ -1004,7 +972,7 @@ namespace detail {
};
DOCTEST_INTERFACE bool checkIfShouldThrow(assertType::Enum at);
- DOCTEST_INTERFACE void fastAssertThrowIfFlagSet(int flags);
+ DOCTEST_INTERFACE void throwException();
struct DOCTEST_INTERFACE Subcase
{
@@ -1357,24 +1325,12 @@ namespace detail {
};
} // namespace assertAction
-#ifdef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-#define DOCTEST_FAST_ASSERT_REACT \
- do { \
- if(res & assertAction::dbgbreak) \
- DOCTEST_BREAK_INTO_DEBUGGER(); \
- fastAssertThrowIfFlagSet(res); \
- } while(false)
-#define DOCTEST_FAST_ASSERT_RETURN(x) return
-#define DOCTEST_FAST_ASSERT_RETURN_TYPE void
-#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-#define DOCTEST_FAST_ASSERT_REACT return res
-#define DOCTEST_FAST_ASSERT_RETURN(x) return x
-#define DOCTEST_FAST_ASSERT_RETURN_TYPE int
-#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
DOCTEST_INTERFACE void failed_out_of_a_testing_context(const AssertData& ad);
-#define DOCTEST_FAST_ASSERT_OUT_OF_TESTS(decomp) \
+ DOCTEST_INTERFACE void decomp_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, Result result);
+
+#define DOCTEST_ASSERT_OUT_OF_TESTS(decomp) \
do { \
if(!is_running_in_test) { \
if(failed) { \
@@ -1382,46 +1338,42 @@ namespace detail {
rb.m_failed = failed; \
rb.m_decomp = decomp; \
failed_out_of_a_testing_context(rb); \
- int res = checkIfShouldThrow(at) ? assertAction::shouldthrow : 0; \
- res |= (isDebuggerActive() && !getContextOptions()->no_breaks) ? \
- assertAction::dbgbreak : \
- 0; \
- DOCTEST_FAST_ASSERT_REACT; \
+ if(isDebuggerActive() && !getContextOptions()->no_breaks) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
+ if(checkIfShouldThrow(at)) \
+ throwException(); \
} \
- DOCTEST_FAST_ASSERT_RETURN(0); \
+ return; \
} \
} while(false)
-#define DOCTEST_FAST_ASSERT_IN_TESTS(decomp) \
+#define DOCTEST_ASSERT_IN_TESTS(decomp) \
ResultBuilder rb(at, file, line, expr); \
rb.m_failed = failed; \
if(rb.m_failed || getContextOptions()->success) \
rb.m_decomp = decomp; \
- int res = rb.log() ? assertAction::dbgbreak : 0; \
+ if(rb.log()) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
if(rb.m_failed && checkIfShouldThrow(at)) \
- res |= assertAction::shouldthrow; \
- DOCTEST_FAST_ASSERT_REACT
+ throwException()
template <int comparison, typename L, typename R>
- DOCTEST_NOINLINE DOCTEST_FAST_ASSERT_RETURN_TYPE
- fast_binary_assert(assertType::Enum at, const char* file, int line, const char* expr,
- const DOCTEST_REF_WRAP(L) lhs, const DOCTEST_REF_WRAP(R) rhs) {
+ DOCTEST_NOINLINE void binary_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, const DOCTEST_REF_WRAP(L) lhs,
+ const DOCTEST_REF_WRAP(R) rhs) {
bool failed = !RelationalComparator<comparison, L, R>()(lhs, rhs);
// ###################################################################################
// IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
// THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
// ###################################################################################
- DOCTEST_FAST_ASSERT_OUT_OF_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
- DOCTEST_FAST_ASSERT_IN_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
+ DOCTEST_ASSERT_OUT_OF_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
+ DOCTEST_ASSERT_IN_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
}
template <typename L>
- DOCTEST_NOINLINE DOCTEST_FAST_ASSERT_RETURN_TYPE fast_unary_assert(assertType::Enum at,
- const char* file, int line,
- const char* expr,
- const DOCTEST_REF_WRAP(L)
- val) {
+ DOCTEST_NOINLINE void unary_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, const DOCTEST_REF_WRAP(L) val) {
bool failed = !val;
if(at & assertType::is_false) //!OCLINT bitwise operator in conditional
@@ -1431,8 +1383,8 @@ namespace detail {
// IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
// THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
// ###################################################################################
- DOCTEST_FAST_ASSERT_OUT_OF_TESTS(toString(val));
- DOCTEST_FAST_ASSERT_IN_TESTS(toString(val));
+ DOCTEST_ASSERT_OUT_OF_TESTS(toString(val));
+ DOCTEST_ASSERT_IN_TESTS(toString(val));
}
struct DOCTEST_INTERFACE IExceptionTranslator
@@ -2030,6 +1982,8 @@ constexpr T to_lvalue = x;
#define DOCTEST_TO_LVALUE(...) TO_LVALUE_CAN_BE_USED_ONLY_IN_CPP14_MODE_OR_WITH_VS_2017_OR_NEWER
#endif // TO_LVALUE
+#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_ASSERT_IMPLEMENT_2(assert_type, ...) \
DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Woverloaded-shift-op-parentheses") \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
@@ -2045,6 +1999,17 @@ constexpr T to_lvalue = x;
DOCTEST_ASSERT_IMPLEMENT_2(assert_type, __VA_ARGS__); \
} while((void)0, 0)
+#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_ASSERT_IMPLEMENT_1(assert_type, ...) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Woverloaded-shift-op-parentheses") \
+ doctest::detail::decomp_assert( \
+ doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, \
+ doctest::detail::ExpressionDecomposer(doctest::assertType::assert_type) \
+ << __VA_ARGS__) DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_WARN(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_WARN, __VA_ARGS__)
#define DOCTEST_CHECK(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_CHECK, __VA_ARGS__)
#define DOCTEST_REQUIRE(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_REQUIRE, __VA_ARGS__)
@@ -2144,6 +2109,8 @@ constexpr T to_lvalue = x;
#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_NOTHROW(expr); } while((void)0, 0)
// clang-format on
+#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_BINARY_ASSERT(assert_type, comp, ...) \
do { \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
@@ -2162,6 +2129,18 @@ constexpr T to_lvalue = x;
DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
} while((void)0, 0)
+#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_BINARY_ASSERT(assert_type, comparison, ...) \
+ doctest::detail::binary_assert<doctest::detail::binaryAssertComparison::comparison>( \
+ doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__)
+
+#define DOCTEST_UNARY_ASSERT(assert_type, ...) \
+ doctest::detail::unary_assert(doctest::assertType::assert_type, __FILE__, __LINE__, \
+ #__VA_ARGS__, __VA_ARGS__)
+
+#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_WARN_EQ(...) DOCTEST_BINARY_ASSERT(DT_WARN_EQ, eq, __VA_ARGS__)
#define DOCTEST_CHECK_EQ(...) DOCTEST_BINARY_ASSERT(DT_CHECK_EQ, eq, __VA_ARGS__)
#define DOCTEST_REQUIRE_EQ(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_EQ, eq, __VA_ARGS__)
@@ -2188,67 +2167,6 @@ constexpr T to_lvalue = x;
#define DOCTEST_CHECK_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_CHECK_UNARY_FALSE, __VA_ARGS__)
#define DOCTEST_REQUIRE_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_REQUIRE_UNARY_FALSE, __VA_ARGS__)
-#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
-#define DOCTEST_FAST_BINARY_ASSERT(assert_type, comparison, ...) \
- do { \
- int _DOCTEST_FAST_RES = doctest::detail::fast_binary_assert< \
- doctest::detail::binaryAssertComparison::comparison>( \
- doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__); \
- if(_DOCTEST_FAST_RES & doctest::detail::assertAction::dbgbreak) \
- DOCTEST_BREAK_INTO_DEBUGGER(); \
- doctest::detail::fastAssertThrowIfFlagSet(_DOCTEST_FAST_RES); \
- } while((void)0, 0)
-
-#define DOCTEST_FAST_UNARY_ASSERT(assert_type, ...) \
- do { \
- int _DOCTEST_FAST_RES = doctest::detail::fast_unary_assert( \
- doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__); \
- if(_DOCTEST_FAST_RES & doctest::detail::assertAction::dbgbreak) \
- DOCTEST_BREAK_INTO_DEBUGGER(); \
- doctest::detail::fastAssertThrowIfFlagSet(_DOCTEST_FAST_RES); \
- } while((void)0, 0)
-
-#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
-#define DOCTEST_FAST_BINARY_ASSERT(assert_type, comparison, ...) \
- doctest::detail::fast_binary_assert<doctest::detail::binaryAssertComparison::comparison>( \
- doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__)
-
-#define DOCTEST_FAST_UNARY_ASSERT(assert_type, ...) \
- doctest::detail::fast_unary_assert(doctest::assertType::assert_type, __FILE__, __LINE__, \
- #__VA_ARGS__, __VA_ARGS__)
-
-#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
-// clang-format off
-#define DOCTEST_FAST_WARN_EQ(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_EQ, eq, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_EQ(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_EQ, eq, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_EQ(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_EQ, eq, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_NE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_NE, ne, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_NE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_NE, ne, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_NE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_NE, ne, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_GT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_GT, gt, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_GT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_GT, gt, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_GT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_GT, gt, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_LT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_LT, lt, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_LT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_LT, lt, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_LT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_LT, lt, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_GE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_GE, ge, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_GE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_GE, ge, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_GE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_GE, ge, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_LE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_LE, le, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_LE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_LE, le, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_LE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_LE, le, __VA_ARGS__)
-
-#define DOCTEST_FAST_WARN_UNARY(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_WARN_UNARY, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_UNARY(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_CHECK_UNARY, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_UNARY(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_REQUIRE_UNARY, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_UNARY_FALSE(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_WARN_UNARY_FALSE, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_UNARY_FALSE(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_CHECK_UNARY_FALSE, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_UNARY_FALSE(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_REQUIRE_UNARY_FALSE, __VA_ARGS__)
-// clang-format on
-
#ifdef DOCTEST_CONFIG_NO_EXCEPTIONS
#undef DOCTEST_WARN_THROWS
@@ -2319,14 +2237,6 @@ constexpr T to_lvalue = x;
#undef DOCTEST_REQUIRE_LE
#undef DOCTEST_REQUIRE_UNARY
#undef DOCTEST_REQUIRE_UNARY_FALSE
-#undef DOCTEST_FAST_REQUIRE_EQ
-#undef DOCTEST_FAST_REQUIRE_NE
-#undef DOCTEST_FAST_REQUIRE_GT
-#undef DOCTEST_FAST_REQUIRE_LT
-#undef DOCTEST_FAST_REQUIRE_GE
-#undef DOCTEST_FAST_REQUIRE_LE
-#undef DOCTEST_FAST_REQUIRE_UNARY
-#undef DOCTEST_FAST_REQUIRE_UNARY_FALSE
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
@@ -2469,34 +2379,37 @@ constexpr T to_lvalue = x;
#define DOCTEST_CHECK_UNARY_FALSE(...) ((void)0)
#define DOCTEST_REQUIRE_UNARY_FALSE(...) ((void)0)
-#define DOCTEST_FAST_WARN_EQ(...) ((void)0)
-#define DOCTEST_FAST_CHECK_EQ(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_EQ(...) ((void)0)
-#define DOCTEST_FAST_WARN_NE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_NE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_NE(...) ((void)0)
-#define DOCTEST_FAST_WARN_GT(...) ((void)0)
-#define DOCTEST_FAST_CHECK_GT(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_GT(...) ((void)0)
-#define DOCTEST_FAST_WARN_LT(...) ((void)0)
-#define DOCTEST_FAST_CHECK_LT(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_LT(...) ((void)0)
-#define DOCTEST_FAST_WARN_GE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_GE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_GE(...) ((void)0)
-#define DOCTEST_FAST_WARN_LE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_LE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_LE(...) ((void)0)
-
-#define DOCTEST_FAST_WARN_UNARY(...) ((void)0)
-#define DOCTEST_FAST_CHECK_UNARY(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_UNARY(...) ((void)0)
-#define DOCTEST_FAST_WARN_UNARY_FALSE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_UNARY_FALSE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_UNARY_FALSE(...) ((void)0)
-
#endif // DOCTEST_CONFIG_DISABLE
+// clang-format off
+// KEPT FOR BACKWARDS COMPATIBILITY - FORWARDING TO THE RIGHT MACROS
+#define DOCTEST_FAST_WARN_EQ DOCTEST_WARN_EQ
+#define DOCTEST_FAST_CHECK_EQ DOCTEST_CHECK_EQ
+#define DOCTEST_FAST_REQUIRE_EQ DOCTEST_REQUIRE_EQ
+#define DOCTEST_FAST_WARN_NE DOCTEST_WARN_NE
+#define DOCTEST_FAST_CHECK_NE DOCTEST_CHECK_NE
+#define DOCTEST_FAST_REQUIRE_NE DOCTEST_REQUIRE_NE
+#define DOCTEST_FAST_WARN_GT DOCTEST_WARN_GT
+#define DOCTEST_FAST_CHECK_GT DOCTEST_CHECK_GT
+#define DOCTEST_FAST_REQUIRE_GT DOCTEST_REQUIRE_GT
+#define DOCTEST_FAST_WARN_LT DOCTEST_WARN_LT
+#define DOCTEST_FAST_CHECK_LT DOCTEST_CHECK_LT
+#define DOCTEST_FAST_REQUIRE_LT DOCTEST_REQUIRE_LT
+#define DOCTEST_FAST_WARN_GE DOCTEST_WARN_GE
+#define DOCTEST_FAST_CHECK_GE DOCTEST_CHECK_GE
+#define DOCTEST_FAST_REQUIRE_GE DOCTEST_REQUIRE_GE
+#define DOCTEST_FAST_WARN_LE DOCTEST_WARN_LE
+#define DOCTEST_FAST_CHECK_LE DOCTEST_CHECK_LE
+#define DOCTEST_FAST_REQUIRE_LE DOCTEST_REQUIRE_LE
+
+#define DOCTEST_FAST_WARN_UNARY DOCTEST_WARN_UNARY
+#define DOCTEST_FAST_CHECK_UNARY DOCTEST_CHECK_UNARY
+#define DOCTEST_FAST_REQUIRE_UNARY DOCTEST_REQUIRE_UNARY
+#define DOCTEST_FAST_WARN_UNARY_FALSE DOCTEST_WARN_UNARY_FALSE
+#define DOCTEST_FAST_CHECK_UNARY_FALSE DOCTEST_CHECK_UNARY_FALSE
+#define DOCTEST_FAST_REQUIRE_UNARY_FALSE DOCTEST_REQUIRE_UNARY_FALSE
+// clang-format on
+
// BDD style macros
// clang-format off
#define DOCTEST_SCENARIO(name) DOCTEST_TEST_CASE(" Scenario: " name)
@@ -2607,6 +2520,7 @@ constexpr T to_lvalue = x;
#define CHECK_UNARY_FALSE DOCTEST_CHECK_UNARY_FALSE
#define REQUIRE_UNARY_FALSE DOCTEST_REQUIRE_UNARY_FALSE
+// KEPT FOR BACKWARDS COMPATIBILITY
#define FAST_WARN_EQ DOCTEST_FAST_WARN_EQ
#define FAST_CHECK_EQ DOCTEST_FAST_CHECK_EQ
#define FAST_REQUIRE_EQ DOCTEST_FAST_REQUIRE_EQ
@@ -3158,32 +3072,6 @@ const char* assertString(assertType::Enum at) {
case assertType::DT_WARN_UNARY_FALSE : return "WARN_UNARY_FALSE";
case assertType::DT_CHECK_UNARY_FALSE : return "CHECK_UNARY_FALSE";
case assertType::DT_REQUIRE_UNARY_FALSE : return "REQUIRE_UNARY_FALSE";
-
- case assertType::DT_FAST_WARN_EQ : return "FAST_WARN_EQ";
- case assertType::DT_FAST_CHECK_EQ : return "FAST_CHECK_EQ";
- case assertType::DT_FAST_REQUIRE_EQ : return "FAST_REQUIRE_EQ";
- case assertType::DT_FAST_WARN_NE : return "FAST_WARN_NE";
- case assertType::DT_FAST_CHECK_NE : return "FAST_CHECK_NE";
- case assertType::DT_FAST_REQUIRE_NE : return "FAST_REQUIRE_NE";
- case assertType::DT_FAST_WARN_GT : return "FAST_WARN_GT";
- case assertType::DT_FAST_CHECK_GT : return "FAST_CHECK_GT";
- case assertType::DT_FAST_REQUIRE_GT : return "FAST_REQUIRE_GT";
- case assertType::DT_FAST_WARN_LT : return "FAST_WARN_LT";
- case assertType::DT_FAST_CHECK_LT : return "FAST_CHECK_LT";
- case assertType::DT_FAST_REQUIRE_LT : return "FAST_REQUIRE_LT";
- case assertType::DT_FAST_WARN_GE : return "FAST_WARN_GE";
- case assertType::DT_FAST_CHECK_GE : return "FAST_CHECK_GE";
- case assertType::DT_FAST_REQUIRE_GE : return "FAST_REQUIRE_GE";
- case assertType::DT_FAST_WARN_LE : return "FAST_WARN_LE";
- case assertType::DT_FAST_CHECK_LE : return "FAST_CHECK_LE";
- case assertType::DT_FAST_REQUIRE_LE : return "FAST_REQUIRE_LE";
-
- case assertType::DT_FAST_WARN_UNARY : return "FAST_WARN_UNARY";
- case assertType::DT_FAST_CHECK_UNARY : return "FAST_CHECK_UNARY";
- case assertType::DT_FAST_REQUIRE_UNARY : return "FAST_REQUIRE_UNARY";
- case assertType::DT_FAST_WARN_UNARY_FALSE : return "FAST_WARN_UNARY_FALSE";
- case assertType::DT_FAST_CHECK_UNARY_FALSE : return "FAST_CHECK_UNARY_FALSE";
- case assertType::DT_FAST_REQUIRE_UNARY_FALSE: return "FAST_REQUIRE_UNARY_FALSE";
}
DOCTEST_MSVC_SUPPRESS_WARNING_POP
return "";
@@ -3425,12 +3313,6 @@ namespace {
static reporterMap data;
return data;
}
-
- void throwException() {
-#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
- throw TestFailureException();
-#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
- }
} // namespace
namespace detail {
#define DOCTEST_ITERATE_THROUGH_REPORTERS(function, ...) \
@@ -3452,9 +3334,10 @@ namespace detail {
return false;
}
- void fastAssertThrowIfFlagSet(int flags) {
- if(flags & assertAction::shouldthrow) //!OCLINT bitwise operator in conditional
- throwException();
+ void throwException() {
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ throw TestFailureException();
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
}
} // namespace detail
@@ -4259,6 +4142,18 @@ namespace detail {
std::abort();
}
+ void decomp_assert(assertType::Enum at, const char* file, int line, const char* expr,
+ Result result) {
+ bool failed = !result.m_passed;
+
+ // ###################################################################################
+ // IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
+ // THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
+ // ###################################################################################
+ DOCTEST_ASSERT_OUT_OF_TESTS(result.m_decomp);
+ DOCTEST_ASSERT_IN_TESTS(result.m_decomp);
+ }
+
MessageBuilder::MessageBuilder(const char* file, int line, assertType::Enum severity) {
m_stream = getTlsOss();
m_file = file;
diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
index 9dddb9c..2a8be99 100644
--- a/doctest/parts/doctest_fwd.h
+++ b/doctest/parts/doctest_fwd.h
@@ -523,9 +523,8 @@ namespace assertType {
is_throws_with = 2 * is_throws_as,
is_nothrow = 2 * is_throws_with,
- is_fast = 2 * is_nothrow, // not checked anywhere - used just to distinguish the types
- is_false = 2 * is_fast,
- is_unary = 2 * is_false,
+ is_false = 2 * is_nothrow,
+ is_unary = 2 * is_false, // not checked anywhere - used just to distinguish the types
is_eq = 2 * is_unary,
is_ne = 2 * is_eq,
@@ -593,37 +592,6 @@ namespace assertType {
DT_WARN_UNARY_FALSE = is_normal | is_false | is_unary | is_warn,
DT_CHECK_UNARY_FALSE = is_normal | is_false | is_unary | is_check,
DT_REQUIRE_UNARY_FALSE = is_normal | is_false | is_unary | is_require,
-
- DT_FAST_WARN_EQ = is_normal | is_fast | is_eq | is_warn,
- DT_FAST_CHECK_EQ = is_normal | is_fast | is_eq | is_check,
- DT_FAST_REQUIRE_EQ = is_normal | is_fast | is_eq | is_require,
- DT_FAST_WARN_NE = is_normal | is_fast | is_ne | is_warn,
- DT_FAST_CHECK_NE = is_normal | is_fast | is_ne | is_check,
- DT_FAST_REQUIRE_NE = is_normal | is_fast | is_ne | is_require,
-
- DT_FAST_WARN_GT = is_normal | is_fast | is_gt | is_warn,
- DT_FAST_CHECK_GT = is_normal | is_fast | is_gt | is_check,
- DT_FAST_REQUIRE_GT = is_normal | is_fast | is_gt | is_require,
-
- DT_FAST_WARN_LT = is_normal | is_fast | is_lt | is_warn,
- DT_FAST_CHECK_LT = is_normal | is_fast | is_lt | is_check,
- DT_FAST_REQUIRE_LT = is_normal | is_fast | is_lt | is_require,
-
- DT_FAST_WARN_GE = is_normal | is_fast | is_ge | is_warn,
- DT_FAST_CHECK_GE = is_normal | is_fast | is_ge | is_check,
- DT_FAST_REQUIRE_GE = is_normal | is_fast | is_ge | is_require,
-
- DT_FAST_WARN_LE = is_normal | is_fast | is_le | is_warn,
- DT_FAST_CHECK_LE = is_normal | is_fast | is_le | is_check,
- DT_FAST_REQUIRE_LE = is_normal | is_fast | is_le | is_require,
-
- DT_FAST_WARN_UNARY = is_normal | is_fast | is_unary | is_warn,
- DT_FAST_CHECK_UNARY = is_normal | is_fast | is_unary | is_check,
- DT_FAST_REQUIRE_UNARY = is_normal | is_fast | is_unary | is_require,
-
- DT_FAST_WARN_UNARY_FALSE = is_normal | is_fast | is_false | is_unary | is_warn,
- DT_FAST_CHECK_UNARY_FALSE = is_normal | is_fast | is_false | is_unary | is_check,
- DT_FAST_REQUIRE_UNARY_FALSE = is_normal | is_fast | is_false | is_unary | is_require
};
} // namespace assertType
@@ -1001,7 +969,7 @@ namespace detail {
};
DOCTEST_INTERFACE bool checkIfShouldThrow(assertType::Enum at);
- DOCTEST_INTERFACE void fastAssertThrowIfFlagSet(int flags);
+ DOCTEST_INTERFACE void throwException();
struct DOCTEST_INTERFACE Subcase
{
@@ -1354,24 +1322,12 @@ namespace detail {
};
} // namespace assertAction
-#ifdef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-#define DOCTEST_FAST_ASSERT_REACT \
- do { \
- if(res & assertAction::dbgbreak) \
- DOCTEST_BREAK_INTO_DEBUGGER(); \
- fastAssertThrowIfFlagSet(res); \
- } while(false)
-#define DOCTEST_FAST_ASSERT_RETURN(x) return
-#define DOCTEST_FAST_ASSERT_RETURN_TYPE void
-#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-#define DOCTEST_FAST_ASSERT_REACT return res
-#define DOCTEST_FAST_ASSERT_RETURN(x) return x
-#define DOCTEST_FAST_ASSERT_RETURN_TYPE int
-#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
DOCTEST_INTERFACE void failed_out_of_a_testing_context(const AssertData& ad);
-#define DOCTEST_FAST_ASSERT_OUT_OF_TESTS(decomp) \
+ DOCTEST_INTERFACE void decomp_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, Result result);
+
+#define DOCTEST_ASSERT_OUT_OF_TESTS(decomp) \
do { \
if(!is_running_in_test) { \
if(failed) { \
@@ -1379,46 +1335,42 @@ namespace detail {
rb.m_failed = failed; \
rb.m_decomp = decomp; \
failed_out_of_a_testing_context(rb); \
- int res = checkIfShouldThrow(at) ? assertAction::shouldthrow : 0; \
- res |= (isDebuggerActive() && !getContextOptions()->no_breaks) ? \
- assertAction::dbgbreak : \
- 0; \
- DOCTEST_FAST_ASSERT_REACT; \
+ if(isDebuggerActive() && !getContextOptions()->no_breaks) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
+ if(checkIfShouldThrow(at)) \
+ throwException(); \
} \
- DOCTEST_FAST_ASSERT_RETURN(0); \
+ return; \
} \
} while(false)
-#define DOCTEST_FAST_ASSERT_IN_TESTS(decomp) \
+#define DOCTEST_ASSERT_IN_TESTS(decomp) \
ResultBuilder rb(at, file, line, expr); \
rb.m_failed = failed; \
if(rb.m_failed || getContextOptions()->success) \
rb.m_decomp = decomp; \
- int res = rb.log() ? assertAction::dbgbreak : 0; \
+ if(rb.log()) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
if(rb.m_failed && checkIfShouldThrow(at)) \
- res |= assertAction::shouldthrow; \
- DOCTEST_FAST_ASSERT_REACT
+ throwException()
template <int comparison, typename L, typename R>
- DOCTEST_NOINLINE DOCTEST_FAST_ASSERT_RETURN_TYPE
- fast_binary_assert(assertType::Enum at, const char* file, int line, const char* expr,
- const DOCTEST_REF_WRAP(L) lhs, const DOCTEST_REF_WRAP(R) rhs) {
+ DOCTEST_NOINLINE void binary_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, const DOCTEST_REF_WRAP(L) lhs,
+ const DOCTEST_REF_WRAP(R) rhs) {
bool failed = !RelationalComparator<comparison, L, R>()(lhs, rhs);
// ###################################################################################
// IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
// THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
// ###################################################################################
- DOCTEST_FAST_ASSERT_OUT_OF_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
- DOCTEST_FAST_ASSERT_IN_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
+ DOCTEST_ASSERT_OUT_OF_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
+ DOCTEST_ASSERT_IN_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
}
template <typename L>
- DOCTEST_NOINLINE DOCTEST_FAST_ASSERT_RETURN_TYPE fast_unary_assert(assertType::Enum at,
- const char* file, int line,
- const char* expr,
- const DOCTEST_REF_WRAP(L)
- val) {
+ DOCTEST_NOINLINE void unary_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, const DOCTEST_REF_WRAP(L) val) {
bool failed = !val;
if(at & assertType::is_false) //!OCLINT bitwise operator in conditional
@@ -1428,8 +1380,8 @@ namespace detail {
// IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
// THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
// ###################################################################################
- DOCTEST_FAST_ASSERT_OUT_OF_TESTS(toString(val));
- DOCTEST_FAST_ASSERT_IN_TESTS(toString(val));
+ DOCTEST_ASSERT_OUT_OF_TESTS(toString(val));
+ DOCTEST_ASSERT_IN_TESTS(toString(val));
}
struct DOCTEST_INTERFACE IExceptionTranslator
@@ -2027,6 +1979,8 @@ constexpr T to_lvalue = x;
#define DOCTEST_TO_LVALUE(...) TO_LVALUE_CAN_BE_USED_ONLY_IN_CPP14_MODE_OR_WITH_VS_2017_OR_NEWER
#endif // TO_LVALUE
+#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_ASSERT_IMPLEMENT_2(assert_type, ...) \
DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Woverloaded-shift-op-parentheses") \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
@@ -2042,6 +1996,17 @@ constexpr T to_lvalue = x;
DOCTEST_ASSERT_IMPLEMENT_2(assert_type, __VA_ARGS__); \
} while((void)0, 0)
+#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_ASSERT_IMPLEMENT_1(assert_type, ...) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Woverloaded-shift-op-parentheses") \
+ doctest::detail::decomp_assert( \
+ doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, \
+ doctest::detail::ExpressionDecomposer(doctest::assertType::assert_type) \
+ << __VA_ARGS__) DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_WARN(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_WARN, __VA_ARGS__)
#define DOCTEST_CHECK(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_CHECK, __VA_ARGS__)
#define DOCTEST_REQUIRE(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_REQUIRE, __VA_ARGS__)
@@ -2141,6 +2106,8 @@ constexpr T to_lvalue = x;
#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_NOTHROW(expr); } while((void)0, 0)
// clang-format on
+#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_BINARY_ASSERT(assert_type, comp, ...) \
do { \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
@@ -2159,6 +2126,18 @@ constexpr T to_lvalue = x;
DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
} while((void)0, 0)
+#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_BINARY_ASSERT(assert_type, comparison, ...) \
+ doctest::detail::binary_assert<doctest::detail::binaryAssertComparison::comparison>( \
+ doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__)
+
+#define DOCTEST_UNARY_ASSERT(assert_type, ...) \
+ doctest::detail::unary_assert(doctest::assertType::assert_type, __FILE__, __LINE__, \
+ #__VA_ARGS__, __VA_ARGS__)
+
+#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
#define DOCTEST_WARN_EQ(...) DOCTEST_BINARY_ASSERT(DT_WARN_EQ, eq, __VA_ARGS__)
#define DOCTEST_CHECK_EQ(...) DOCTEST_BINARY_ASSERT(DT_CHECK_EQ, eq, __VA_ARGS__)
#define DOCTEST_REQUIRE_EQ(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_EQ, eq, __VA_ARGS__)
@@ -2185,67 +2164,6 @@ constexpr T to_lvalue = x;
#define DOCTEST_CHECK_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_CHECK_UNARY_FALSE, __VA_ARGS__)
#define DOCTEST_REQUIRE_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_REQUIRE_UNARY_FALSE, __VA_ARGS__)
-#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
-#define DOCTEST_FAST_BINARY_ASSERT(assert_type, comparison, ...) \
- do { \
- int _DOCTEST_FAST_RES = doctest::detail::fast_binary_assert< \
- doctest::detail::binaryAssertComparison::comparison>( \
- doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__); \
- if(_DOCTEST_FAST_RES & doctest::detail::assertAction::dbgbreak) \
- DOCTEST_BREAK_INTO_DEBUGGER(); \
- doctest::detail::fastAssertThrowIfFlagSet(_DOCTEST_FAST_RES); \
- } while((void)0, 0)
-
-#define DOCTEST_FAST_UNARY_ASSERT(assert_type, ...) \
- do { \
- int _DOCTEST_FAST_RES = doctest::detail::fast_unary_assert( \
- doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__); \
- if(_DOCTEST_FAST_RES & doctest::detail::assertAction::dbgbreak) \
- DOCTEST_BREAK_INTO_DEBUGGER(); \
- doctest::detail::fastAssertThrowIfFlagSet(_DOCTEST_FAST_RES); \
- } while((void)0, 0)
-
-#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
-#define DOCTEST_FAST_BINARY_ASSERT(assert_type, comparison, ...) \
- doctest::detail::fast_binary_assert<doctest::detail::binaryAssertComparison::comparison>( \
- doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__)
-
-#define DOCTEST_FAST_UNARY_ASSERT(assert_type, ...) \
- doctest::detail::fast_unary_assert(doctest::assertType::assert_type, __FILE__, __LINE__, \
- #__VA_ARGS__, __VA_ARGS__)
-
-#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
-
-// clang-format off
-#define DOCTEST_FAST_WARN_EQ(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_EQ, eq, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_EQ(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_EQ, eq, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_EQ(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_EQ, eq, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_NE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_NE, ne, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_NE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_NE, ne, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_NE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_NE, ne, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_GT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_GT, gt, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_GT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_GT, gt, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_GT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_GT, gt, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_LT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_LT, lt, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_LT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_LT, lt, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_LT(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_LT, lt, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_GE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_GE, ge, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_GE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_GE, ge, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_GE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_GE, ge, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_LE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_WARN_LE, le, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_LE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_CHECK_LE, le, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_LE(...) DOCTEST_FAST_BINARY_ASSERT(DT_FAST_REQUIRE_LE, le, __VA_ARGS__)
-
-#define DOCTEST_FAST_WARN_UNARY(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_WARN_UNARY, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_UNARY(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_CHECK_UNARY, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_UNARY(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_REQUIRE_UNARY, __VA_ARGS__)
-#define DOCTEST_FAST_WARN_UNARY_FALSE(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_WARN_UNARY_FALSE, __VA_ARGS__)
-#define DOCTEST_FAST_CHECK_UNARY_FALSE(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_CHECK_UNARY_FALSE, __VA_ARGS__)
-#define DOCTEST_FAST_REQUIRE_UNARY_FALSE(...) DOCTEST_FAST_UNARY_ASSERT(DT_FAST_REQUIRE_UNARY_FALSE, __VA_ARGS__)
-// clang-format on
-
#ifdef DOCTEST_CONFIG_NO_EXCEPTIONS
#undef DOCTEST_WARN_THROWS
@@ -2316,14 +2234,6 @@ constexpr T to_lvalue = x;
#undef DOCTEST_REQUIRE_LE
#undef DOCTEST_REQUIRE_UNARY
#undef DOCTEST_REQUIRE_UNARY_FALSE
-#undef DOCTEST_FAST_REQUIRE_EQ
-#undef DOCTEST_FAST_REQUIRE_NE
-#undef DOCTEST_FAST_REQUIRE_GT
-#undef DOCTEST_FAST_REQUIRE_LT
-#undef DOCTEST_FAST_REQUIRE_GE
-#undef DOCTEST_FAST_REQUIRE_LE
-#undef DOCTEST_FAST_REQUIRE_UNARY
-#undef DOCTEST_FAST_REQUIRE_UNARY_FALSE
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
@@ -2466,34 +2376,37 @@ constexpr T to_lvalue = x;
#define DOCTEST_CHECK_UNARY_FALSE(...) ((void)0)
#define DOCTEST_REQUIRE_UNARY_FALSE(...) ((void)0)
-#define DOCTEST_FAST_WARN_EQ(...) ((void)0)
-#define DOCTEST_FAST_CHECK_EQ(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_EQ(...) ((void)0)
-#define DOCTEST_FAST_WARN_NE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_NE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_NE(...) ((void)0)
-#define DOCTEST_FAST_WARN_GT(...) ((void)0)
-#define DOCTEST_FAST_CHECK_GT(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_GT(...) ((void)0)
-#define DOCTEST_FAST_WARN_LT(...) ((void)0)
-#define DOCTEST_FAST_CHECK_LT(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_LT(...) ((void)0)
-#define DOCTEST_FAST_WARN_GE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_GE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_GE(...) ((void)0)
-#define DOCTEST_FAST_WARN_LE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_LE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_LE(...) ((void)0)
-
-#define DOCTEST_FAST_WARN_UNARY(...) ((void)0)
-#define DOCTEST_FAST_CHECK_UNARY(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_UNARY(...) ((void)0)
-#define DOCTEST_FAST_WARN_UNARY_FALSE(...) ((void)0)
-#define DOCTEST_FAST_CHECK_UNARY_FALSE(...) ((void)0)
-#define DOCTEST_FAST_REQUIRE_UNARY_FALSE(...) ((void)0)
-
#endif // DOCTEST_CONFIG_DISABLE
+// clang-format off
+// KEPT FOR BACKWARDS COMPATIBILITY - FORWARDING TO THE RIGHT MACROS
+#define DOCTEST_FAST_WARN_EQ DOCTEST_WARN_EQ
+#define DOCTEST_FAST_CHECK_EQ DOCTEST_CHECK_EQ
+#define DOCTEST_FAST_REQUIRE_EQ DOCTEST_REQUIRE_EQ
+#define DOCTEST_FAST_WARN_NE DOCTEST_WARN_NE
+#define DOCTEST_FAST_CHECK_NE DOCTEST_CHECK_NE
+#define DOCTEST_FAST_REQUIRE_NE DOCTEST_REQUIRE_NE
+#define DOCTEST_FAST_WARN_GT DOCTEST_WARN_GT
+#define DOCTEST_FAST_CHECK_GT DOCTEST_CHECK_GT
+#define DOCTEST_FAST_REQUIRE_GT DOCTEST_REQUIRE_GT
+#define DOCTEST_FAST_WARN_LT DOCTEST_WARN_LT
+#define DOCTEST_FAST_CHECK_LT DOCTEST_CHECK_LT
+#define DOCTEST_FAST_REQUIRE_LT DOCTEST_REQUIRE_LT
+#define DOCTEST_FAST_WARN_GE DOCTEST_WARN_GE
+#define DOCTEST_FAST_CHECK_GE DOCTEST_CHECK_GE
+#define DOCTEST_FAST_REQUIRE_GE DOCTEST_REQUIRE_GE
+#define DOCTEST_FAST_WARN_LE DOCTEST_WARN_LE
+#define DOCTEST_FAST_CHECK_LE DOCTEST_CHECK_LE
+#define DOCTEST_FAST_REQUIRE_LE DOCTEST_REQUIRE_LE
+
+#define DOCTEST_FAST_WARN_UNARY DOCTEST_WARN_UNARY
+#define DOCTEST_FAST_CHECK_UNARY DOCTEST_CHECK_UNARY
+#define DOCTEST_FAST_REQUIRE_UNARY DOCTEST_REQUIRE_UNARY
+#define DOCTEST_FAST_WARN_UNARY_FALSE DOCTEST_WARN_UNARY_FALSE
+#define DOCTEST_FAST_CHECK_UNARY_FALSE DOCTEST_CHECK_UNARY_FALSE
+#define DOCTEST_FAST_REQUIRE_UNARY_FALSE DOCTEST_REQUIRE_UNARY_FALSE
+// clang-format on
+
// BDD style macros
// clang-format off
#define DOCTEST_SCENARIO(name) DOCTEST_TEST_CASE(" Scenario: " name)
@@ -2604,6 +2517,7 @@ constexpr T to_lvalue = x;
#define CHECK_UNARY_FALSE DOCTEST_CHECK_UNARY_FALSE
#define REQUIRE_UNARY_FALSE DOCTEST_REQUIRE_UNARY_FALSE
+// KEPT FOR BACKWARDS COMPATIBILITY
#define FAST_WARN_EQ DOCTEST_FAST_WARN_EQ
#define FAST_CHECK_EQ DOCTEST_FAST_CHECK_EQ
#define FAST_REQUIRE_EQ DOCTEST_FAST_REQUIRE_EQ
diff --git a/doctest/parts/doctest_impl.h b/doctest/parts/doctest_impl.h
index aa1e2f2..327adb2 100644
--- a/doctest/parts/doctest_impl.h
+++ b/doctest/parts/doctest_impl.h
@@ -485,32 +485,6 @@ const char* assertString(assertType::Enum at) {
case assertType::DT_WARN_UNARY_FALSE : return "WARN_UNARY_FALSE";
case assertType::DT_CHECK_UNARY_FALSE : return "CHECK_UNARY_FALSE";
case assertType::DT_REQUIRE_UNARY_FALSE : return "REQUIRE_UNARY_FALSE";
-
- case assertType::DT_FAST_WARN_EQ : return "FAST_WARN_EQ";
- case assertType::DT_FAST_CHECK_EQ : return "FAST_CHECK_EQ";
- case assertType::DT_FAST_REQUIRE_EQ : return "FAST_REQUIRE_EQ";
- case assertType::DT_FAST_WARN_NE : return "FAST_WARN_NE";
- case assertType::DT_FAST_CHECK_NE : return "FAST_CHECK_NE";
- case assertType::DT_FAST_REQUIRE_NE : return "FAST_REQUIRE_NE";
- case assertType::DT_FAST_WARN_GT : return "FAST_WARN_GT";
- case assertType::DT_FAST_CHECK_GT : return "FAST_CHECK_GT";
- case assertType::DT_FAST_REQUIRE_GT : return "FAST_REQUIRE_GT";
- case assertType::DT_FAST_WARN_LT : return "FAST_WARN_LT";
- case assertType::DT_FAST_CHECK_LT : return "FAST_CHECK_LT";
- case assertType::DT_FAST_REQUIRE_LT : return "FAST_REQUIRE_LT";
- case assertType::DT_FAST_WARN_GE : return "FAST_WARN_GE";
- case assertType::DT_FAST_CHECK_GE : return "FAST_CHECK_GE";
- case assertType::DT_FAST_REQUIRE_GE : return "FAST_REQUIRE_GE";
- case assertType::DT_FAST_WARN_LE : return "FAST_WARN_LE";
- case assertType::DT_FAST_CHECK_LE : return "FAST_CHECK_LE";
- case assertType::DT_FAST_REQUIRE_LE : return "FAST_REQUIRE_LE";
-
- case assertType::DT_FAST_WARN_UNARY : return "FAST_WARN_UNARY";
- case assertType::DT_FAST_CHECK_UNARY : return "FAST_CHECK_UNARY";
- case assertType::DT_FAST_REQUIRE_UNARY : return "FAST_REQUIRE_UNARY";
- case assertType::DT_FAST_WARN_UNARY_FALSE : return "FAST_WARN_UNARY_FALSE";
- case assertType::DT_FAST_CHECK_UNARY_FALSE : return "FAST_CHECK_UNARY_FALSE";
- case assertType::DT_FAST_REQUIRE_UNARY_FALSE: return "FAST_REQUIRE_UNARY_FALSE";
}
DOCTEST_MSVC_SUPPRESS_WARNING_POP
return "";
@@ -752,12 +726,6 @@ namespace {
static reporterMap data;
return data;
}
-
- void throwException() {
-#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
- throw TestFailureException();
-#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
- }
} // namespace
namespace detail {
#define DOCTEST_ITERATE_THROUGH_REPORTERS(function, ...) \
@@ -779,9 +747,10 @@ namespace detail {
return false;
}
- void fastAssertThrowIfFlagSet(int flags) {
- if(flags & assertAction::shouldthrow) //!OCLINT bitwise operator in conditional
- throwException();
+ void throwException() {
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ throw TestFailureException();
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
}
} // namespace detail
@@ -1586,6 +1555,18 @@ namespace detail {
std::abort();
}
+ void decomp_assert(assertType::Enum at, const char* file, int line, const char* expr,
+ Result result) {
+ bool failed = !result.m_passed;
+
+ // ###################################################################################
+ // IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
+ // THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
+ // ###################################################################################
+ DOCTEST_ASSERT_OUT_OF_TESTS(result.m_decomp);
+ DOCTEST_ASSERT_IN_TESTS(result.m_decomp);
+ }
+
MessageBuilder::MessageBuilder(const char* file, int line, assertType::Enum severity) {
m_stream = getTlsOss();
m_file = file;
diff --git a/examples/all_features/alternative_macros.cpp b/examples/all_features/alternative_macros.cpp
index fd877cc..570db7a 100644
--- a/examples/all_features/alternative_macros.cpp
+++ b/examples/all_features/alternative_macros.cpp
@@ -3,7 +3,7 @@
my_testcase("custom macros") {
my_check(1 == 1);
- my_fast_check_eq(1, 1);
+ my_check_eq(1, 1);
my_subcase("bar") {
my_subcase("foo") {}
diff --git a/examples/all_features/assertion_macros.cpp b/examples/all_features/assertion_macros.cpp
index d445cb0..2af257f 100644
--- a/examples/all_features/assertion_macros.cpp
+++ b/examples/all_features/assertion_macros.cpp
@@ -18,8 +18,6 @@ TEST_CASE("normal macros") {
CHECK_EQ(a, b);
- FAST_CHECK_EQ(a, b);
-
CHECK(doctest::Approx(0.1000001) == 0.1000002);
CHECK(doctest::Approx(0.502) == 0.501);
}
@@ -65,14 +63,10 @@ TEST_CASE("WARN level of asserts don't fail the test case") {
WARN_THROWS_AS(throw_if(false, 0), bool);
WARN_THROWS_AS(throw_if(true, 0), bool);
WARN_NOTHROW(throw_if(true, 0));
-
+
WARN_EQ(1, 0);
WARN_UNARY(0);
WARN_UNARY_FALSE(1);
-
- FAST_WARN_EQ(1, 0);
- FAST_WARN_UNARY(0);
- FAST_WARN_UNARY_FALSE(1);
}
TEST_CASE("CHECK level of asserts fail the test case but don't abort it") {
@@ -83,14 +77,10 @@ TEST_CASE("CHECK level of asserts fail the test case but don't abort it") {
CHECK_THROWS_AS(throw_if(true, 0), bool);
CHECK_THROWS_WITH(throw_if(true, 0), "unrecognized");
CHECK_NOTHROW(throw_if(true, 0));
-
+
CHECK_EQ(1, 0);
CHECK_UNARY(0);
CHECK_UNARY_FALSE(1);
-
- FAST_CHECK_EQ(1, 0);
- FAST_CHECK_UNARY(0);
- FAST_CHECK_UNARY_FALSE(1);
MESSAGE("reached!");
}
@@ -131,18 +121,6 @@ TEST_CASE("REQUIRE level of asserts fail and abort the test case - 9") {
REQUIRE_UNARY_FALSE(1);
MESSAGE("should not be reached!");
}
-TEST_CASE("REQUIRE level of asserts fail and abort the test case - 10") {
- FAST_REQUIRE_EQ(1, 0);
- MESSAGE("should not be reached!");
-}
-TEST_CASE("REQUIRE level of asserts fail and abort the test case - 11") {
- FAST_REQUIRE_UNARY(0);
- MESSAGE("should not be reached!");
-}
-TEST_CASE("REQUIRE level of asserts fail and abort the test case - 12") {
- FAST_REQUIRE_UNARY_FALSE(1);
- MESSAGE("should not be reached!");
-}
TEST_CASE("all binary assertions") {
WARN_EQ(1, 1);
@@ -169,30 +147,6 @@ TEST_CASE("all binary assertions") {
WARN_UNARY_FALSE(0);
CHECK_UNARY_FALSE(0);
REQUIRE_UNARY_FALSE(0);
- FAST_WARN_EQ(1, 1);
- FAST_CHECK_EQ(1, 1);
- FAST_REQUIRE_EQ(1, 1);
- FAST_WARN_NE(1, 0);
- FAST_CHECK_NE(1, 0);
- FAST_REQUIRE_NE(1, 0);
- FAST_WARN_GT(1, 0);
- FAST_CHECK_GT(1, 0);
- FAST_REQUIRE_GT(1, 0);
- FAST_WARN_LT(0, 1);
- FAST_CHECK_LT(0, 1);
- FAST_REQUIRE_LT(0, 1);
- FAST_WARN_GE(1, 1);
- FAST_CHECK_GE(1, 1);
- FAST_REQUIRE_GE(1, 1);
- FAST_WARN_LE(1, 1);
- FAST_CHECK_LE(1, 1);
- FAST_REQUIRE_LE(1, 1);
- FAST_WARN_UNARY(1);
- FAST_CHECK_UNARY(1);
- FAST_REQUIRE_UNARY(1);
- FAST_WARN_UNARY_FALSE(0);
- FAST_CHECK_UNARY_FALSE(0);
- FAST_REQUIRE_UNARY_FALSE(0);
}
static void someAssertsInFunction() {
@@ -208,9 +162,6 @@ static void someAssertsInFunction() {
CHECK_EQ(a, b);
CHECK_UNARY(a == b);
CHECK_UNARY_FALSE(a != b);
- FAST_CHECK_EQ(a, b);
- FAST_CHECK_UNARY(a == b);
- FAST_CHECK_UNARY_FALSE(a != b);
}
TEST_CASE("some asserts used in a function called by a test case") {
diff --git a/examples/all_features/asserts_used_outside_of_tests.cpp b/examples/all_features/asserts_used_outside_of_tests.cpp
index a2afd17..dcf9039 100644
--- a/examples/all_features/asserts_used_outside_of_tests.cpp
+++ b/examples/all_features/asserts_used_outside_of_tests.cpp
@@ -1,5 +1,5 @@
#ifndef DOCTEST_CONFIG_DISABLE
-#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS // defined so the fast asserts are crazy fast - both for compilation and execution
+#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS // defined so the asserts are crazy fast - both for compilation and execution
#endif
#include "doctest.h"
@@ -16,10 +16,6 @@ DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes")
// some function which uses asserts not just for unit testing but also for ensuring contracts in production code
static void some_func() {
- FAST_CHECK_EQ(true, false);
- FAST_CHECK_UNARY(false);
- FAST_CHECK_UNARY_FALSE(true);
-
CHECK_EQ(true, false);
CHECK_UNARY(false);
CHECK_UNARY_FALSE(true);
diff --git a/examples/all_features/doctest_proxy.h b/examples/all_features/doctest_proxy.h
index 419b50e..a8e93b6 100644
--- a/examples/all_features/doctest_proxy.h
+++ b/examples/all_features/doctest_proxy.h
@@ -65,29 +65,4 @@
#define my_check_unary_false DOCTEST_CHECK_UNARY_FALSE
#define my_require_unary_false DOCTEST_REQUIRE_UNARY_FALSE
-#define my_fast_warn_eq DOCTEST_FAST_WARN_EQ
-#define my_fast_check_eq DOCTEST_FAST_CHECK_EQ
-#define my_fast_require_eq DOCTEST_FAST_REQUIRE_EQ
-#define my_fast_warn_ne DOCTEST_FAST_WARN_NE
-#define my_fast_check_ne DOCTEST_FAST_CHECK_NE
-#define my_fast_require_ne DOCTEST_FAST_REQUIRE_NE
-#define my_fast_warn_gt DOCTEST_FAST_WARN_GT
-#define my_fast_check_gt DOCTEST_FAST_CHECK_GT
-#define my_fast_require_gt DOCTEST_FAST_REQUIRE_GT
-#define my_fast_warn_lt DOCTEST_FAST_WARN_LT
-#define my_fast_check_lt DOCTEST_FAST_CHECK_LT
-#define my_fast_require_lt DOCTEST_FAST_REQUIRE_LT
-#define my_fast_warn_ge DOCTEST_FAST_WARN_GE
-#define my_fast_check_ge DOCTEST_FAST_CHECK_GE
-#define my_fast_require_ge DOCTEST_FAST_REQUIRE_GE
-#define my_fast_warn_le DOCTEST_FAST_WARN_LE
-#define my_fast_check_le DOCTEST_FAST_CHECK_LE
-#define my_fast_require_le DOCTEST_FAST_REQUIRE_LE
-#define my_fast_warn_unary DOCTEST_FAST_WARN_UNARY
-#define my_fast_check_unary DOCTEST_FAST_CHECK_UNARY
-#define my_fast_require_unary DOCTEST_FAST_REQUIRE_UNARY
-#define my_fast_warn_unary_false DOCTEST_FAST_WARN_UNARY_FALSE
-#define my_fast_check_unary_false DOCTEST_FAST_CHECK_UNARY_FALSE
-#define my_fast_require_unary_false DOCTEST_FAST_REQUIRE_UNARY_FALSE
-
#endif // MY_PROXY_MACROS
diff --git a/examples/all_features/test_output/all_binary.txt b/examples/all_features/test_output/all_binary.txt
index 75b80f2..c7a3103 100644
--- a/examples/all_features/test_output/all_binary.txt
+++ b/examples/all_features/test_output/all_binary.txt
@@ -75,80 +75,8 @@ assertion_macros.cpp(0): SUCCESS: CHECK_UNARY_FALSE( 0 ) is correct!
assertion_macros.cpp(0): SUCCESS: REQUIRE_UNARY_FALSE( 0 ) is correct!
values: REQUIRE_UNARY_FALSE( 0 )
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_EQ( 1, 1 ) is correct!
- values: FAST_WARN_EQ( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_EQ( 1, 1 ) is correct!
- values: FAST_CHECK_EQ( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_EQ( 1, 1 ) is correct!
- values: FAST_REQUIRE_EQ( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_NE( 1, 0 ) is correct!
- values: FAST_WARN_NE( 1, 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_NE( 1, 0 ) is correct!
- values: FAST_CHECK_NE( 1, 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_NE( 1, 0 ) is correct!
- values: FAST_REQUIRE_NE( 1, 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_GT( 1, 0 ) is correct!
- values: FAST_WARN_GT( 1, 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_GT( 1, 0 ) is correct!
- values: FAST_CHECK_GT( 1, 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_GT( 1, 0 ) is correct!
- values: FAST_REQUIRE_GT( 1, 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_LT( 0, 1 ) is correct!
- values: FAST_WARN_LT( 0, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_LT( 0, 1 ) is correct!
- values: FAST_CHECK_LT( 0, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_LT( 0, 1 ) is correct!
- values: FAST_REQUIRE_LT( 0, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_GE( 1, 1 ) is correct!
- values: FAST_WARN_GE( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_GE( 1, 1 ) is correct!
- values: FAST_CHECK_GE( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_GE( 1, 1 ) is correct!
- values: FAST_REQUIRE_GE( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_LE( 1, 1 ) is correct!
- values: FAST_WARN_LE( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_LE( 1, 1 ) is correct!
- values: FAST_CHECK_LE( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_LE( 1, 1 ) is correct!
- values: FAST_REQUIRE_LE( 1, 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_UNARY( 1 ) is correct!
- values: FAST_WARN_UNARY( 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_UNARY( 1 ) is correct!
- values: FAST_CHECK_UNARY( 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_UNARY( 1 ) is correct!
- values: FAST_REQUIRE_UNARY( 1 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_WARN_UNARY_FALSE( 0 ) is correct!
- values: FAST_WARN_UNARY_FALSE( 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_CHECK_UNARY_FALSE( 0 ) is correct!
- values: FAST_CHECK_UNARY_FALSE( 0 )
-
-assertion_macros.cpp(0): SUCCESS: FAST_REQUIRE_UNARY_FALSE( 0 ) is correct!
- values: FAST_REQUIRE_UNARY_FALSE( 0 )
-
===============================================================================
[doctest] test cases: 1 | 1 passed | 0 failed |
-[doctest] assertions: 32 | 32 passed | 0 failed |
+[doctest] assertions: 16 | 16 passed | 0 failed |
[doctest] Status: SUCCESS!
Program code.
diff --git a/examples/all_features/test_output/assertion_macros.cpp.txt b/examples/all_features/test_output/assertion_macros.cpp.txt
index a260a6d..bf99f07 100644
--- a/examples/all_features/test_output/assertion_macros.cpp.txt
+++ b/examples/all_features/test_output/assertion_macros.cpp.txt
@@ -63,15 +63,6 @@ assertion_macros.cpp(0): WARNING: WARN_UNARY( 0 ) is NOT correct!
assertion_macros.cpp(0): WARNING: WARN_UNARY_FALSE( 1 ) is NOT correct!
values: WARN_UNARY_FALSE( 1 )
-assertion_macros.cpp(0): WARNING: FAST_WARN_EQ( 1, 0 ) is NOT correct!
- values: FAST_WARN_EQ( 1, 0 )
-
-assertion_macros.cpp(0): WARNING: FAST_WARN_UNARY( 0 ) is NOT correct!
- values: FAST_WARN_UNARY( 0 )
-
-assertion_macros.cpp(0): WARNING: FAST_WARN_UNARY_FALSE( 1 ) is NOT correct!
- values: FAST_WARN_UNARY_FALSE( 1 )
-
===============================================================================
assertion_macros.cpp(0):
TEST CASE: CHECK level of asserts fail the test case but don't abort it
@@ -101,15 +92,6 @@ assertion_macros.cpp(0): ERROR: CHECK_UNARY( 0 ) is NOT correct!
assertion_macros.cpp(0): ERROR: CHECK_UNARY_FALSE( 1 ) is NOT correct!
values: CHECK_UNARY_FALSE( 1 )
-assertion_macros.cpp(0): ERROR: FAST_CHECK_EQ( 1, 0 ) is NOT correct!
- values: FAST_CHECK_EQ( 1, 0 )
-
-assertion_macros.cpp(0): ERROR: FAST_CHECK_UNARY( 0 ) is NOT correct!
- values: FAST_CHECK_UNARY( 0 )
-
-assertion_macros.cpp(0): ERROR: FAST_CHECK_UNARY_FALSE( 1 ) is NOT correct!
- values: FAST_CHECK_UNARY_FALSE( 1 )
-
assertion_macros.cpp(0): MESSAGE: reached!
===============================================================================
@@ -172,28 +154,7 @@ assertion_macros.cpp(0): FATAL ERROR: REQUIRE_UNARY_FALSE( 1 ) is NOT correct!
values: REQUIRE_UNARY_FALSE( 1 )
===============================================================================
-assertion_macros.cpp(0):
-TEST CASE: REQUIRE level of asserts fail and abort the test case - 10
-
-assertion_macros.cpp(0): FATAL ERROR: FAST_REQUIRE_EQ( 1, 0 ) is NOT correct!
- values: FAST_REQUIRE_EQ( 1, 0 )
-
-===============================================================================
-assertion_macros.cpp(0):
-TEST CASE: REQUIRE level of asserts fail and abort the test case - 11
-
-assertion_macros.cpp(0): FATAL ERROR: FAST_REQUIRE_UNARY( 0 ) is NOT correct!
- values: FAST_REQUIRE_UNARY( 0 )
-
-===============================================================================
-assertion_macros.cpp(0):
-TEST CASE: REQUIRE level of asserts fail and abort the test case - 12
-
-assertion_macros.cpp(0): FATAL ERROR: FAST_REQUIRE_UNARY_FALSE( 1 ) is NOT correct!
- values: FAST_REQUIRE_UNARY_FALSE( 1 )
-
-===============================================================================
-[doctest] test cases: 20 | 4 passed | 16 failed |
-[doctest] assertions: 92 | 55 passed | 37 failed |
+[doctest] test cases: 17 | 4 passed | 13 failed |
+[doctest] assertions: 66 | 35 passed | 31 failed |
[doctest] Status: FAILURE!
Program code.
diff --git a/examples/all_features/test_output/asserts_used_outside_of_tests.cpp.txt b/examples/all_features/test_output/asserts_used_outside_of_tests.cpp.txt
index a5212b1..3b89ba7 100644
--- a/examples/all_features/test_output/asserts_used_outside_of_tests.cpp.txt
+++ b/examples/all_features/test_output/asserts_used_outside_of_tests.cpp.txt
@@ -4,19 +4,13 @@
[doctest] assertions: 0 | 0 passed | 0 failed |
[doctest] Status: SUCCESS!
Program code.
-asserts_used_outside_of_tests.cpp(19): ERROR: FAST_CHECK_EQ( true, false ) is NOT correct!
- values: FAST_CHECK_EQ( true, false )
-asserts_used_outside_of_tests.cpp(20): ERROR: FAST_CHECK_UNARY( false ) is NOT correct!
- values: FAST_CHECK_UNARY( false )
-asserts_used_outside_of_tests.cpp(21): ERROR: FAST_CHECK_UNARY_FALSE( true ) is NOT correct!
- values: FAST_CHECK_UNARY_FALSE( true )
-asserts_used_outside_of_tests.cpp(23): ERROR: CHECK_EQ( true, false ) is NOT correct!
+asserts_used_outside_of_tests.cpp(19): ERROR: CHECK_EQ( true, false ) is NOT correct!
values: CHECK_EQ( true, false )
-asserts_used_outside_of_tests.cpp(24): ERROR: CHECK_UNARY( false ) is NOT correct!
+asserts_used_outside_of_tests.cpp(20): ERROR: CHECK_UNARY( false ) is NOT correct!
values: CHECK_UNARY( false )
-asserts_used_outside_of_tests.cpp(25): ERROR: CHECK_UNARY_FALSE( true ) is NOT correct!
+asserts_used_outside_of_tests.cpp(21): ERROR: CHECK_UNARY_FALSE( true ) is NOT correct!
values: CHECK_UNARY_FALSE( true )
-asserts_used_outside_of_tests.cpp(27): ERROR: CHECK( false ) is NOT correct!
+asserts_used_outside_of_tests.cpp(23): ERROR: CHECK( false ) is NOT correct!
values: CHECK( false )
hello!
-asserts_used_outside_of_tests.cpp(28): ERROR: an assert dealing with exceptions has failed!
+asserts_used_outside_of_tests.cpp(24): ERROR: an assert dealing with exceptions has failed!
diff --git a/examples/all_features/test_output/filter_2.txt b/examples/all_features/test_output/filter_2.txt
index 44c1759..683fc02 100644
--- a/examples/all_features/test_output/filter_2.txt
+++ b/examples/all_features/test_output/filter_2.txt
@@ -1,6 +1,6 @@
[doctest] run with "--help" for options
===============================================================================
-[doctest] test cases: 0 | 0 passed | 0 failed | 72 skipped
+[doctest] test cases: 0 | 0 passed | 0 failed | 69 skipped
[doctest] assertions: 0 | 0 passed | 0 failed |
[doctest] Status: SUCCESS!
Program code.
diff --git a/scripts/playground/test.cpp b/scripts/playground/test.cpp
index 463769c..043e3be 100644
--- a/scripts/playground/test.cpp
+++ b/scripts/playground/test.cpp
@@ -4,7 +4,3 @@ DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN
#include <iostream>
using namespace std;
DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END
-
-TEST_CASE("") {
- CHECK_THROWS_AS(throw 5, std::exception);
-}