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