What is xTests?
xTests is a testing library for C and C++. More specifically, it is a small, lightweight, portable, simple unit- and component-test framework suitable for exercising C and C++ libraries. Its primary design features are:
xTests is written in C and C++, and presents a simple C API, and a more sophisticated C++ API.
xTests is released under the BSD license, which basically means its free for any use, but you can't claim it's yours.
xTests works on with many compilers, is platform independent, and requires only one other library.
xTests itself is a platform-independent library. It has been tested and used on both UNIX and Windows - in principle, it should work on any operating system for which a (reasonably modern) C++ compiler exists.
xTests is written in standard C/C++, and should be compilable with any modern C/C++ compiler that provides an implementation of the C & C++ standard libraries.
- Portability. It relies on no platform-specific or compiler-specific constructs. The only library it relies on is the 100% header-only, open-source STLSoft library. It works with a large number of C/C++ compilers. Importantly, it is sufficiently simple and lightweight that it is bundled with several other open-source libraries, and is an integral part of the automated unit- and component-testing in their builds.
- Simplicity. It doesn't require pre-processing of your source code by scripting languages. It doesn't use macros to create secret classes that use Schwarz counters to register test cases. It relies on you to simply code what you want, and nothing that you don't want.
xTests has been built and tested with the following compilers:
- Borland C/C++ 5.5.1
- Borland C/C++ 5.6
- Borland C/C++ 5.6.4
- Metrowerks CodeWarrior 8
- Comeau C++ 4.3.3
- Digital Mars 8.50+
- GNU C/C++ 3.2
- GNU C/C++ 3.3
- GNU C/C++ 3.3
- GNU C/C++ 4.0
- Intel C/C++ 6.0
- Intel C/C++ 7.0
- Intel C/C++ 8.0
- Visual C++ 6.0
- Visual C++ 7.0
- Visual C++ 7.1
- Visual C++ 8.0
If you wish to use xTests with a compiler not listed here, you may find the STLSoft header file will issue a
xTests is dependent on the STLSoft libraries, version 1.9.23, or later.
#error informing you that your chosen compiler is not supported. This can be overriden by defining the pre-processor symbol
_STLSOFT_FORCE_ANY_COMPILER. If you do that, your compiler will be expected to be pretty standards compliant (though nothing that's particularly out-of-this-world, such as
export). If you run into any issues with using xTests/STLSoft with such a compiler, we'd be happy to hear from you on the STLSoft newsgroup.
STLSoft provides the following important features:
- Compiler feature discrimination, standard library feature discrimination, various STL extension algorithms and iterator adaptors.
- Efficient memory management components.
- Extended limits classes and meta-programming components.
- Extended string manipulation functions.
Because STLSoft is 100% header-only, there is no need to build anything in order to use STLSoft with xTests. Simply define the
xTests is written by Matthew Wilson, author of the books Imperfect C++ and Extended STL, volume 1, and the STLSoft, Pantheios, and FastFormat libraries.
STLSOFT environment variable, as described in the STLSoft distribution.