Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/onqtam/doctest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authoronqtam <vik.kirilov@gmail.com>2020-12-15 22:02:28 +0300
committeronqtam <vik.kirilov@gmail.com>2020-12-15 22:02:46 +0300
commit2a069c43af43973c1923c6838d0dbe48ee3e5f84 (patch)
treeedca64a705104b94476aed64ee6dc9b47ace3fd1 /doc
parent7019f5a9b147523cb493663dbf904eadd2e63918 (diff)
version 2.4.2
Diffstat (limited to 'doc')
-rw-r--r--doc/html_generated/assertions.html6
-rw-r--r--doc/html_generated/commandline.html1
-rw-r--r--doc/html_generated/logging.html10
-rw-r--r--doc/html_generated/parameterized-tests.html29
4 files changed, 19 insertions, 27 deletions
diff --git a/doc/html_generated/assertions.html b/doc/html_generated/assertions.html
index 3d2b4f31..e15b9e9a 100644
--- a/doc/html_generated/assertions.html
+++ b/doc/html_generated/assertions.html
@@ -55,14 +55,14 @@ REQUIRE_FALSE(thisReturnsFalse());
Examples:
```
-INFO("this is relevant to all asserts, and here is some var: " << local);
+INFO("this is relevant to all asserts, and here is some var: ", local);
-CHECK_MESSAGE(a < b, "relevant only to this assert " << other_local << "more text!");
+CHECK_MESSAGE(a < b, "relevant only to this assert ", other_local, " more text!");
CHECK(b < c); // here only the first INFO() will be relevant
```
-For more information about the ```INFO()``` macro and logging with the streaming ```operator<<``` visit the [logging page](logging.html).
+For more information about the ```INFO()``` macro visit the [logging page](logging.html).
## Binary and unary asserts
diff --git a/doc/html_generated/commandline.html b/doc/html_generated/commandline.html
index 02062f08..e21ea594 100644
--- a/doc/html_generated/commandline.html
+++ b/doc/html_generated/commandline.html
@@ -59,6 +59,7 @@ All the options can also be set with code (defaults/overrides) if the user [**su
| ```-gfl``` ```--gnu-file-line=<bool>``` | ```:n:``` vs ```(n):``` for line numbers in output (gnu mode is usually for linux tools/IDEs and is with the ```:``` separator) |
| ```-npf``` ```--no-path-filenames=<bool>``` | Paths are removed from the output when a filename is printed - useful if you want the same output from the testing framework on different environments |
| ```-nln``` ```--no-line-numbers=<bool>``` | Line numbers are replaced with ```0``` in the output when a source location is printed - useful if you want the same output from the testing framework even when test positions change within a source file |
+| ```-ndo``` ```--no-debug-output=<bool>``` | Disables output in the debug console when a debugger is attached |
| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| |
All the flags/options also come with a prefixed version (with ```--dt-``` at the front by default) - for example ```--version``` can be used also with ```--dt-version``` or ```--dt-v```.
diff --git a/doc/html_generated/logging.html b/doc/html_generated/logging.html
index 2e60e242..90809073 100644
--- a/doc/html_generated/logging.html
+++ b/doc/html_generated/logging.html
@@ -9,10 +9,10 @@ Additional messages can be logged during a test case (safely even in [**concurre
## INFO()
-The ```INFO()``` macro allows heterogeneous sequences of expressions to be streamed using the insertion operator (```<<```) in the same way that ```std::ostream```, ```std::cout```, etc support it.
+The ```INFO()``` macro allows heterogeneous sequences of expressions to be captured by listing them with commas.
```
-INFO("The number is " << i);
+INFO("The number is ", i);
```
This message will be relevant to all asserts after it in the current scope or in scopes nested in the current one and will be printed later only if an assert fails.
@@ -50,13 +50,11 @@ There are a few other macros for logging information:
```FAIL()``` is like a ```REQUIRE``` assert - fails the test case and exits it. ```FAIL_CHECK()``` acts like a ```CHECK``` assert - fails the test case but continues with the execution. ```MESSAGE()``` just prints a message.
-In all these macros the messages are again composed using the ```<<``` streaming operator - like this:
-
```
-FAIL("This is not supposed to happen! some var: " << var);
+FAIL("This is not supposed to happen! some var: ", var);
```
-Also there is no lazy stringification here - strings are always constructed and printed and thus there are no limitations to the values being logged - temporaries and rvalues are accepted - unlike with the ```INFO()``` macro.
+Also there is no lazy stringification here - strings are always constructed and printed.
There are also a few more intended for use by third party libraries such as mocking frameworks:
diff --git a/doc/html_generated/parameterized-tests.html b/doc/html_generated/parameterized-tests.html
index 5b750df2..8d08f7a1 100644
--- a/doc/html_generated/parameterized-tests.html
+++ b/doc/html_generated/parameterized-tests.html
@@ -53,24 +53,19 @@ There will be proper support for this in the future. For now there are 2 ways of
--------------------------------
- There is however an easy way to encapsulate this into a macro (written with C++11 for simplicity):
+ There is however an easy way to encapsulate this into a macro (written with C++14 for simplicity):
```
#include <algorithm>
- #include <vector>
#include <string>
- #define DOCTEST_VALUE_PARAMETERIZED_DATA(data, data_array) \
- static std::vector<std::string> _doctest_subcases = [&data_array]() { \
- std::vector<std::string> out; \
- while(out.size() != data_array.size()) \
- out.push_back(std::string(#data_array "[") + std::to_string(out.size() + 1) + "]"); \
- return out; \
- }(); \
- int _doctest_subcase_idx = 0; \
- std::for_each(data_array.begin(), data_array.end(), [&](const auto& in) { \
- DOCTEST_SUBCASE(_doctest_subcases[_doctest_subcase_idx++].c_str()) { data = in; } \
- })
+ #define DOCTEST_VALUE_PARAMETERIZED_DATA(data, data_container) \
+ static size_t _doctest_subcase_idx = 0; \
+ std::for_each(data_container.begin(), data_container.end(), [&](const auto& in) { \
+ DOCTEST_SUBCASE((std::string(#data_container "[") + \
+ std::to_string(_doctest_subcase_idx++) + "]").c_str()) { data = in; } \
+ }); \
+ _doctest_subcase_idx = 0
```
and now this can be used as follows:
@@ -78,9 +73,9 @@ There will be proper support for this in the future. For now there are 2 ways of
```
TEST_CASE("test name") {
int data;
- std::list<int> data_array = {1, 2, 3, 4}; // must be iterable - std::vector<> would work as well
+ std::list<int> data_container = {1, 2, 3, 4}; // must be iterable - std::vector<> would work as well
- DOCTEST_VALUE_PARAMETERIZED_DATA(data, data_array);
+ DOCTEST_VALUE_PARAMETERIZED_DATA(data, data_container);
printf("%d\n", data);
}
@@ -94,10 +89,8 @@ There will be proper support for this in the future. For now there are 2 ways of
3
4
```
-
+
The big limitation of this approach is that the macro cannot be used with other subcases at the same code block {} indentation level (will act weird) - it can only be used within a subcase.
-
- The ```static std::vector<std::string>``` is necessary because the ```SUBCASE()``` macro accepts ```const char*``` and doesn't copy the strings but keeps the pointers internally - that's why we need to construct persistent versions of the strings. This might be changed in the future (to accept a string class) for ease of use...
Stay tuned for proper value-parameterization in doctest!