onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <title>features</title> |
| 4 | <xmp theme="united" style="display:none;"> |
| 5 | |
| 6 | ## Features and design goals |
| 7 | |
| 8 | **doctest** has been designed from the start to be as **light** and **unintrusive** as possible. These key features should be kept. |
| 9 | |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 10 | It is modeled after [**Catch**](https://github.com/philsquared/Catch) which is currently the most popular alternative for testing in C++ - check out [**the differences**](faq.html#how-is-doctest-different-from-catch). |
| 11 | |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 12 | ## Unintrusive (transparent): |
| 13 | |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 14 | - everything testing-related can be removed from the binary executable by defining the [**```DOCTEST_CONFIG_DISABLE```**](configuration.html#doctest_config_disable) identifier |
| 15 | - very small and easy to integrate - single header - **extremely** low footprint on compile times - see the [**benchmarks**](benchmarks.html) |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 16 | - doesn't drag any headers when included (except for in the translation unit where the library gets implemented) |
| 17 | - everything is in the ```doctest``` namespace (and the implementation details are in a nested ```detail``` namespace) |
| 18 | - all macros have prefixes - some by default have unprefixed versions as well but that is optional - see [**configuration**](configuration.html) |
| 19 | - 0 warnings even with the most aggresive flags (on all tested compilers!!!) |
| 20 | - ```-Weverything -pedantic``` for **clang** |
| 21 | - ```-Wall -Wextra -pedantic``` and **>> over 50 <<** other warnings **not** covered by these flags for **GCC**!!! - see [**here**](../../scripts/common.cmake#L59) |
| 22 | - ```/W4``` for **MSVC** (```/Wall``` is too much there - even their own headers produce **thousands** of warnings with that option) |
| 23 | - doesn't error on unrecognized [**command line**](commandline.html) options and supports prefixes for interop with client command line parsing |
| 24 | - can set options [**procedurally**](main.html) and not deal with passing ```argc```/```argv``` from the command line |
| 25 | - doesn't leave warnings disabled after itself |
| 26 | |
| 27 | ## Extremely portable: |
| 28 | |
| 29 | - Standards compliant **C++98** code - should work with any **C++98** compiler |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 30 | - tested with **GCC**: **4.4**, **4.5**, **4.6**, **4.7**, **4.8**, **4.9**, **5**, **6** |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 31 | - tested with **Clang**: **3.4**, **3.5**, **3.6**, **3.7**, **3.8** |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 32 | - tested with **MSVC**: **2008**, **2010**, **2012**, **2013**, **2015** |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 33 | - per-commit tested on **travis** and **appveyor** CI services |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 34 | - warnings as errors even on the most aggressive warning levels - see [**here**](../../scripts/common.cmake#L71) |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 35 | - all tests have their output compared to reference output of a previous known good run |
| 36 | - all tests built and ran in **Debug**/**Release** and also in **32**/**64** bit modes |
| 37 | - all tests ran through **valgrind** under **Linux**/**OSX** |
| 38 | - all tests ran through **address** and **UB** sanitizers under **Linux**/**OSX** |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 39 | - tests are ran in more than **200** different configurations on UNIX (Linux + OSX) on **travis** CI |
| 40 | - tests are ran in a total of **20** different configurations on Windows on **appveyor** CI |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 41 | |
| 42 | ## Other features: |
| 43 | |
| 44 | - really easy to get started - it's just 1 header file - see the [**tutorial**](tutorial.html) |
| 45 | - **very** light, unintrusive and portable - see the sections above - and also the [**benchmarks**](benchmarks.html) |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 46 | - offers a way to remove **everything** testing-related from the binary with the [**```DOCTEST_CONFIG_DISABLE```**](configuration.html#doctest_config_disable) macro |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 47 | - tests are registered automatically - no need to add them to a collection manually |
| 48 | - supports [**subcases**](testcases.html) for easy setup/teardown of tests (also supports the retro [**test fixtures**](testcases.html#) with classes) |
| 49 | - output from all compilers on all platforms is the same - byte by byte |
| 50 | - supports [**BDD style**](testcases.html) tests |
| 51 | - only one core [**assertion macro**](assertions.html) for comparisons - standard C++ operators are used for the comparison (less than, equal, greater than...) - yet the full expression is decomposed and left and right values of the expression are logged |
| 52 | - assertion macros for [**exceptions**](assertions.html) - if something should or shouldn't throw |
| 53 | - floating point comparison support - see the [**```Approx()```**](assertions.html#floating-point-comparisons) helper |
| 54 | - powerful mechanism for [**stringification**](stringification.html) of user types |
| 55 | - tests can be grouped in [**test suites**](testcases.html) |
| 56 | - powerful [**command line**](commandline.html) with lots of options |
| 57 | - tests can be [**filtered**](commandline.html) based on their name/file/test suite using wildcards |
| 58 | - failures can (optionally) break into the debugger on Windows and Mac |
| 59 | - integration with the output window of Visual Studio for failing tests |
onqtam | 1435c01 | 2016-09-21 15:29:11 +0300 | [diff] [blame] | 60 | - a ```main()``` can be provided when implementing the library with the [**```DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN```**](main.html#doctest_config_implement_with_main) identifier |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 61 | - can write tests in headers - they will still be registered only once in the executable/shared object |
| 62 | - [**range-based**](commandline.html) execution of tests - see the [**range_based_execution**](../../examples/range_based_execution/) example (the **run.py** script) |
| 63 | - colored output in the console |
| 64 | - controlling the order of test execution |
| 65 | |
| 66 | There is a list of planned features which are all important and big - see the [**roadmap**](roadmap.html). |
| 67 | |
| 68 | --------------- |
| 69 | |
| 70 | [Home](readme.html#reference) |
| 71 | |
| 72 | |
| 73 | </xmp> |
| 74 | <script src="strapdown.js/strapdown.js"></script> |
| 75 | </html> |