tpunitpp icon indicating copy to clipboard operation
tpunitpp copied to clipboard

A simple, portable C++ xUnit library contained in a single header.

tpunit++

A highly portable, simple C++ xUnit library contained in a single header. Documentation and downloads are available at http://github.com/tpounds/tpunitpp.

tpunit++ is licensed under the MIT License. (http://www.opensource.org/licenses/mit-license.php)

Installation

Add tpunit++.hpp anywhere to your C++ compiler's include path, add test cases and compile together with tpunit++main.cpp or a custom user-defined main method.

Tested Compilers

tpunit++ has been exhaustively tested on several popular compiler versions, however, it has not been tested with everything (e.g. PGI, SunPro, etc.). The following compatibility information is provided as a representative sample of compiler versions that the vanilla library is expected to work with out of the box.

Notes:

Some compilers have issues using the fully qualified class with namespace syntax (e.g. ns::class). Try the 'using' directive to workaround the issue.

e.g. using namespace tpunit; using tpunit::TestFixture;

The primary issue preventing tpunit++ from working with a compiler is a lack of member function template specialization. This feature is required to support tpunit++'s registration methods (e.g. After, Before, Test). It is expected that tpunit++ will work with any compiler supporting this functionality.

Additionally, some linkers do not work with file names that contain non- alphanumeric characters (e.g. tpunit++main.cpp). Try renaming these files to include only alphanumeric characters or configure the compiler to emit object files that do not include illegal characters.

+-------------------------------------------------------+ | version | flags | status | +-------------------------------------------------------+ | GCC (http://gcc.gnu.org) | +-------------------------------------------------------+ | 2.95.3 | , -fno-exceptions | works | | 3.0.4 | , -fno-exceptions | works | | 3.1.1 | , -fno-exceptions | works | | 3.2.3 | , -fno-exceptions | works | | 3.3.6 | , -fno-exceptions | works | | 3.4.6 | , -fno-exceptions | works | | 4.0.4 | , -fno-exceptions | works | | 4.1.2 | , -fno-exceptions | works | | 4.2.4 | , -fno-exceptions | works | | 4.3.6 | , -fno-exceptions | works | | 4.4.7 | , -fno-exceptions | works | | 4.5.3 | , -fno-exceptions | works | | 4.6.3 | , -fno-exceptions | works | | 4.7.4 | , -fno-exceptions | works | | 4.8.4 | , -fno-exceptions | works | | 4.9.2 | , -fno-exceptions | works | | 5.1.0 | , -fno-exceptions | works | | 5.2.0 | , -fno-exceptions | works | +-------------------------------------------------------+ | MSVC++ (http://www.microsoft.com) | +-------------------------------------------------------+ | 6.0 | , /EHsc | works | | .NET 2002 (7.0) | , /EHsc | works | | .NET 2003 (7.1) | , /EHsc | works | | 2005 (8.0) | , /EHsc | works | | 2008 (9.0) | , /EHsc | works | | 2010 (10.0) | , /EHsc | works | | 2012 (11.0) | , /EHsc | works | | 2013 (12.0) | , /EHsc | works | +-------------------------------------------------------+ | Borland C++ (http://www.borland.com) | +-------------------------------------------------------+ | 5.5 | | works | +-------------------------------------------------------+ | Open Watcom (http://www.openwatcom.org) | +-------------------------------------------------------+ | 1.0 | | broken | | 1.1 | | broken | | 1.2 | | broken | | 1.3 | | broken | | 1.4 | | works | | 1.5 | | works | | 1.6 | | works | | 1.7 | | works | | 1.8 | | works | | 1.9 | | works | +-------------------------------------------------------+ | Clang (http://clang.llvm.org/) | +-------------------------------------------------------+ | 2.6 | , -fno-exceptions | works | | 2.7 | , -fno-exceptions | works | | 2.8 | , -fno-exceptions | works | | 2.9 | , -fno-exceptions | works | | 3.0 | , -fno-exceptions | works | | 3.1 | , -fno-exceptions | works | | 3.2 | , -fno-exceptions | works | | 3.3 | , -fno-exceptions | works | | 3.4.x | , -fno-exceptions | works | | 3.5.x | , -fno-exceptions | works | | 3.6.x | , -fno-exceptions | works | | 3.7.x | , -fno-exceptions | works | | 3.8.x | , -fno-exceptions | works | | 3.9.x | , -fno-exceptions | works | | 4.0.x | , -fno-exceptions | works | | 5.0.x | , -fno-exceptions | works | | 6.0.x | , -fno-exceptions | works | | 7.x | , -fno-exceptions | works | | 8.x | , -fno-exceptions | works | +-------------------------------------------------------+ | Digital Mars C++ (http://www.digitalmars.com/) | +-------------------------------------------------------+ | 7.7B1n | , -Ae | broken | | 8.1B5n | , -Ae | broken | | 8.20n | , -Ae | broken | | 8.28.5n | , -Ae | broken | | 8.29.21n | , -Ae | works | | 8.30.11n | , -Ae | works | | 8.40.2n | , -Ae | works | | 8.52.5n | , -Ae | works | | 8.57.0n | , -Ae | works | +-------------------------------------------------------+