WinUnit Compatibility API
Table of Contents
As an optional component, cfix provides source compatibility to WinUnit 1.0.1125.0. That is, existing source code targeting the WinUnit API can be recompiled into a valid, full-fledged cfix test suite.
Note that like WinUnit itself, the cfix compatibility API for WinUnit requires at least cl version 14.00 (Visual Studio 2005). cl 13.00 (VisualStudio 2003) an earlier versions are not supported.
The cfix include directory includes a file winunit.h that serves as a surrogate for WinUnit's winunit.h. When building your test suite, make sure to update the compiler's include path so that it uses this header instead of the original WinUnit header file:
- Add the cfix include directory (%CFIX_HOME%\include) to the include path.
- Remove the WinUnit include directory from the include path.
Once built, the resulting DLL will be a valid cfix test DLL.
The following differences and limitations regarding WinUnit compatibility apply:
- When comparing floats and doubles, the same relaxed precision equality checks are employed as in CFIXCC_ASSERT_EQUALS. That is, two floating point values are considered equal if their diviation is below a certain threshold, which is expressed in units in the last place (ULP).
- The class Winunit::Assert is not supported. As the WinUnit documentation states, direct usage of this class should be avoided in favor of the corresponding WIN_ASSERT* macros.
- The cfix implementation of WIN_ASSERT_EQUAL compares C strings (i.e. PSTR, PCSTR, PWSTR, PCWSTR) by value. WinUnit, in contrast, compares these by identity. However, this restriction usually is not of concern as WIN_ASSERT_STRING_EQUAL should be used for string equality checks.
- cfix accepts UNICODE and ANSI strings for all APIs and is thus more forgiving than WinUnit, which relies on _UNICODE to be defined or not.
- Custom loggers are not supported.
In case you experience further, unforeseen incompatibilities, please report to passing at users.sourceforge.net.