diff options
author | onqtam <vik.kirilov@gmail.com> | 2020-12-15 22:02:28 +0300 |
---|---|---|
committer | onqtam <vik.kirilov@gmail.com> | 2020-12-15 22:02:46 +0300 |
commit | 2a069c43af43973c1923c6838d0dbe48ee3e5f84 (patch) | |
tree | edca64a705104b94476aed64ee6dc9b47ace3fd1 | |
parent | 7019f5a9b147523cb493663dbf904eadd2e63918 (diff) |
version 2.4.2
-rw-r--r-- | doc/html_generated/assertions.html | 6 | ||||
-rw-r--r-- | doc/html_generated/commandline.html | 1 | ||||
-rw-r--r-- | doc/html_generated/logging.html | 10 | ||||
-rw-r--r-- | doc/html_generated/parameterized-tests.html | 29 | ||||
-rw-r--r-- | doctest/doctest.h | 4 | ||||
-rw-r--r-- | doctest/parts/doctest_fwd.h | 4 | ||||
-rw-r--r-- | examples/all_features/test_output/version.txt | 2 | ||||
-rw-r--r-- | examples/all_features/test_output/version_xml.txt | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | scripts/version.txt | 2 |
10 files changed, 27 insertions, 35 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 | | | | 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! diff --git a/doctest/doctest.h b/doctest/doctest.h index 372a6d09..cdcb50d8 100644 --- a/doctest/doctest.h +++ b/doctest/doctest.h @@ -48,8 +48,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 4 -#define DOCTEST_VERSION_PATCH 1 -#define DOCTEST_VERSION_STR "2.4.1" +#define DOCTEST_VERSION_PATCH 2 +#define DOCTEST_VERSION_STR "2.4.2" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h index 4c52d51b..4e587315 100644 --- a/doctest/parts/doctest_fwd.h +++ b/doctest/parts/doctest_fwd.h @@ -45,8 +45,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 4 -#define DOCTEST_VERSION_PATCH 1 -#define DOCTEST_VERSION_STR "2.4.1" +#define DOCTEST_VERSION_PATCH 2 +#define DOCTEST_VERSION_STR "2.4.2" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) diff --git a/examples/all_features/test_output/version.txt b/examples/all_features/test_output/version.txt index 7b2fdc3b..a32e1872 100644 --- a/examples/all_features/test_output/version.txt +++ b/examples/all_features/test_output/version.txt @@ -1 +1 @@ -[doctest] doctest version is "2.4.1" +[doctest] doctest version is "2.4.2" diff --git a/examples/all_features/test_output/version_xml.txt b/examples/all_features/test_output/version_xml.txt index 9ef679dc..1a7dd6bb 100644 --- a/examples/all_features/test_output/version_xml.txt +++ b/examples/all_features/test_output/version_xml.txt @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> -<doctest binary="all_features" version="2.4.1"> +<doctest binary="all_features" version="2.4.2"> <Options order_by="file" rand_seed="324" first="0" last="4294967295" abort_after="0" subcase_filter_levels="2147483647" case_sensitive="false" no_throw="false" no_skip="false"/> </doctest> diff --git a/meson.build b/meson.build index 68eab4dc..2ec048f8 100644 --- a/meson.build +++ b/meson.build @@ -1,2 +1,2 @@ -project('doctest', ['cpp'], version: '2.4.1', meson_version:'>=0.50') +project('doctest', ['cpp'], version: '2.4.2', meson_version:'>=0.50') doctest_dep = declare_dependency(include_directories: include_directories('doctest')) diff --git a/scripts/version.txt b/scripts/version.txt index 58073ef8..acdc3f1b 100644 --- a/scripts/version.txt +++ b/scripts/version.txt @@ -1 +1 @@ -2.4.1
\ No newline at end of file +2.4.2
\ No newline at end of file |