summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoronqtam <vik.kirilov@gmail.com>2019-08-12 22:29:59 +0300
committeronqtam <vik.kirilov@gmail.com>2019-08-12 22:29:59 +0300
commit501463455491c9305f3f2ca80b3907645a81af15 (patch)
treec443df9119c32c145c625bcfa0508c9c9762f3ff
parentb2cf8e8ac7e1dc8508f87790784480a20e9f2e30 (diff)
version 2.3.4
-rw-r--r--README.md2
-rw-r--r--doc/html_generated/benchmarks.html8
-rw-r--r--doc/html_generated/build-systems.html8
-rw-r--r--doc/html_generated/configuration.html14
-rw-r--r--doc/html_generated/faq.html23
-rw-r--r--doc/html_generated/features.html2
-rw-r--r--doc/html_generated/logging.html23
-rw-r--r--doc/html_generated/reporters.html16
-rw-r--r--doc/html_generated/roadmap.html2
-rw-r--r--doctest/doctest.h4
-rw-r--r--doctest/parts/doctest_fwd.h4
-rw-r--r--examples/all_features/test_output/version.txt2
-rw-r--r--examples/all_features/test_output/version_xml.txt2
-rw-r--r--meson.build2
-rw-r--r--scripts/release_process.md2
-rw-r--r--scripts/version.txt2
16 files changed, 59 insertions, 57 deletions
diff --git a/README.md b/README.md
index 3c31108..ae97235 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/503/badge)](https://bestpractices.coreinfrastructure.org/projects/503)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/onqtam/doctest.svg)](https://lgtm.com/projects/g/onqtam/doctest/context:cpp)
[![Join the chat at https://gitter.im/onqtam/doctest](https://badges.gitter.im/onqtam/doctest.svg)](https://gitter.im/onqtam/doctest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](https://wandbox.org/permlink/cSNITptGIf1c0jrg)
+[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](https://wandbox.org/permlink/HbnLHVjkODZV3eU2)
<!--
[![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/)
[![documentation](https://img.shields.io/badge/documentation%20%20-online-blue.svg)](https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference)
diff --git a/doc/html_generated/benchmarks.html b/doc/html_generated/benchmarks.html
index bb74465..6289776 100644
--- a/doc/html_generated/benchmarks.html
+++ b/doc/html_generated/benchmarks.html
@@ -67,8 +67,8 @@ The script generates 201 source files and in 200 of them makes a function in the
| Linux Clang Debug | 8.76 | 15.60 | 107.99 | 110.61 |
| Linux Clang Release | 9.32 | 25.75 | 118.67 | 117.11 |
-<img src="../../scripts/data/benchmarks/header.png" width="430" align="right">
-<img src="../../scripts/data/benchmarks/implement.png" width="430">
+<img src="../../scripts/data/benchmarks/header.png" width="410" align="right">
+<img src="../../scripts/data/benchmarks/implement.png" width="410">
### Conclusion
@@ -185,8 +185,8 @@ Note that the assert always passes - the goal should be to optimize for the comm
| Linux Clang Debug | 1.15 | 2.38 | | Linux Clang Debug | 1.21 | 9.91 |
| Linux Clang Release | 0.28 | 0.50 | | Linux Clang Release | 0.32 | 3.27 |
-<img src="../../scripts/data/benchmarks/runtime_info.png" width="430" align="right">
-<img src="../../scripts/data/benchmarks/runtime_assert.png" width="430">
+<img src="../../scripts/data/benchmarks/runtime_info.png" width="410" align="right">
+<img src="../../scripts/data/benchmarks/runtime_assert.png" width="410">
### Conclusion
diff --git a/doc/html_generated/build-systems.html b/doc/html_generated/build-systems.html
index f3603fa..02519c0 100644
--- a/doc/html_generated/build-systems.html
+++ b/doc/html_generated/build-systems.html
@@ -15,15 +15,15 @@ You can substitute ```master``` with ```dev``` or a tag like ```1.2.9``` for a s
```cmake
cmake_minimum_required(VERSION 3.0)
-project(cmake_test)
+project(cmake_test VERSION 0.0.1 LANGUAGES CXX)
# Prepare doctest for other targets to use
-add_library(doctest INTERFACE)
-target_include_directories(doctest INTERFACE path/to/doctest)
+find_package(doctest REQUIRED)
# Make test executable
add_executable(tests main.cpp)
-target_link_libraries(tests doctest)
+target_compile_features(test PRIVATE cxx_std_17)
+target_link_libraries(test PRIVATE doctest::doctest)
```
- You can also use the following CMake snippet to automatically fetch the entire **doctest** repository from github and configure it as an external project:
diff --git a/doc/html_generated/configuration.html b/doc/html_generated/configuration.html
index 731c457..fbb1106 100644
--- a/doc/html_generated/configuration.html
+++ b/doc/html_generated/configuration.html
@@ -16,7 +16,6 @@ Defining something ```globally``` means for every source file of the binary (exe
- [**```DOCTEST_CONFIG_DISABLE```**](#doctest_config_disable)
- [**```DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL```**](#doctest_config_implementation_in_dll)
- [**```DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES```**](#doctest_config_no_short_macro_names)
-- [**```DOCTEST_CONFIG_NUM_CAPTURES_ON_STACK```**](#doctest_config_num_captures_on_stack)
- [**```DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING```**](#doctest_config_treat_char_star_as_string)
- [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](#doctest_config_super_fast_asserts)
- [**```DOCTEST_CONFIG_USE_STD_HEADERS```**](#doctest_config_use_std_headers)
@@ -78,19 +77,6 @@ This will remove all macros from **doctest** that don't have the **```DOCTEST_``
This can be defined both globally and in specific source files only.
-### **```DOCTEST_CONFIG_NUM_CAPTURES_ON_STACK```**
-
-With this identifier the user may configure the number of captures on the stack by the ```INFO()``` [**logging macros**](logging.html) (read there for more info). The default is ```5``` - which means that for a call like this: ```INFO(var1 << "la la" << var2);``` all 3 logged variables will be captured on the stack (with the ability to hold 2 more - so no heap allocation unless an assert fails later in the same scope) - and a total of ```5 * (sizeof(void*) * 2))``` bytes are used on the stack for captures. A subsequent call to ```INFO()``` will have it's own stack space. Note that ```0``` is an invalid value. Examples:
-
-```
-#define DOCTEST_CONFIG_NUM_CAPTURES_ON_STACK 10
-#include <doctest.h>
-```
-
-or through the command line: ```-DDOCTEST_CONFIG_NUM_CAPTURES_ON_STACK=10```
-
-This should be defined globally.
-
### **```DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING```**
By default ```char*``` is being treated as a pointer. With this option comparing ```char*``` pointers will switch to using ```strcmp()``` for comparisons and when stringified the string will be printed instead of the pointer value.
diff --git a/doc/html_generated/faq.html b/doc/html_generated/faq.html
index bbc5d8c..22d7149 100644
--- a/doc/html_generated/faq.html
+++ b/doc/html_generated/faq.html
@@ -6,6 +6,7 @@
## FAQ
- [**How is doctest different from Catch?**](#how-is-doctest-different-from-catch)
+- [**How is doctest different from Google Test?**](#how-is-doctest-different-from-google-test)
- [**How to get the best compile-time performance with the framework?**](#how-to-get-the-best-compile-time-performance-with-the-framework)
- [**Is doctest thread-aware?**](#is-doctest-thread-aware)
- [**Is mocking supported?**](#is-mocking-supported)
@@ -38,6 +39,7 @@ Aside from everything mentioned so far doctest has some [**features**](features.
Missing stuff:
- matchers and generators
+- micro benchmarking support - nonius is used in [**Catch**](https://github.com/catchorg/Catch2)
- other small stuff
But these things (and more!) are planned in the [**roadmap**](roadmap.html)!
@@ -61,6 +63,25 @@ A quick and easy way to migrate most of your Catch tests to doctest is to change
using doctest::Approx;
```
+### How is **doctest** different from Google Test?
+
+Here are a couple of differences:
+
+– the main one is that only doctest from the C++ frameworks is usable next to your production code (speed of compilation, ability to remove the tests from the binary, ability to execute tests/code/both, ability to have tests in multiple shared objects and still a single registry for all of them)
+– doctest is a single header – Google Test has to be built as a separate static library and linked against.
+– doctest has the concept of [**Subcases**](https://github.com/onqtam/doctest/blob/master/doc/markdown/tutorial.html#test-cases-and-subcases) which is a much cleaner way to share setup and teardown code between tests compared to fixtures and class inheritance – Google Test is quite verbose!
+– doctest compiles faster and probably runs faster (although the runtime becomes an issue only when you have millions of asserts)
+– doctest asserts are thread-safe even on Windows (Google Test uses pthreads so thread-safe asserts are available only on UNIX)
+– doctest overall has a simpler API
+
+but there are also some areas in which doctest is lacking:
+
+– value-parameterized tests
+– death tests (where you check if calling a certain function doesn’t simply throw but if it crashes the process)
+– doctest has some integration with mocking libraries but Google Test works perfectly with Google Mock (although doctest should in theory work with it as well)
+
+The areas where doctest is behind are planned for improvement in the future. There are many other smaller differences – it would be impractical to cover them all.
+
### How to get the best compile-time performance with the framework?
The [**```DOCTEST_CONFIG_SUPER_FAST_ASSERTS```**](configuration.html#doctest_config_super_fast_asserts) config option yelds the [**fastest possible**](benchmarks.html#cost-of-an-assertion-macro) compile times (up to 31-91%). Also the expression-decomposing template machinery can be skipped by using the [**binary**](assertions.html#binary-and-unary-asserts) asserts.
@@ -120,7 +141,7 @@ It doesn't work in 2 scenarios:
You can also checkout this repository for a different solution: [**pthom/doctest_registerlibrary**](https://github.com/pthom/doctest_registerlibrary).
-A compiler-specific solution for MSVC is to use the [```/OPT:NOREF```](https://msdn.microsoft.com/en-us/library/bxwfs976.aspx) linker flag (thanks to [lectem](https://github.com/Lectem) for [reporting](https://github.com/onqtam/doctest/issues/106) it!)
+A compiler-specific solution for MSVC is to use the [```/OPT:NOREF```](https://msdn.microsoft.com/en-us/library/bxwfs976.aspx) linker flag (thanks to [lectem](https://github.com/Lectem) for [reporting](https://github.com/onqtam/doctest/issues/106) it!). Another option is to look at [```/wholearchive```](https://docs.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=vs-2019) for MSVC.
### Why is comparing C strings (```char*```) actually comparing pointers?
diff --git a/doc/html_generated/features.html b/doc/html_generated/features.html
index 322b16d..02e6035 100644
--- a/doc/html_generated/features.html
+++ b/doc/html_generated/features.html
@@ -32,7 +32,7 @@
- tested with **MSVC**: **2015**, **2017**, **2019** (also in 32 bit mode)
- per-commit tested on [**travis**](https://travis-ci.org/onqtam/doctest) and [**appveyor**](https://ci.appveyor.com/project/onqtam/doctest) CI services
- warnings as errors even on the most aggressive warning levels - see [**here**](../../scripts/cmake/common.cmake#L84)
- - statically analyzed on the CI - [**Cppcheck**](http://cppcheck.sourceforge.net/) / [**Clang-Tidy**](http://oclint.org/) / [**Coverity Scan**](https://scan.coverity.com/) / [**OCLint**](https://scan.coverity.com/) / [**Visual Studio Analyzer**](https://docs.microsoft.com/en-us/visualstudio/code-quality/analyzing-c-cpp-code-quality-by-using-code-analysis)
+ - statically analyzed on the CI - [**Cppcheck**](http://cppcheck.sourceforge.net/) / [**Clang-Tidy**](https://clang.llvm.org/extra/clang-tidy/) / [**Coverity Scan**](https://scan.coverity.com/) / [**OCLint**](http://oclint.org/) / [**Visual Studio Analyzer**](https://docs.microsoft.com/en-us/visualstudio/code-quality/analyzing-c-cpp-code-quality-by-using-code-analysis)
- all tests have their output compared to reference output of a previous known good run
- all tests built and ran in **Debug**/**Release** modes
- all tests ran through **valgrind** under **Linux** (sadly [not under OSX](https://github.com/onqtam/doctest/issues/11))
diff --git a/doc/html_generated/logging.html b/doc/html_generated/logging.html
index 525e2e7..6d2dea5 100644
--- a/doc/html_generated/logging.html
+++ b/doc/html_generated/logging.html
@@ -9,7 +9,7 @@ Additional messages can be logged during a test case (safely even in [**concurre
## INFO()
-The ```INFO()``` macro allows heterogenous sequences of values to be streamed using the insertion operator (```<<```) in the same way that ```std::ostream```, ```std::cout```, etc support it.
+The ```INFO()``` macro allows heterogenous sequences of expressions to be streamed using the insertion operator (```<<```) in the same way that ```std::ostream```, ```std::cout```, etc support it.
```
INFO("The number is " << i);
@@ -17,29 +17,14 @@ 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.
-Note that there is no initial ```<<``` - instead the insertion sequence is placed in parentheses.
-
-The message is **NOT** constructed right away - instead it gets lazily stringified only when needed. This means that rvalues (temporaries) cannot be passed to the ```INFO()``` macro. All literals are treated as rvalue references by the standard - except for C string literals (```"like this one"```). That means that even normal integer literals cannot be used directly - they need to be stored in a variable/constant before being passed to ```INFO()```. If C++14 is used (or Visual Studio 2017+) doctest provides the ```TO_LVALUE()``` macro to help in this regard - it turns any literal or constexpr value to an lvalue and can be used like this:
-
-```
-constexpr int foo() { return 42; }
-TEST_CASE("playing with literals and constexpr values") {
- INFO(TO_LVALUE(6) << " and this is a C string literal " << TO_LVALUE(foo()));
- CHECK(false);
-}
-```
-
-```TO_LVALUE()``` can also help in contexts where you might want to avoid a ```static constexpr``` member to be ODR-used - see [**```DOCTEST_CONFIG_ASSERTION_PARAMETERS_BY_VALUE```**](configuration.html#doctest_config_assertion_parameters_by_value).
+The expression is **NOT** evaluated right away - instead it gets lazily evaluated only when needed.
Some notes:
-- the lazy stringification means the values will be stringified when an assert fails and not at the point of capture - so the value might have changed
-- if the library is built with C++11 rvalue reference support (see [**```DOCTEST_CONFIG_WITH_RVALUE_REFERENCES```**](configuration.html#doctest_config_with_rvalue_references)) then deleted overloads are provided to prohibit rvalues from being captured in an **```INFO()```** call - since the lazy stringification actually caches pointers to the objects. For C++98 temporaries will again not work but there will be horrible compilation errors
-- the [**```DOCTEST_CONFIG_NUM_CAPTURES_ON_STACK```**](configuration.html#doctest_config_num_captures_on_stack) config identifier can be used to control how much stack space is used to avoid heap allocations for the streaming macros
-- stream manipulators (from ```<iomanip>```) can be used but need to be created as local variables and used as lvalues
+- the lazy stringification means the expressions will be evaluated when an assert fails and not at the point of capture - so the value might have changed by then
- refer to the [**stringification**](stringification.html) page for information on how to teach doctest to stringify your types
-The lazy stringification and the stack usage means that in the common case when no asserts fail the code runs super fast. This makes it suitable even in loops - perhaps to log the iteration.
+The lazy evaluation means that in the common case when no asserts fail the code runs super fast. This makes it suitable even in loops - perhaps to log the iteration.
There is also the **```CAPTURE()```** macro which is a convenience wrapper of **```INFO()```**:
diff --git a/doc/html_generated/reporters.html b/doc/html_generated/reporters.html
index 68c5f5d..fdaa410 100644
--- a/doc/html_generated/reporters.html
+++ b/doc/html_generated/reporters.html
@@ -7,7 +7,7 @@
Doctest has a modular reporter/listener system with which users can write their own reporters and register them. The reporter interface can also be used for "listening" to events.
-You can list all registered reporters with ```--list-reporters```. There are a few implemented reporters in the framework:
+You can list all registered reporters/listeners with ```--list-reporters```. There are a few implemented reporters in the framework:
- ```console``` - streaming - writes normal lines of text with coloring if a capable terminal is detected
- ```xml``` - streaming - writes in xml format tailored to doctest
@@ -82,11 +82,21 @@ struct MyXmlReporter : public IReporter
void test_case_skipped(const TestCaseData& /*in*/) override {}
};
-// "1" is the priority - used for ordering when multiple reporters/listeners are used
+// "1" is the priority - used for ordering when multiple reporters are used
REGISTER_REPORTER("my_xml", 1, MyXmlReporter);
+
+// registering the same class as a reporter and as a listener is nonsense but it's possible
+REGISTER_LISTENER("my_listener", 1, MyXmlReporter);
```
-Multiple reporters can be used at the same time - just specify them through the ```--reporters=...``` [**command line filtering option**](commandline.html) using commas to separate them like this: ```--reporters=myListener,xml``` and their order of execution will be based on their priority - that is the number "1" in the case of the example reporter above (lower means earlier - the default console/xml reporters from the framework have 0 as their priority and negative numbers are accepted as well).
+Custom `IReporter` implementations must be registered with one of:
+
+* `REGISTER_REPORTER`, for when the new reporter is an option that users may choose at run-time.
+* `REGISTER_LISTENER`, for when the reporter is actually a listener and must always be executed, regardless of which reporters have been chosen at run-time.
+
+Multiple reporters can be used at the same time - just specify them through the ```--reporters=...``` [**command line filtering option**](commandline.html) using commas to separate them like this: ```--reporters=myReporter,xml``` and their order of execution will be based on their priority - that is the number "1" in the case of the example reporter above (lower means earlier - the default console/xml reporters from the framework have 0 as their priority and negative numbers are accepted as well).
+
+All registered listeners (```REGISTER_LISTENER```) will be executed before any reporter - they do not need to be specified and cannot be filtered through the command line.
When implementing a reporter users are advised to follow the comments from the example above and look at the few implemented reporters in the framework itself. Also check out the [**example**](../../examples/all_features/reporters_and_listeners.cpp).
diff --git a/doc/html_generated/roadmap.html b/doc/html_generated/roadmap.html
index c229448..d8806a1 100644
--- a/doc/html_generated/roadmap.html
+++ b/doc/html_generated/roadmap.html
@@ -10,7 +10,7 @@ This library is free, and will stay free but needs your support to sustain its d
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/onqtam)
[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.me/onqtam/10)
-Planned features for future releases - order changes constantly...
+Planned features for future releases - order changes constantly... Also look through the [**issues**](https://github.com/onqtam/doctest/issues).
### For 2.4:
diff --git a/doctest/doctest.h b/doctest/doctest.h
index 5e62cd3..3c12557 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -48,8 +48,8 @@
#define DOCTEST_VERSION_MAJOR 2
#define DOCTEST_VERSION_MINOR 3
-#define DOCTEST_VERSION_PATCH 3
-#define DOCTEST_VERSION_STR "2.3.3"
+#define DOCTEST_VERSION_PATCH 4
+#define DOCTEST_VERSION_STR "2.3.4"
#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 c539275..af5a140 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 3
-#define DOCTEST_VERSION_PATCH 3
-#define DOCTEST_VERSION_STR "2.3.3"
+#define DOCTEST_VERSION_PATCH 4
+#define DOCTEST_VERSION_STR "2.3.4"
#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 18ef42e..e631dce 100644
--- a/examples/all_features/test_output/version.txt
+++ b/examples/all_features/test_output/version.txt
@@ -1 +1 @@
-[doctest] doctest version is "2.3.3"
+[doctest] doctest version is "2.3.4"
diff --git a/examples/all_features/test_output/version_xml.txt b/examples/all_features/test_output/version_xml.txt
index e738379..cf44de6 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.3.3">
+<doctest binary="all_features" version="2.3.4">
<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 fa31e36..56f51bc 100644
--- a/meson.build
+++ b/meson.build
@@ -1,2 +1,2 @@
-project('doctest', ['cpp'], version: '2.3.3', meson_version:'>=0.50')
+project('doctest', ['cpp'], version: '2.3.4', meson_version:'>=0.50')
doctest_dep = declare_dependency(include_directories: include_directories('doctest'))
diff --git a/scripts/release_process.md b/scripts/release_process.md
index 691c00c..a27b3b9 100644
--- a/scripts/release_process.md
+++ b/scripts/release_process.md
@@ -2,7 +2,7 @@
- run update_stuff.py from the scripts folder
- regenerate test output by running cmake with -DTEST_MODE=COLLECT and then running ctest
- run update_wandbox_link.py
- - might need to do this first: set path=C:/Python27;%PATH%
+ - might need to do this first: set path=C:/Python27;%PATH% - or just call python from C:\Python27\python.exe
- commit in dev
- merge dev in master and coverity_scan (and rebase them?)
- push all branches (git push --all)
diff --git a/scripts/version.txt b/scripts/version.txt
index 45674f1..fd06a92 100644
--- a/scripts/version.txt
+++ b/scripts/version.txt
@@ -1 +1 @@
-2.3.3 \ No newline at end of file
+2.3.4 \ No newline at end of file