Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

xtests/xtests.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        xtests/xtests.h (formerly part of Synesis' internal test codebase)
00003  *
00004  * Purpose:     Main header file for xTests, a simple unit/component-testing
00005  *              library.
00006  *
00007  * Created:     20th June 1999
00008  * Updated:     20th January 2010
00009  *
00010  * Home:        http://stlsoft.org/
00011  *
00012  * Copyright (c) 1999-2010, Matthew Wilson and Synesis Software
00013  * All rights reserved.
00014  *
00015  * Redistribution and use in source and binary forms, with or without
00016  * modification, are permitted provided that the following conditions are
00017  * met:
00018  *
00019  * - Redistributions of source code must retain the above copyright notice,
00020  *   this list of conditions and the following disclaimer.
00021  * - Redistributions in binary form must reproduce the above copyright
00022  *   notice, this list of conditions and the following disclaimer in the
00023  *   documentation and/or other materials provided with the distribution.
00024  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00025  *   names of any contributors may be used to endorse or promote products
00026  *   derived from this software without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00029  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00030  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00031  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00032  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00033  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00034  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00035  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00036  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00037  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00038  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  * ////////////////////////////////////////////////////////////////////// */
00041 
00042 
00048 #ifndef XTESTS_INCL_XTESTS_H_XTESTS
00049 #define XTESTS_INCL_XTESTS_H_XTESTS
00050 
00051 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
00052 # define XTESTS_VER_XTESTS_H_XTESTS_MAJOR       3
00053 # define XTESTS_VER_XTESTS_H_XTESTS_MINOR       28
00054 # define XTESTS_VER_XTESTS_H_XTESTS_REVISION    4
00055 # define XTESTS_VER_XTESTS_H_XTESTS_EDIT        290
00056 #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
00057 
00058 /* /////////////////////////////////////////////////////////////////////////
00059  * Version information
00060  */
00061 
00076 #define _XTESTS_VER_MAJOR       0
00077 #define _XTESTS_VER_MINOR       14
00078 #define _XTESTS_VER_REVISION    4
00079 
00080 #define _XTESTS_VER             0x000e04ff
00081 
00082 /* /////////////////////////////////////////////////////////////////////////
00083  * Includes - 1
00084  */
00085 
00086 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00087 # include <stlsoft/stlsoft.h>
00088 #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
00089 
00090 /* /////////////////////////////////////////////////////////////////////////
00091  * Compatibility
00092  */
00093 
00094 #if _STLSOFT_VER < 0x010959ff
00095 # error xTests requires version 1.9.89 (or later) of STLSoft; download from www.stlsoft.org
00096 #endif /* _STLSOFT_VER */
00097 
00098 #if defined(STLSOFT_COMPILER_IS_WATCOM)
00099 # define _XTESTS_NO_CPP_API
00100 #endif /* compiler */
00101 
00102 /* /////////////////////////////////////////////////////////////////////////
00103  * Includes - 2
00104  */
00105 
00106 #ifdef __cplusplus
00107 # include <platformstl/platformstl.h>
00108 # if defined(PLATFORMSTL_OS_IS_UNIX)
00109  /* We include threading.h to prevent the definition of _REENTRANT standard
00110   * headers on some UNIX operating systems from confusing the feature
00111   * discrimination in UNIXSTL and having it think that we're multithreading
00112   * when we're not.
00113   */
00114 #  include <unixstl/synch/util/features.h>
00115 # elif defined(PLATFORMSTL_OS_IS_WINDOWS)
00116 # endif /* PLATFORMSTL_OS_IS_???? */
00117 # if !defined(_XTESTS_NO_CPP_API)
00118 #  ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_INTEGRAL_TYPE
00119 #   include <stlsoft/meta/is_integral_type.hpp>
00120 #  endif /* !STLSOFT_INCL_STLSOFT_META_HPP_IS_INTEGRAL_TYPE */
00121 #  ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_SAME_TYPE
00122 #   include <stlsoft/meta/is_same_type.hpp>
00123 #  endif /* !STLSOFT_INCL_STLSOFT_META_HPP_IS_SAME_TYPE */
00124 #  ifndef STLSOFT_INCL_STLSOFT_META_HPP_SELECT_FIRST_TYPE_IF
00125 #   include <stlsoft/meta/select_first_type_if.hpp>
00126 #  endif /* !STLSOFT_INCL_STLSOFT_META_HPP_SELECT_FIRST_TYPE_IF */
00127 #  ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00128 #   include <stlsoft/shims/access/string.hpp>
00129 #  endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
00130 # endif /* !_XTESTS_NO_CPP_API */
00131 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
00132 #  include <new>
00133 #  include <stdexcept>
00134 # endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
00135 # if defined(STLSOFT_CF_RTTI_SUPPORT)
00136 #  include <typeinfo>
00137 # endif /* STLSOFT_CF_RTTI_SUPPORT */
00138 #endif /* __cplusplus */
00139 
00140 #include <stdio.h>
00141 
00142 /* /////////////////////////////////////////////////////////////////////////
00143  * Namespace
00144  */
00145 
00146 #if defined(_STLSOFT_NO_NAMESPACE)
00147 # define _XTESTS_NO_NAMESPACE
00148 #endif /* _STLSOFT_NO_NAMESPACE */
00149 
00150 #ifndef _XTESTS_NO_NAMESPACE
00151 namespace xtests
00152 {
00153 namespace c
00154 {
00155 #endif /* !_XTESTS_NO_NAMESPACE */
00156 
00157 /* /////////////////////////////////////////////////////////////////////////
00158  * Features
00159  */
00160 
00161 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
00162 
00163 # ifndef XTESTS_CALL
00164 #  ifdef __cplusplus
00165 #   define XTESTS_CALL(x)                   extern "C" x
00166 #  else /* ? __cplusplus */
00167 #   define XTESTS_CALL(x)                   extern x
00168 #  endif /* __cplusplus */
00169 # endif /* !XTESTS_CALL */
00170 
00171 # ifdef STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT
00172 #  define XTESTS_GET_FUNCTION_()            __FUNCTION__
00173 # else /* ? STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT */
00174 #  define XTESTS_GET_FUNCTION_()            stlsoft_static_cast(char const*, 0)
00175 # endif /* STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT */
00176 
00177 # ifndef _XTESTS_NO_NAMESPACE
00178 #  define XTESTS_NS_QUAL(ns, sym)           ns::sym
00179 # else /* ? _XTESTS_NO_NAMESPACE */
00180 #  define XTESTS_NS_QUAL(ns, sym)           sym
00181 # endif /* _XTESTS_NO_NAMESPACE */
00182 
00183 # define XTESTS_NS_C_QUAL(sym)              XTESTS_NS_QUAL(xtests::c, sym)
00184 # define XTESTS_NS_CPP_QUAL(sym)            XTESTS_NS_QUAL(xtests::c::cpp, sym)
00185 
00186 # ifdef STLSOFT_CF_RTTI_SUPPORT
00187 #  define XTESTS_REPORT_EXCEPTION_(x)       XTESTS_NS_C_QUAL(xtests_caseExcepted)(typeid(x).name(), x.what())
00188 # else /* ? STLSOFT_CF_RTTI_SUPPORT */
00189 #  define XTESTS_REPORT_EXCEPTION_(x)       XTESTS_NS_C_QUAL(xtests_caseExcepted)("<exception-type unknown: rtti not available>", x.what())
00190 # endif /* STLSOFT_CF_RTTI_SUPPORT */
00191 
00192 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
00193 
00194 #  define XTESTS_INVOKE_TEST_CASE_FN_(fn, name)                                         \
00195                                                                                         \
00196     do                                                                                  \
00197     {                                                                                   \
00198         try                                                                             \
00199         {                                                                               \
00200             (*fn)();                                                                    \
00201         }                                                                               \
00202         catch(std::bad_alloc& x)                                                        \
00203         {                                                                               \
00204             XTESTS_REPORT_EXCEPTION_(x);                                                \
00205                                                                                         \
00206             throw;                                                                      \
00207         }                                                                               \
00208         catch(XTESTS_NS_CPP_QUAL(requirement_failed_exception)& /* x */)                \
00209         {                                                                               \
00210         }                                                                               \
00211         catch(std::exception& x)                                                        \
00212         {                                                                               \
00213             XTESTS_REPORT_EXCEPTION_(x);                                                \
00214         }                                                                               \
00215     } while(0)
00216 
00217 #  define XTESTS_INVOKE_TEST_CASE_FN_THROWS_(fn, name, type)                            \
00218                                                                                         \
00219     do                                                                                  \
00220     {                                                                                   \
00221         try                                                                             \
00222         {                                                                               \
00223             (*fn)();                                                                    \
00224                                                                                         \
00225             XTESTS_NS_C_QUAL(xtests_caseExceptionExpected)(#type);                      \
00226         }                                                                               \
00227         catch(XTESTS_NS_CPP_QUAL(requirement_failed_exception)& /* x */)                \
00228         {                                                                               \
00229         }                                                                               \
00230         catch(type& /* x */)                                                            \
00231         {                                                                               \
00232             XTESTS_TEST_PASSED();                                                       \
00233         }                                                                               \
00234         catch(std::bad_alloc& x)                                                        \
00235         {                                                                               \
00236             XTESTS_REPORT_EXCEPTION_(x);                                                \
00237                                                                                         \
00238             throw;                                                                      \
00239         }                                                                               \
00240         catch(std::exception& x)                                                        \
00241         {                                                                               \
00242             XTESTS_REPORT_EXCEPTION_(x);                                                \
00243         }                                                                               \
00244     } while(0)
00245 
00246 # else /* ? STLSOFT_CF_EXCEPTION_SUPPORT */
00247 
00248 #  define XTESTS_INVOKE_TEST_CASE_FN_(fn, name)  (*fn)()
00249 
00250 # endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
00251 
00252 
00253 
00254 # if defined(STLSOFT_COMPILER_IS_DMC)
00255 #  define XTESTS_INVOKE_c_str_data_a_(x)        stlsoft_ns_qual(c_str_data_a)(x)
00256 #  define XTESTS_INVOKE_c_str_data_w_(x)        stlsoft_ns_qual(c_str_data_w)(x)
00257 #  define XTESTS_INVOKE_c_str_len_a_(x)         stlsoft_ns_qual(c_str_len_a)(x)
00258 #  define XTESTS_INVOKE_c_str_len_w_(x)         stlsoft_ns_qual(c_str_len_w)(x)
00259 #  define XTESTS_INVOKE_c_str_ptr_a_(x)         stlsoft_ns_qual(c_str_ptr_a)(x)
00260 #  define XTESTS_INVOKE_c_str_ptr_w_(x)         stlsoft_ns_qual(c_str_ptr_w)(x)
00261 # elif defined(STLSOFT_COMPILER_IS_GCC)
00262 #  define XTESTS_INVOKE_c_str_data_a_(x)        c_str_data_a(x)
00263 #  define XTESTS_INVOKE_c_str_data_w_(x)        c_str_data_w(x)
00264 #  define XTESTS_INVOKE_c_str_len_a_(x)         c_str_len_a(x)
00265 #  define XTESTS_INVOKE_c_str_len_w_(x)         c_str_len_w(x)
00266 #  define XTESTS_INVOKE_c_str_ptr_a_(x)         c_str_ptr_a(x)
00267 #  define XTESTS_INVOKE_c_str_ptr_w_(x)         c_str_ptr_w(x)
00268 # else /* ? compiler */
00269 #  define XTESTS_INVOKE_c_str_data_a_(x)        c_str_data_a(x)
00270 #  define XTESTS_INVOKE_c_str_data_w_(x)        c_str_data_w(x)
00271 #  define XTESTS_INVOKE_c_str_len_a_(x)         c_str_len_a(x)
00272 #  define XTESTS_INVOKE_c_str_len_w_(x)         c_str_len_w(x)
00273 #  define XTESTS_INVOKE_c_str_ptr_a_(x)         c_str_ptr_a(x)
00274 #  define XTESTS_INVOKE_c_str_ptr_w_(x)         c_str_ptr_w(x)
00275 # endif /* compiler */
00276 
00277 
00278 
00279 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
00280     (   _MSC_VER >= 1500 || \
00281         (   _MSC_VER >= 1400 && \
00282             defined(_MSC_FULL_VER) && \
00283             _MSC_FULL_VER >= 140050320))
00284 #define XTESTS_DECLARE_DEPRECATION(symtype, oldfn, newfn)    __declspec(deprecated("The " symtype " " STLSOFT_STRINGIZE(oldfn) " is deprecated and will be removed from a future version of xTests; use " STLSOFT_STRINGIZE(newfn) " instead"))
00285 #define XTESTS_CALL_DEPRECATED(rt, oldfn, newfn)             XTESTS_DECLARE_DEPRECATION("function", oldfn, newfn) XTESTS_CALL(rt)
00286 #else /* ? compiler */
00287 #define XTESTS_DECLARE_DEPRECATION(symtype, oldfn, newfn)
00288 #define XTESTS_CALL_DEPRECATED(rt, oldfn, newfn)             XTESTS_CALL(rt)
00289 #endif /* compiler */
00290 
00291 
00292 
00293 #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
00294 
00295 /* /////////////////////////////////////////////////////////////////////////
00296  * Constants & definitions
00297  */
00298 
00309 enum xtests_runner_flags_t
00310 {
00311         xtestsRunnerFlagsNoWindowsDebugString   =   0x0001
00312     ,   xtestsReportOnlyNonEmptyCases           =   0x0002
00313 };
00314 #ifndef __cplusplus
00315 typedef enum xtests_runner_flags_t xtests_runner_flags_t;
00316 #endif /* !__cplusplus */
00317 
00322 #define XTESTS_FP_APPROXIMATE_FACTOR                    (1.000001)
00323 
00324 /* /////////////////////////////////////////////////////////////////////////
00325  * Macros
00326  */
00327 
00362 #define XTESTS_START_RUNNER(name, verbosity)                                            \
00363                                                                                         \
00364     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, NULL, 0, NULL, NULL, NULL))
00365 
00366 
00379 #define XTESTS_START_RUNNER_WITH_SETUP_FNS(name, verbosity, setup, teardown, param)     \
00380                                                                                         \
00381     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, NULL, 0, (setup), (teardown), (param)))
00382 
00383 
00397 #define XTESTS_START_RUNNER_WITH_STREAM(name, verbosity, stm)                           \
00398                                                                                         \
00399     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, stm, 0, NULL, NULL, NULL))
00400 
00401 
00417 #define XTESTS_START_RUNNER_WITH_REPORTER(name, verbosity, reporter, reporterParam)     \
00418                                                                                         \
00419     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), NULL, 0, NULL, NULL, NULL))
00420 
00421 
00438 #define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM(name, verbosity, reporter, reporterParam, stm) \
00439                                                                                                     \
00440     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), stm, 0, NULL, NULL, NULL))
00441 
00442 
00461 #define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM_AND_FLAGS(name, verbosity, reporter, reporterParam, stm, flags) \
00462                                                                                                     \
00463     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), (stm), (flags), NULL, NULL, NULL))
00464 
00465 
00488 #define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM_AND_FLAGS_AND_SETUP_FNS(name, verbosity, reporter, reporterParam, stm, flags, setup, teardown, param) \
00489                                                                                                     \
00490     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), (stm), (flags), (setup), (teardown), (param)))
00491 
00492 
00507 #define XTESTS_START_RUNNER_WITH_FLAGS(name, verbosity, flags)                          \
00508                                                                                         \
00509     (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, NULL, (flags), NULL, NULL, NULL))
00510 
00511 
00523 #define XTESTS_PRINT_RESULTS()                                                          \
00524                                                                                         \
00525     XTESTS_NS_C_QUAL(xtests_printRunnerResults)()
00526 
00527 
00534 #define XTESTS_END_RUNNER()                                                             \
00535                                                                                         \
00536     XTESTS_NS_C_QUAL(xtests_endRunner)(NULL)
00537 
00538 
00545 #define XTESTS_ABEND(terminationMessage)                                                \
00546                                                                                         \
00547     XTESTS_NS_C_QUAL(xtests_abend)(terminationMessage)
00548 
00549 
00565 #define XTESTS_END_RUNNER_UPDATE_EXITCODE(retCode)                                      \
00566                                                                                         \
00567     stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_endRunner)(retCode))
00568 
00569 
00570 
00571 
00582 #define XTESTS_CASE_BEGIN(name, desc)                                                   \
00583                                                                                         \
00584     (0 == XTESTS_NS_C_QUAL(xtests_beginTestCase)((name), (desc)))
00585 
00586 
00598 #define XTESTS_CASE_END(name)                                                           \
00599                                                                                         \
00600     stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_endTestCase)((name)))
00601 
00602 
00618 #define XTESTS_RUN_CASE_WITH_NAME_AND_DESC(name, desc, fn)                              \
00619                                                                                         \
00620     do                                                                                  \
00621     {                                                                                   \
00622         if(XTESTS_CASE_BEGIN(name, desc))                                               \
00623         {                                                                               \
00624             XTESTS_INVOKE_TEST_CASE_FN_(fn, name);                                      \
00625                                                                                         \
00626             XTESTS_CASE_END(name);                                                      \
00627         }                                                                               \
00628                                                                                         \
00629     } while(0)
00630 
00631 
00646 #define XTESTS_RUN_CASE_WITH_DESC(fn, desc)                                             \
00647                                                                                         \
00648     XTESTS_RUN_CASE_WITH_NAME_AND_DESC(#fn, desc, fn)
00649                                                                                         \
00663 #define XTESTS_RUN_CASE(fn)                                                             \
00664                                                                                         \
00665     XTESTS_RUN_CASE_WITH_DESC(fn, "")
00666 
00667 
00668 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00669 
00687 # define XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(name, desc, fn, type)           \
00688                                                                                         \
00689     do                                                                                  \
00690     {                                                                                   \
00691         if(XTESTS_CASE_BEGIN(name, desc))                                               \
00692         {                                                                               \
00693             XTESTS_INVOKE_TEST_CASE_FN_THROWS_(fn, name, type);                         \
00694                                                                                         \
00695             XTESTS_CASE_END(name);                                                      \
00696         }                                                                               \
00697                                                                                         \
00698     } while(0)
00699 
00716 # define XTESTS_RUN_CASE_THAT_THROWS_WITH_DESC(fn, desc, type)                          \
00717                                                                                         \
00718     XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(#fn, desc, fn, type)
00719 
00735 # define XTESTS_RUN_CASE_THAT_THROWS(fn, type)                                          \
00736                                                                                         \
00737     XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(#fn, "", fn, type)
00738 
00739 #endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
00740 
00741 
00755 #define XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, qualifier)                                 \
00756                                                                                         \
00757     XTESTS_NS_C_QUAL(xtests_writeFailMessage)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), msg, qualifier)
00758 
00770 #define XTESTS_TEST_FAIL(msg)                                                           \
00771                                                                                         \
00772     XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, stlsoft_static_cast(char const*, NULL))
00773 
00783 #define XTESTS_TEST_PASSED()                                                            \
00784                                                                                         \
00785     XTESTS_NS_C_QUAL(xtests_testPassed)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "")
00786 
00800 #define XTESTS_TEST_WITH_MESSAGE(expr, msg)                                             \
00801                                                                                         \
00802     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00803     ((expr)                                                                             \
00804         ? XTESTS_NS_C_QUAL(xtests_testPassed)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), msg)   \
00805         : XTESTS_NS_C_QUAL(xtests_testFailed)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), msg))
00806 
00818 #define XTESTS_TEST(expr)                                                               \
00819                                                                                         \
00820     XTESTS_TEST_WITH_MESSAGE(expr, #expr)
00821 
00822 
00823 
00838 #define XTESTS_TEST_ENUM_EQUAL(expected, actual)                    XTESTS_TEST_INTEGER_EQUAL_EXACT(stlsoft_static_cast(int, (expected)), stlsoft_static_cast(int, (actual)))
00839 
00854 #define XTESTS_TEST_ENUM_NOT_EQUAL(expected, actual)                XTESTS_TEST_INTEGER_NOT_EQUAL(stlsoft_static_cast(int, (expected)), stlsoft_static_cast(int, (actual)))
00855 
00856 
00857 #if defined(__cplusplus) && \
00858     !defined(_XTESTS_NO_CPP_API)
00859 
00874 # define XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual)                              \
00875                                                                                         \
00876     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00877     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
00878 
00893 # define XTESTS_TEST_INTEGER_NOT_EQUAL(expected, actual)                                \
00894                                                                                         \
00895     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00896     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
00897 
00910 # define XTESTS_TEST_INTEGER_GREATER(expected, actual)                                  \
00911                                                                                         \
00912     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00913     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThan)))
00914 
00927 # define XTESTS_TEST_INTEGER_LESS(expected, actual)                                     \
00928                                                                                         \
00929     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00930     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThan)))
00931 
00945 # define XTESTS_TEST_INTEGER_GREATER_OR_EQUAL(expected, actual)                         \
00946                                                                                         \
00947     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00948     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThanOrEqual)))
00949 
00963 # define XTESTS_TEST_INTEGER_LESS_OR_EQUAL(expected, actual)                            \
00964                                                                                         \
00965     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00966     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThanOrEqual)))
00967 
00968 
00969 
00982 # define XTESTS_TEST_BOOLEAN_EQUAL(expected, actual)                                    \
00983                                                                                         \
00984     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
00985     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
00986 
00999 # define XTESTS_TEST_BOOLEAN_NOT_EQUAL(expected, actual)                                \
01000                                                                                         \
01001     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01002     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01003 
01015 # define XTESTS_TEST_BOOLEAN_TRUE(actual)                                               \
01016                                                                                         \
01017     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01018     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", true, (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01019 
01031 # define XTESTS_TEST_BOOLEAN_FALSE(actual)                                               \
01032                                                                                         \
01033     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01034     XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", false, (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01035 
01036 
01051 # define XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual)                            \
01052                                                                                         \
01053     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01054     XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01055 
01070 # define XTESTS_TEST_CHARACTER_NOT_EQUAL(expected, actual)                              \
01071                                                                                         \
01072     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01073     XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01074 
01087 # define XTESTS_TEST_CHARACTER_GREATER(expected, actual)                                \
01088                                                                                         \
01089     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01090     XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThan)))
01091 
01104 # define XTESTS_TEST_CHARACTER_LESS(expected, actual)                                   \
01105                                                                                         \
01106     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01107     XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThan)))
01108 
01122 # define XTESTS_TEST_CHARACTER_GREATER_OR_EQUAL(expected, actual)                       \
01123                                                                                         \
01124     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01125     XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThanOrEqual)))
01126 
01140 # define XTESTS_TEST_CHARACTER_LESS_OR_EQUAL(expected, actual)                          \
01141                                                                                         \
01142     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01143     XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThanOrEqual)))
01144 
01145 
01146 
01159 # define XTESTS_TEST_FLOATINGPOINT_EQUAL_EXACT(expected, actual)                        \
01160                                                                                         \
01161     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01162     XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01163 
01176 # define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_EXACT(expected, actual)                    \
01177                                                                                         \
01178     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01179     XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01180 
01194 # define XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual)                       \
01195                                                                                         \
01196     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01197     XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01198 
01212 # define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_APPROX(expected, actual)                   \
01213                                                                                         \
01214     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01215     XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01216 
01217 
01218 
01219 
01220 /* Requiring tests
01221  *
01222  * These cause an exception of type XXXXX to be thrown if the condition
01223  * fails, thereby preventing the execution of any further tests that
01224  * may cause program failure (and thereby prevent the 
01225  */
01226 
01238 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
01239 #  define XTESTS_REQUIRE(test)                                          XTESTS_NS_CPP_QUAL(xtests_require)(!(!(test)))
01240 # else /* STLSOFT_CF_EXCEPTION_SUPPORT */
01241 #  define XTESTS_REQUIRE(test)                                          XTESTS_NS_CPP_QUAL(xtests_require_C)(!(!(test)))
01242 # endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
01243 
01244 #else /* ? __cplusplus) && !_XTESTS_NO_CPP_API */
01245 
01246 # define XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual)              XTESTS_TEST((expected) == (actual))
01247 # define XTESTS_TEST_INTEGER_NOT_EQUAL(expected, actual)                XTESTS_TEST((expected) != (actual))
01248 # define XTESTS_TEST_INTEGER_GREATER(expected, actual)                  XTESTS_TEST((expected) < (actual))
01249 # define XTESTS_TEST_INTEGER_LESS(expected, actual)                     XTESTS_TEST((expected) > (actual))
01250 # define XTESTS_TEST_INTEGER_GREATER_OR_EQUAL(expected, actual)         XTESTS_TEST((expected) <= (actual))
01251 # define XTESTS_TEST_INTEGER_LESS_OR_EQUAL(expected, actual)            XTESTS_TEST((expected) >= (actual))
01252 
01253 # define XTESTS_TEST_BOOLEAN_EQUAL(expected, actual)                    XTESTS_TEST((expected) == (actual))
01254 # define XTESTS_TEST_BOOLEAN_NOT_EQUAL(expected, actual)                XTESTS_TEST((expected) != (actual))
01255 # define XTESTS_TEST_BOOLEAN_TRUE(actual)                               XTESTS_TEST((actual))
01256 # define XTESTS_TEST_BOOLEAN_FALSE(actual)                              XTESTS_TEST(!(actual))
01257 
01258 # define XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual)            XTESTS_TEST((expected) == (actual))
01259 # define XTESTS_TEST_CHARACTER_NOT_EQUAL(expected, actual)              XTESTS_TEST((expected) != (actual))
01260 # define XTESTS_TEST_CHARACTER_GREATER(expected, actual)                XTESTS_TEST((expected) < (actual))
01261 # define XTESTS_TEST_CHARACTER_LESS(expected, actual)                   XTESTS_TEST((expected) > (actual))
01262 # define XTESTS_TEST_CHARACTER_GREATER_OR_EQUAL(expected, actual)       XTESTS_TEST((expected) <= (actual))
01263 # define XTESTS_TEST_CHARACTER_LESS_OR_EQUAL(expected, actual)          XTESTS_TEST((expected) >= (actual))
01264 
01265 # define XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual)       XTESTS_TEST(xtests_floatingPointClose((expected), (actual)))
01266 # define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_APPROX(expected, actual)   XTESTS_TEST(!xtests_floatingPointClose((expected), (actual)))
01267 
01268 #endif /* __cplusplus) && !_XTESTS_NO_CPP_API */
01269 
01270 
01283 #define XTESTS_TEST_INTEGER_EQUAL(expected, actual)                 XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual)
01284 
01297 #define XTESTS_TEST_FLOATINGPOINT_EQUAL(expected, actual)           XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual)
01298 
01311 #define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL(expected, actual)       XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_APPROX(expected, actual)
01312 
01325 #define XTESTS_TEST_CHARACTER_EQUAL(expected, actual)               XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual)
01326 
01327 
01328 
01341 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL(expected, actual)                            \
01342                                                                                         \
01343     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01344     XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01345 
01359 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_APPROX(expected, actual)                     \
01360                                                                                         \
01361     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01362     XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))
01363 
01376 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL(expected, actual)                        \
01377                                                                                         \
01378     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01379     XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01380 
01394 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_APPROX(expected, actual)                 \
01395                                                                                         \
01396     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01397     XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))
01398 
01412 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_N(expected, actual, n)                       \
01413                                                                                         \
01414     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01415     XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01416 
01431 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_N_APPROX(expected, actual, n)                \
01432                                                                                         \
01433     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01434     XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))
01435 
01449 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_N(expected, actual, n)                   \
01450                                                                                         \
01451     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01452     XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01453 
01468 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_N_APPROX(expected, actual, n)            \
01469                                                                                         \
01470     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01471     XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))
01472 
01473 
01486 #define XTESTS_TEST_WIDE_STRING_EQUAL(expected, actual)                                 \
01487                                                                                         \
01488     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01489     XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01490 
01503 #define XTESTS_TEST_WIDE_STRING_EQUAL_APPROX(expected, actual)                          \
01504                                                                                         \
01505     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01506     XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))
01507 
01520 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL(expected, actual)                             \
01521                                                                                         \
01522     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01523     XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01524 
01538 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_APPROX(expected, actual)                        \
01539                                                                                         \
01540     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01541     XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))
01542 
01556 #define XTESTS_TEST_WIDE_STRING_EQUAL_N(expected, actual, n)                            \
01557                                                                                         \
01558     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01559     XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01560 
01575 #define XTESTS_TEST_WIDE_STRING_EQUAL_N_APPROX(expected, actual, n)                     \
01576                                                                                         \
01577     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01578     XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))
01579 
01593 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_N(expected, actual, n)                        \
01594                                                                                         \
01595     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01596     XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01597 
01611 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_N_APPROX(expected, actual, n)                 \
01612                                                                                         \
01613     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01614     XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))
01615 
01616 
01617 
01630 #define XTESTS_TEST_MULTIBYTE_STRING_CONTAIN(expected, actual)                          \
01631                                                                                         \
01632     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01633     XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01634 
01648 #define XTESTS_TEST_MULTIBYTE_STRING_CONTAIN_APPROX(expected, actual)                   \
01649                                                                                         \
01650     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01651     XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))
01652 
01665 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_CONTAIN(expected, actual)                      \
01666                                                                                         \
01667     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01668     XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01669 
01683 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_CONTAIN_APPROX(expected, actual)               \
01684                                                                                         \
01685     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01686     XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))
01687 
01688 
01689 
01702 #define XTESTS_TEST_WIDE_STRING_CONTAIN(expected, actual)                               \
01703                                                                                         \
01704     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01705     XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01706 
01720 #define XTESTS_TEST_WIDE_STRING_CONTAIN_APPROX(expected, actual)                        \
01721                                                                                         \
01722     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01723     XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))
01724 
01737 #define XTESTS_TEST_WIDE_STRING_NOT_CONTAIN(expected, actual)                           \
01738                                                                                         \
01739     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01740     XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01741 
01754 #define XTESTS_TEST_WIDE_STRING_NOT_CONTAIN_APPROX(expected, actual)                    \
01755                                                                                         \
01756     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01757     XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))
01758 
01759 
01760 
01773 #define XTESTS_TEST_POINTER_EQUAL(expected, actual)                                     \
01774                                                                                         \
01775     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01776     XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))
01777 
01792 # define XTESTS_TEST_POINTER_NOT_EQUAL(expected, actual)                                \
01793                                                                                         \
01794     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01795     XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))
01796 
01809 # define XTESTS_TEST_POINTER_GREATER(expected, actual)                                  \
01810                                                                                         \
01811     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01812     XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThan))
01813 
01826 # define XTESTS_TEST_POINTER_LESS(expected, actual)                                     \
01827                                                                                         \
01828     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01829     XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThan))
01830 
01844 # define XTESTS_TEST_POINTER_GREATER_OR_EQUAL(expected, actual)                         \
01845                                                                                         \
01846     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01847     XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThanOrEqual))
01848 
01862 # define XTESTS_TEST_POINTER_LESS_OR_EQUAL(expected, actual)                            \
01863                                                                                         \
01864     !XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) &&                           \
01865     XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThanOrEqual))
01866 
01867 
01868 /* /////////////////////////////////////////////////////////////////////////
01869  * Helper functions
01870  */
01871 
01872 #ifdef __cplusplus
01873 # if !defined(_XTESTS_NO_CPP_API)
01874 #  ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
01875 
01876 /* c_str_len_n_X(s, n)
01877  *
01878  * prevents len-limited strlen() from overstepping
01879  */
01880 
01881 inline size_t c_str_len_n_a(char const* s, size_t n)
01882 {
01883     size_t len = 0;
01884 
01885     for(; '\0' != *s && len != n; ++s, ++len)
01886     {}
01887 
01888     return len;
01889 }
01890 
01891 inline size_t c_str_len_n_w(wchar_t const* s, size_t n)
01892 {
01893     size_t len = 0;
01894 
01895     for(; '\0' != *s && len != n; ++s, ++len)
01896     {}
01897 
01898     return len;
01899 }
01900 
01901 template <typename S>
01902 inline size_t c_str_len_n_a(S const& s, size_t n)
01903 {
01904     stlsoft_ns_using(c_str_len_a);
01905 
01906     size_t len = XTESTS_INVOKE_c_str_len_a_(s);
01907 
01908     return (len < n) ? len : n;
01909 }
01910 
01911 template <typename S>
01912 inline size_t c_str_len_n_w(S const& s, size_t n)
01913 {
01914     stlsoft_ns_using(c_str_len_w);
01915 
01916     size_t len = XTESTS_INVOKE_c_str_len_w_(s);
01917 
01918     return (len < n) ? len : n;
01919 }
01920 
01921 #  endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
01922 # endif /* !_XTESTS_NO_CPP_API */
01923 #endif /* __cplusplus */
01924 
01925 /* /////////////////////////////////////////////////////////////////////////
01926  * API functions
01927  */
01928 
01945 enum xtests_verbosity_t
01946 {
01947         XTESTS_VERBOSITY_SILENT                       =   -1  
01948     ,   XTESTS_VERBOSITY_RUNNER_SUMMARY_ON_ERROR      =   0   
01949     ,   XTESTS_VERBOSITY_RUNNER_SUMMARY               =   1   
01950     ,   XTESTS_VERBOSITY_FIRST_CASE_SUMMARY_ON_ERROR  =   2   
01951     ,   XTESTS_VERBOSITY_CASE_SUMMARY_ON_ERROR        =   3   
01952     ,   XTESTS_VERBOSITY_CASE_SUMMARY                 =   4   
01954     ,   XTESTS_VERBOSITY_VERBOSE                      =   9   
01955 };
01956 #ifndef __cplusplus
01957 typedef enum xtests_verbosity_t xtests_verbosity_t;
01958 #endif /* !__cplusplus */
01959 
01960 
01961 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
01962 
01963 enum xtests_comparison_t
01964 {
01965     /* NOTE: NEVER CHANGE THE ORDER OF THESE ENUMERATORS !!!!!!!!!!! */
01966 
01967         xtestsComparisonEqual               =   0
01968     ,   xtestsComparisonNotEqual
01969     ,   xtestsComparisonGreaterThan
01970     ,   xtestsComparisonLessThan
01971     ,   xtestsComparisonGreaterThanOrEqual
01972     ,   xtestsComparisonLessThanOrEqual
01973     ,   xtestsComparisonApproxEqual
01974     ,   xtestsComparisonApproxNotEqual
01975 
01976     /* NOTE: NEVER CHANGE THE ORDER OF THESE ENUMERATORS !!!!!!!!!!! */
01977 
01978     ,   xtestsComparison_max_enumerator
01979 
01980 };
01981 # ifndef __cplusplus
01982 typedef enum xtests_comparison_t xtests_comparison_t;
01983 # endif /* !__cplusplus */
01984 
01985 
01986 # ifdef __cplusplus
01987 
01988 enum xtests_variable_type_t
01989 {
01990         xtestsVariableNone                  =   0
01991     ,   xtestsVariableBoolean               =   1
01992     ,   xtestsVariableOpaquePointer         =   3
01993     ,   xtestsVariableMultibyteCharacter    =   5
01994     ,   xtestsVariableWideCharacter         =   6
01995     ,   xtestsVariableMultibyteString       =   7
01996     ,   xtestsVariableWideString            =   8
01997     ,   xtestsVariableSignedChar            =   11
01998     ,   xtestsVariableUnsignedChar          =   12
01999     ,   xtestsVariableShort                 =   13
02000     ,   xtestsVariableUnsignedShort         =   14
02001     ,   xtestsVariableInt                   =   15
02002     ,   xtestsVariableUnsignedInt           =   16
02003     ,   xtestsVariableLong                  =   17
02004     ,   xtestsVariableUnsignedLong          =   18
02005 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02006     ,   xtestsVariableLongLong              =   19
02007     ,   xtestsVariableUnsignedLongLong      =   20
02008 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
02009     ,   xtestsVariableDouble                =   31
02010 };
02011 #ifndef __cplusplus
02012 typedef enum xtests_variable_type_t xtests_variable_type_t;
02013 #endif /* !__cplusplus */
02014 
02015 enum xtests_test_type_t
02016 {
02017         xtestsTestFullComparison            =   0
02018     ,   xtestsTestPartialComparison         =   1
02019     ,   xtestsTestContainment               =   2
02020 };
02021 #ifndef __cplusplus
02022 typedef enum xtests_test_type_t xtests_test_type_t;
02023 #endif /* !__cplusplus */
02024 
02025 union xtests_variable_value_t
02026 {
02027     int                             booleanValue;
02028     int                             intValue;
02029     unsigned int                    uintValue;
02030     long                            longValue;
02031     unsigned long                   ulongValue;
02032 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02033     stlsoft_ns_qual(ss_sint64_t)    longlongValue;
02034     stlsoft_ns_qual(ss_uint64_t)    ulonglongValue;
02035 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
02036     char                            multibyteCharacterValue;
02037     wchar_t                         wideCharacterValue;
02038     char const*                     multibyteStringValue;
02039     wchar_t const*                  wideStringValue;
02040     double                          doubleValue;
02041     void const volatile*            opaquePointerValue;
02042 
02043     explicit xtests_variable_value_t(bool b);
02044     explicit xtests_variable_value_t(char ch);
02045     explicit xtests_variable_value_t(wchar_t ch, xtests_variable_type_t type /* = xtestsVariableMultibyteCharacter */);
02046     explicit xtests_variable_value_t(signed   int i);
02047     explicit xtests_variable_value_t(unsigned int i);
02048     explicit xtests_variable_value_t(signed   long i);
02049     explicit xtests_variable_value_t(unsigned long i);
02050 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02051     explicit xtests_variable_value_t(stlsoft_ns_qual(ss_sint64_t) const& i);
02052     explicit xtests_variable_value_t(stlsoft_ns_qual(ss_uint64_t) const& i);
02053 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
02054     explicit xtests_variable_value_t(char const* s);
02055     explicit xtests_variable_value_t(wchar_t const* s);
02056     explicit xtests_variable_value_t(char const* s, size_t n);
02057     explicit xtests_variable_value_t(wchar_t const* s, size_t n);
02058     explicit xtests_variable_value_t(double const& d);
02059     explicit xtests_variable_value_t(void const volatile* pv);
02060 };
02061 #ifndef __cplusplus
02062 typedef union xtests_variable_value_t xtests_variable_value_t;
02063 #endif /* !__cplusplus */
02064 
02065 struct xtests_variable_t
02066 {
02067     xtests_variable_type_t  variableType;
02068     xtests_test_type_t      testType;
02069     xtests_variable_value_t value;
02070     size_t                  valueLen;
02071 
02072 public:
02073     explicit xtests_variable_t(char ch);
02074     explicit xtests_variable_t(wchar_t ch, xtests_variable_type_t type /* = xtestsVariableMultibyteCharacter */);
02075     explicit xtests_variable_t(bool b);
02076     explicit xtests_variable_t(int b, xtests_variable_type_t type /* = xtestsVariableBoolean */);
02077     explicit xtests_variable_t(signed   char i);
02078     explicit xtests_variable_t(unsigned char i);
02079     explicit xtests_variable_t(signed   short i);
02080     explicit xtests_variable_t(unsigned short i);
02081     explicit xtests_variable_t(signed   int i);
02082     explicit xtests_variable_t(unsigned int i);
02083     explicit xtests_variable_t(signed   long i);
02084     explicit xtests_variable_t(unsigned long i);
02085 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02086     explicit xtests_variable_t(stlsoft_ns_qual(ss_sint64_t) const& i);
02087     explicit xtests_variable_t(stlsoft_ns_qual(ss_uint64_t) const& i);
02088 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
02089     explicit xtests_variable_t(char const* s, size_t n, xtests_test_type_t testType = xtestsTestFullComparison);
02090     explicit xtests_variable_t(wchar_t const* s, size_t n, xtests_test_type_t testType = xtestsTestFullComparison);
02091     explicit xtests_variable_t(char const* s, xtests_test_type_t testType = xtestsTestFullComparison);
02092     explicit xtests_variable_t(wchar_t const* s, xtests_test_type_t testType = xtestsTestFullComparison);
02093     explicit xtests_variable_t(double const& d);
02094     explicit xtests_variable_t(void const volatile* pv);
02095 };
02096 #ifndef __cplusplus
02097 typedef union xtests_variable_t xtests_variable_t;
02098 #endif /* !__cplusplus */
02099 
02103 struct xTests_runner_results_t
02104 {
02105     typedef stlsoft_ns_qual(uint32_t)   uint32_t;
02106 
02107     char const*     name;
02108     uint32_t        numCases;
02109     uint32_t        numTests;
02110     uint32_t        numFailedCases;
02111     uint32_t        numFailedTests;
02112     uint32_t        numMissingExpectedExceptions;
02113     uint32_t        numUnexpectedExceptions;
02114 };
02115 
02118 struct xTests_Reporter_t
02119 {
02120 protected:
02121 #  if defined(STLSOFT_COMPILER_IS_GCC)
02122     virtual ~xTests_Reporter_t()
02123     {}
02124 #  else /* ? compiler */
02125     ~xTests_Reporter_t()
02126     {}
02127 private:
02128     virtual void dummy_dtor()
02129     {}
02130 #  endif /* compiler */
02131 
02132 public: /* Overrides */
02133     virtual void onStartRunner(void* reporterParam, char const* name, int verbosity) = 0;
02134 
02135       virtual void onBeginTestCase(void* reporterParam, char const* name, char const* desc, int verbosity) = 0;
02136 
02137         virtual void onTestPassed(void* reporterParam, char const* file, int line, char const* function, char const* expr, xtests_comparison_t comparison, int verbosity) = 0;
02138 
02139         virtual void onTestFailed(void* reporterParam, char const* file, int line, char const* function, char const* expr, xtests_variable_t const* expectedValue, xtests_variable_t const* actualValue, int length, xtests_comparison_t comparison, int verbosity) = 0;
02140 
02141         virtual void onWriteFailMessage(void* reporterParam, char const* file, int line, char const* function, char const* message, char const* qualifyingInformation, int verbosity) = 0;
02142 
02143         virtual void onCaseExcepted(void* reporterParam, char const* caseName, char const* exceptionType, char const* exceptionMessage, int verbosity) = 0;
02144 
02145         virtual void onCaseExceptionExpected(void* reporterParam, char const* caseName, char const* exceptionType, int verbosity) = 0;
02146 
02147       virtual void onEndTestCase(void* reporterParam, char const* name, xTests_runner_results_t const* results, int verbosity) = 0;
02148 
02149       virtual void onPrintRunnerResults(void* reporterParam, xTests_runner_results_t const* results, int verbosity) = 0;
02150 
02151       virtual void onAbend(void* reporterParam, char const* message, int verbosity) = 0;
02152 
02153       virtual void onDefect(void* reporterParam, char const* message, char const* qualifier, int verbosity) = 0;
02154 
02155     virtual void onEndRunner(void* reporterParam, char const* name, int verbosity) = 0;
02156 };
02157 # else /* ? __cplusplus */
02158 struct xTests_Reporter_t;
02159 typedef struct xTests_Reporter_t xTests_Reporter_t;
02160 # endif /* __cplusplus */
02161 
02162 
02163 #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
02164 
02165 typedef int (*xTests_Setup_t)(void*);
02166 typedef int (*xTests_Teardown_t)(void*);
02167 
02168 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
02169 
02170 XTESTS_CALL(int) xtests_startRunner(
02171     char const*         name
02172 ,   int                 verbosity
02173 ,   xTests_Reporter_t*  reporter        /* = NULL => reports to console (fprintf); also reports via OutputDebugString() on windows */
02174 ,   void*               reporterParam   /* = NULL */
02175 ,   FILE*               stm             /* = NULL => stdout */
02176 ,   int                 flags           /* = 0 */
02177 ,   xTests_Setup_t      setup
02178 ,   xTests_Teardown_t   teardown
02179 ,   void*               setupParam
02180 );
02181 
02182 XTESTS_CALL(int) xtests_endRunner(int *retCode);
02183 
02184 XTESTS_CALL(void) xtests_printRunnerResults(void);
02185 
02186 XTESTS_CALL(void) xtests_abend(char const* message);
02187 
02188 
02189 XTESTS_CALL(int) xtests_beginTestCase(
02190     char const* name
02191 ,   char const* desc
02192 );
02193 
02194 XTESTS_CALL(int) xtests_endTestCase(char const* name);
02195 
02196 
02197 XTESTS_CALL(int) xtests_testPassed(
02198     char const* file
02199 ,   int         line
02200 ,   char const* function
02201 ,   char const* expr
02202 );
02203 
02204 XTESTS_CALL(int) xtests_testFailed(
02205     char const* file
02206 ,   int         line
02207 ,   char const* function
02208 ,   char const* expr
02209 );
02210 
02211 XTESTS_CALL(int) xtests_testFailed_int(
02212     char const*         file
02213 ,   int                 line
02214 ,   char const*         function
02215 ,   char const*         expr
02216 ,   int                 expected
02217 ,   int                 actual
02218 ,   xtests_comparison_t comp
02219 );
02220 
02221 XTESTS_CALL(int) xtests_testFailed_long(
02222     char const*         file
02223 ,   int                 line
02224 ,   char const*         function
02225 ,   char const*         expr
02226 ,   long                expected
02227 ,   long                actual
02228 ,   xtests_comparison_t comp
02229 );
02230 XTESTS_CALL(int) xtests_testFailed_ulong(
02231     char const*         file
02232 ,   int                 line
02233 ,   char const*         function
02234 ,   char const*         expr
02235 ,   unsigned long       expected
02236 ,   unsigned long       actual
02237 ,   xtests_comparison_t comp
02238 );
02239 # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02240 XTESTS_CALL(int) xtests_testFailed_longlong(
02241     char const*                     file
02242 ,   int                             line
02243 ,   char const*                     function
02244 ,   char const*                     expr
02245 ,   stlsoft_ns_qual(ss_sint64_t)    expected
02246 ,   stlsoft_ns_qual(ss_sint64_t)    actual
02247 ,   xtests_comparison_t             comp
02248 );
02249 XTESTS_CALL(int) xtests_testFailed_ulonglong(
02250     char const*                     file
02251 ,   int                             line
02252 ,   char const*                     function
02253 ,   char const*                     expr
02254 ,   stlsoft_ns_qual(ss_uint64_t)    expected
02255 ,   stlsoft_ns_qual(ss_uint64_t)    actual
02256 ,   xtests_comparison_t             comp
02257 );
02258 # endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
02259 
02260 XTESTS_CALL(int) xtests_testFailed_boolean(
02261     char const*         file
02262 ,   int                 line
02263 ,   char const*         function
02264 ,   char const*         expr
02265 ,   int                 expected
02266 ,   int                 actual
02267 ,   xtests_comparison_t comp
02268 );
02269 
02270 XTESTS_CALL(int) xtests_testFailed_double(
02271     char const*         file
02272 ,   int                 line
02273 ,   char const*         function
02274 ,   char const*         expr
02275 ,   double              expected
02276 ,   double              actual
02277 ,   xtests_comparison_t comp
02278 );
02279 
02280 XTESTS_CALL(int) xtests_testMultibyteStrings(
02281     char const*         file
02282 ,   int                 line
02283 ,   char const*         function
02284 ,   char const*         expr
02285 ,   char const*         expected
02286 ,   char const*         actual
02287 ,   xtests_comparison_t comp
02288 );
02289 
02290 XTESTS_CALL(int) xtests_testMultibyteStringsN(
02291     char const*         file
02292 ,   int                 line
02293 ,   char const*         function
02294 ,   char const*         expr
02295 ,   char const*         expected
02296 ,   char const*         actual
02297 ,   int                 n /* exact if +ve; limit if -ve */
02298 ,   xtests_comparison_t comp
02299 );
02300 
02301 XTESTS_CALL(int) xtests_testMultibyteStringsN_(
02302     char const*         file
02303 ,   int                 line
02304 ,   char const*         function
02305 ,   char const*         expr
02306 ,   char const*         expected
02307 ,   char const*         actual
02308 ,   int                 n /* exact if +ve; limit if -ve */
02309 ,   size_t              cchExpected
02310 ,   size_t              cchActual
02311 ,   xtests_comparison_t comp
02312 );
02313 
02314 #if defined(__cplusplus) && \
02315     !defined(_XTESTS_NO_CPP_API)
02316 template<   typename S0
02317         ,   typename S1
02318         >
02319 inline int xtests_testMultibyteStrings(
02320     char const*         file
02321 ,   int                 line
02322 ,   char const*         function
02323 ,   char const*         expr
02324 ,   S0 const&           expected
02325 ,   S1 const&           actual
02326 ,   xtests_comparison_t comp
02327 )
02328 {
02329     stlsoft_ns_using(c_str_ptr_a);
02330 
02331     return xtests_testMultibyteStrings(file, line, function, expr, XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(expected)), XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(actual)), comp);
02332 }
02333 
02334 template<   typename S0
02335         ,   typename S1
02336         >
02337 inline int xtests_testMultibyteStringsN(
02338     char const*         file
02339 ,   int                 line
02340 ,   char const*         function
02341 ,   char const*         expr
02342 ,   S0 const&           expected
02343 ,   S1 const&           actual
02344 ,   int                 n /* exact if +ve; limit if -ve */
02345 ,   xtests_comparison_t comp
02346 )
02347 {
02348     stlsoft_ns_using(c_str_data_a);
02349 
02350     return xtests_testMultibyteStringsN_(
02351         file
02352     ,   line
02353     ,   function
02354     ,   expr
02355     ,   XTESTS_INVOKE_c_str_data_a_(XTESTS_INVOKE_c_str_data_a_(expected))
02356     ,   XTESTS_INVOKE_c_str_data_a_(XTESTS_INVOKE_c_str_data_a_(actual))
02357     ,   n
02358     ,   c_str_len_n_a(expected, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02359     ,   c_str_len_n_a(actual, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02360     ,   comp
02361     );
02362 }
02363 #endif /* C++ && !_XTESTS_NO_CPP_API */
02364 
02365 XTESTS_CALL(int) xtests_testWideStrings(
02366     char const*         file
02367 ,   int                 line
02368 ,   char const*         function
02369 ,   char const*         expr
02370 ,   wchar_t const*      expected
02371 ,   wchar_t const*      actual
02372 ,   xtests_comparison_t comp
02373 );
02374 
02375 XTESTS_CALL(int) xtests_testWideStringsN_(
02376     char const*         file
02377 ,   int                 line
02378 ,   char const*         function
02379 ,   char const*         expr
02380 ,   wchar_t const*      expected
02381 ,   wchar_t const*      actual
02382 ,   int                 n /* exact if +ve; limit if -ve */
02383 ,   size_t              cchExpected
02384 ,   size_t              cchActual
02385 ,   xtests_comparison_t comp
02386 );
02387 
02388 XTESTS_CALL(int) xtests_testWideStringsN(
02389     char const*         file
02390 ,   int                 line
02391 ,   char const*         function
02392 ,   char const*         expr
02393 ,   wchar_t const*      expected
02394 ,   wchar_t const*      actual
02395 ,   int                 n /* exact if +ve; limit if -ve */
02396 ,   xtests_comparison_t comp
02397 );
02398 
02399 #if defined(__cplusplus) && \
02400     !defined(_XTESTS_NO_CPP_API)
02401 template<   typename S0
02402         ,   typename S1
02403         >
02404 inline int xtests_testWideStrings(
02405     char const*         file
02406 ,   int                 line
02407 ,   char const*         function
02408 ,   char const*         expr
02409 ,   S0 const&           expected
02410 ,   S1 const&           actual
02411 ,   xtests_comparison_t comp
02412 )
02413 {
02414     stlsoft_ns_using(c_str_ptr_w);
02415 
02416     return xtests_testWideStrings(file, line, function, expr, XTESTS_INVOKE_c_str_ptr_w_(XTESTS_INVOKE_c_str_ptr_w_(expected)), XTESTS_INVOKE_c_str_ptr_w_(XTESTS_INVOKE_c_str_ptr_w_(actual)), comp);
02417 }
02418 
02419 template<   typename S0
02420         ,   typename S1
02421         >
02422 inline int xtests_testWideStringsN(
02423     char const*         file
02424 ,   int                 line
02425 ,   char const*         function
02426 ,   char const*         expr
02427 ,   S0 const&           expected
02428 ,   S1 const&           actual
02429 ,   int                 n /* exact if +ve; limit if -ve */
02430 ,   xtests_comparison_t comp
02431 )
02432 {
02433     stlsoft_ns_using(c_str_data_w);
02434 
02435     return xtests_testWideStringsN_(
02436         file
02437     ,   line
02438     ,   function
02439     ,   expr
02440     ,   XTESTS_INVOKE_c_str_data_w_(XTESTS_INVOKE_c_str_data_w_(expected))
02441     ,   XTESTS_INVOKE_c_str_data_w_(XTESTS_INVOKE_c_str_data_w_(actual))
02442     ,   n
02443     ,   c_str_len_n_w(expected, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02444     ,   c_str_len_n_w(actual, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02445     ,   comp
02446     );
02447 }
02448 #endif /* C++ && !_XTESTS_NO_CPP_API */
02449 
02450 
02451 
02452 
02453 XTESTS_CALL(int) xtests_testMultibyteStringContains(
02454     char const*         file
02455 ,   int                 line
02456 ,   char const*         function
02457 ,   char const*         expr
02458 ,   char const*         expected
02459 ,   char const*         actual
02460 ,   xtests_comparison_t comp
02461 );
02462 
02463 #if defined(__cplusplus) && \
02464     !defined(_XTESTS_NO_CPP_API)
02465 template<   typename S0
02466         ,   typename S1
02467         >
02468 inline int xtests_testMultibyteStringContains(
02469     char const*         file
02470 ,   int                 line
02471 ,   char const*         function
02472 ,   char const*         expr
02473 ,   S0 const&           expected
02474 ,   S1 const&           actual
02475 ,   xtests_comparison_t comp
02476 )
02477 {
02478     stlsoft_ns_using(c_str_ptr_a);
02479 
02480     return xtests_testMultibyteStringContains(file, line, function, expr, XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(expected)), XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(actual)), comp);
02481 }
02482 #endif /* C++ && !_XTESTS_NO_CPP_API */
02483 
02484 XTESTS_CALL(int) xtests_testWideStringContains(
02485     char const*         file
02486 ,   int                 line
02487 ,   char const*         function
02488 ,   char const*         expr
02489 ,   wchar_t const*      expected
02490 ,   wchar_t const*      actual
02491 ,   xtests_comparison_t comp
02492 );
02493 
02494 #if defined(__cplusplus) && \
02495     !defined(_XTESTS_NO_CPP_API)
02496 template<   typename S0
02497         ,   typename S1
02498         >
02499 inline int xtests_testWideStringContains(
02500     char const*         file
02501 ,   int                 line
02502 ,   char const*         function
02503 ,   char const*         expr
02504 ,   S0 const&           expected
02505 ,   S1 const&           actual
02506 ,   xtests_comparison_t comp
02507 )
02508 {
02509     stlsoft_ns_using(c_str_ptr_w);
02510 
02511     return xtests_testWideStringContains(file, line, function, expr, XTESTS_INVOKE_c_str_ptr_w_(XTESTS_INVOKE_c_str_ptr_w_(expected)), XTESTS_INVOKE_c_str_ptr_w_(XTESTS_INVOKE_c_str_ptr_w_(actual)), comp);
02512 }
02513 #endif /* C++ && !_XTESTS_NO_CPP_API */
02514 
02515 
02516 
02517 XTESTS_CALL(int) xtests_testPointers(
02518     char const*             file
02519 ,   int                     line
02520 ,   char const*             function
02521 ,   char const*             expr
02522 ,   void volatile const*    expected
02523 ,   void volatile const*    actual
02524 ,   xtests_comparison_t     comp
02525 );
02526 
02527 XTESTS_CALL(int) xtests_testCharactersA(
02528     char const*             file
02529 ,   int                     line
02530 ,   char const*             function
02531 ,   char const*             expr
02532 ,   char                    expected
02533 ,   char                    actual
02534 ,   xtests_comparison_t     comp
02535 );
02536 XTESTS_CALL(int) xtests_testCharactersW(
02537     char const*             file
02538 ,   int                     line
02539 ,   char const*             function
02540 ,   char const*             expr
02541 ,   wchar_t                 expected
02542 ,   wchar_t                 actual
02543 ,   xtests_comparison_t     comp
02544 );
02545 
02546 XTESTS_CALL(int) xtests_writeFailMessage(
02547     char const* file
02548 ,   int         line
02549 ,   char const* function
02550 ,   char const* message
02551 ,   char const* qualifyingInformation
02552 );
02553 
02554 #if defined(__cplusplus) && \
02555     !defined(_XTESTS_NO_CPP_API)
02556 template<   typename S0
02557         ,   typename S1
02558         >
02559 inline int xtests_writeFailMessage(
02560     char const* file
02561 ,   int         line
02562 ,   char const* function
02563 ,   S0 const&   message
02564 ,   S1 const&   qualifyingInformation
02565 )
02566 {
02567     stlsoft_ns_using(c_str_ptr_a);
02568 
02569     return xtests_writeFailMessage(
02570         file
02571     ,   line
02572     ,   function
02573     ,   XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(message))
02574     ,   XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(qualifyingInformation)));
02575 }
02576 #endif /* C++ && !_XTESTS_NO_CPP_API */
02577 
02578 XTESTS_CALL(void) xtests_caseExcepted(char const* exceptionType, char const* exceptionMessage);
02579 
02580 XTESTS_CALL(void) xtests_caseExceptionExpected(char const* exceptionType);
02581 
02582 
02583 XTESTS_CALL(int) xtests_floatingPointClose(double expected, double actual);
02584 
02593 XTESTS_CALL(double) xtests_setFloatingPointCloseFactor(double factor, double *old /* = NULL */);
02594 
02595 #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
02596 
02597 /* /////////////////////////////////////////////////////////////////////////
02598  * C++-only functionality
02599  */
02600 
02601 #if defined(__cplusplus) && \
02602     !defined(_XTESTS_NO_CPP_API)
02603 
02604 # ifndef _XTESTS_NO_NAMESPACE
02605 namespace cpp
02606 {
02607 # endif /* !_XTESTS_NO_NAMESPACE */
02608 
02609 
02610 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
02611 
02612 class requirement_failed_exception
02613     : public std::runtime_error
02614 {
02615 public:
02616     typedef std::runtime_error              parent_class_type;
02617     typedef requirement_failed_exception    class_type;
02618 
02619 public:
02620     explicit requirement_failed_exception(char const* message)
02621         : parent_class_type(message)
02622     {}
02623 };
02624 
02625 inline void xtests_require(int success)
02626 {
02627     if(!success)
02628     {
02629         throw requirement_failed_exception("XTESTS_REQUIRE()'d test failed");
02630     }
02631 }
02632 
02633 # endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
02634 
02635 class xtest_floatingpoint_factor_scope
02636 {
02637 public:
02638     xtest_floatingpoint_factor_scope(double const& factor)
02639         : m_original(xtests_setFloatingPointCloseFactor(factor, NULL))
02640     {}
02641     ~xtest_floatingpoint_factor_scope() stlsoft_throw_0()
02642     {
02643         xtests_setFloatingPointCloseFactor(m_original, NULL);
02644     }
02645 private:
02646     xtest_floatingpoint_factor_scope(xtest_floatingpoint_factor_scope const&);
02647     xtest_floatingpoint_factor_scope &operator =(xtest_floatingpoint_factor_scope const&);
02648 
02649 private:
02650     const double m_original;
02651 };
02652 
02667 #  define XTESTS_FLOATINGPOINT_FACTOR_SCOPE XTESTS_NS_CPP_QUAL(xtest_floatingpoint_factor_scope)
02668 
02669 
02670 #  ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
02671 
02672 
02673 template <typename T>
02674 struct xtests_failure_reporter;
02675 
02676 template <>
02677 struct xtests_failure_reporter<int>
02678 {
02679     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, int expected, int actual, xtests_comparison_t comp)
02680     {
02681         stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, expected, actual, comp));
02682     }
02683 };
02684 
02685 template <>
02686 struct xtests_failure_reporter<unsigned int>
02687 {
02688     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, unsigned int expected, unsigned int actual, xtests_comparison_t comp)
02689     {
02690         stlsoft_static_cast(void, xtests_testFailed_ulong(file, line, function, expr, static_cast<unsigned long>(expected), static_cast<unsigned long>(actual), comp));
02691     }
02692 };
02693 
02694 template <>
02695 struct xtests_failure_reporter<signed char>
02696 {
02697     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, signed char expected, signed char actual, xtests_comparison_t comp)
02698     {
02699         stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
02700     }
02701 };
02702 
02703 template <>
02704 struct xtests_failure_reporter<unsigned char>
02705 {
02706     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, unsigned char expected, unsigned char actual, xtests_comparison_t comp)
02707     {
02708         stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
02709     }
02710 };
02711 
02712 template <>
02713 struct xtests_failure_reporter<short>
02714 {
02715     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, int expected, int actual, xtests_comparison_t comp)
02716     {
02717         stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
02718     }
02719 };
02720 
02721 template <>
02722 struct xtests_failure_reporter<unsigned short>
02723 {
02724     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, int expected, int actual, xtests_comparison_t comp)
02725     {
02726         stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
02727     }
02728 };
02729 
02730 #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
02731 template <>
02732 struct xtests_failure_reporter<stlsoft::uint32_t>
02733 {
02734     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, stlsoft::uint32_t expected, stlsoft::uint32_t actual, xtests_comparison_t comp)
02735     {
02736         stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, int(expected), int(actual), comp));
02737     }
02738 };
02739 #endif /* STLSOFT_CF_INT_DISTINCT_INT_TYPE */
02740 
02741 template <>
02742 struct xtests_failure_reporter<long>
02743 {
02744     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, long expected, long actual, xtests_comparison_t comp)
02745     {
02746         stlsoft_static_cast(void, xtests_testFailed_long(file, line, function, expr, expected, actual, comp));
02747     }
02748 };
02749 
02750 template <>
02751 struct xtests_failure_reporter<unsigned long>
02752 {
02753     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, unsigned long expected, unsigned long actual, xtests_comparison_t comp)
02754     {
02755         stlsoft_static_cast(void, xtests_testFailed_ulong(file, line, function, expr, expected, actual, comp));
02756     }
02757 };
02758 
02759 #  ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02760 template <>
02761 struct xtests_failure_reporter< stlsoft_ns_qual(ss_sint64_t)>
02762 {
02763     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, stlsoft::sint64_t expected, stlsoft::sint64_t actual, xtests_comparison_t comp)
02764     {
02765         stlsoft_static_cast(void, xtests_testFailed_longlong(file, line, function, expr, expected, actual, comp));
02766     }
02767 };
02768 
02769 template <>
02770 struct xtests_failure_reporter< stlsoft_ns_qual(ss_uint64_t)>
02771 {
02772     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, stlsoft::uint64_t expected, stlsoft::uint64_t actual, xtests_comparison_t comp)
02773     {
02774         stlsoft_static_cast(void, xtests_testFailed_ulonglong(file, line, function, expr, expected, actual, comp));
02775     }
02776 };
02777 #  endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
02778 
02779 template <>
02780 struct xtests_failure_reporter<bool>
02781 {
02782     static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, int expected, int actual, xtests_comparison_t comp)
02783     {
02784         stlsoft_static_cast(void, xtests_testFailed_boolean(file, line, function, expr, expected, actual, comp));
02785     }
02786 };
02787 
02788 
02789 
02790 template<   typename T1
02791         ,   typename T2
02792         >
02793 struct xtests_integer_failure_reporter_selector
02794 {
02795 private:
02796     enum { are_types_same       =   (0 != stlsoft::is_same_type<T1, T2>::value) };
02797     enum { T1_is_larger_than_T2 =   sizeof(T1) > sizeof(T2)                     };
02798 
02799     typedef typename stlsoft::select_first_type_if< T1
02800                                                 ,   T2
02801                                                 ,   T1_is_larger_than_T2
02802                                                 >::type         larger_type_;
02803 
02804 public:
02805     typedef xtests_failure_reporter<larger_type_>               type;
02806 };
02807 
02808 template <typename I1, typename I2>
02809 inline void xtests_reportFailedIntegerComparison(char const* file, int line, char const* function, char const* expr, I1 const& expected, I2 const& actual, xtests_comparison_t comp)
02810 {
02811     STLSOFT_STATIC_ASSERT(0 != stlsoft::is_integral_type<I1>::value);
02812     STLSOFT_STATIC_ASSERT(0 != stlsoft::is_integral_type<I2>::value);
02813 
02814 #  if defined(STLSOFT_COMPILER_IS_BORLAND)
02815 
02816     xtests_integer_failure_reporter_selector<I1, I2>::type::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
02817 
02818 #  else /* ? compiler */
02819 
02820     typedef typename xtests_integer_failure_reporter_selector<I1, I2>::type    failure_reporter_t;
02821 
02822     failure_reporter_t::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
02823 
02824 #  endif /* compiler */
02825 }
02826 
02827 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
02828     _MSC_VER >= 1310 && \
02829     !defined(_WIN64) && \
02830     defined(_Wp64)
02831 /* This special overload is to allow for cases such as:
02832  *
02833  *     XTESTS_TEST_INTEGER_EQUAL(4u, sink.size());
02834  */
02835 inline void xtests_reportFailedIntegerComparison(char const* file, int line, char const* function, char const* expr, unsigned int expected, size_t actual, xtests_comparison_t comp)
02836 {
02837     stlsoft_static_cast(void, xtests_testFailed_ulong(file, line, function, expr, static_cast<unsigned long>(expected), static_cast<unsigned long>(actual), comp));
02838 }
02839 #endif
02840 
02841 inline void xtests_reportFailedIntegerComparison(char const* file, int line, char const* function, char const* expr, bool expected, bool actual, xtests_comparison_t comp)
02842 {
02843 #  if defined(STLSOFT_COMPILER_IS_BORLAND)
02844 
02845     xtests_integer_failure_reporter_selector<bool, bool>::type::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
02846 
02847 #  else /* ? compiler */
02848 
02849     typedef xtests_integer_failure_reporter_selector<bool, bool>::type    failure_reporter_t;
02850 
02851     failure_reporter_t::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
02852 
02853 #  endif /* compiler */
02854 }
02855 
02856 #if 0
02857 inline void xtests_reportFailedIntegerComparison(char const* file, int line, char const* function, char const* expr, int expected, bool actual, xtests_comparison_t comp)
02858 {
02859     xtests_reportFailedIntegerComparison(file, line, function, expr, 0 != expected, actual, comp);
02860 }
02861 #endif /* 0 */
02862 
02863 inline void xtests_reportFailedFloatingPointComparison(char const* file, int line, char const* function, char const* expr, double const& expected, double const& actual, xtests_comparison_t comp)
02864 {
02865     stlsoft_static_cast(void, xtests_testFailed_double(file, line, function, expr, expected, actual, comp));
02866 }
02867 
02868 template <typename I1, typename I2>
02869 inline int xtests_test_integer(char const* file, int line, char const* function, char const* expr, I1 const& expected, I2 const& actual, xtests_comparison_t comp)
02870 {
02871     int comparisonSucceeded = false;
02872 
02873     switch(comp)
02874     {
02875         case    xtestsComparisonEqual:
02876         case    xtestsComparisonApproxEqual:
02877             if(expected == actual)
02878             {
02879                 comparisonSucceeded = true;
02880             }
02881             break;
02882         case    xtestsComparisonNotEqual:
02883         case    xtestsComparisonApproxNotEqual:
02884             if(expected != actual)
02885             {
02886                 comparisonSucceeded = true;
02887             }
02888             break;
02889         case    xtestsComparisonGreaterThan:
02890             if(actual > expected)
02891             {
02892                 comparisonSucceeded = true;
02893             }
02894             break;
02895         case    xtestsComparisonLessThan:
02896             if(actual < expected)
02897             {
02898                 comparisonSucceeded = true;
02899             }
02900             break;
02901         case    xtestsComparisonGreaterThanOrEqual:
02902             if(actual >= expected)
02903             {
02904                 comparisonSucceeded = true;
02905             }
02906             break;
02907         case    xtestsComparisonLessThanOrEqual:
02908             if(actual <= expected)
02909             {
02910                 comparisonSucceeded = true;
02911             }
02912             break;
02913         case    xtestsComparison_max_enumerator:
02914             xtests_abend("invalid test comparison type: test framework may be out of date!");
02915             break;
02916     }
02917 
02918     if(comparisonSucceeded)
02919     {
02920         xtests_testPassed(file, line, function, expr);
02921     }
02922     else
02923     {
02924         xtests_reportFailedIntegerComparison(file, line, function, expr, expected, actual, comp);
02925     }
02926 
02927     return comparisonSucceeded;
02928 }
02929 
02930 inline int xtests_test_character(char const* file, int line, char const* function, char const* expr, char expected, char actual, xtests_comparison_t comp)
02931 {
02932     return xtests_testCharactersA(file, line, function, expr, expected, actual, comp);
02933 }
02934 inline int xtests_test_character(char const* file, int line, char const* function, char const* expr, wchar_t expected, wchar_t actual, xtests_comparison_t comp)
02935 {
02936     return xtests_testCharactersW(file, line, function, expr, expected, actual, comp);
02937 }
02938 
02939 inline int xtests_test_floating_point(char const* file, int line, char const* function, char const* expr, double const& expected, double const& actual, xtests_comparison_t comp)
02940 {
02941     int comparisonSucceeded = false;
02942 
02943     switch(comp)
02944     {
02945         case    xtestsComparisonEqual:
02946             if(expected == actual)
02947             {
02948                 comparisonSucceeded = true;
02949             }
02950             break;
02951         case    xtestsComparisonApproxEqual:
02952             if(xtests_floatingPointClose(expected, actual))
02953             {
02954                 comparisonSucceeded = true;
02955             }
02956             break;
02957         case    xtestsComparisonNotEqual:
02958             if(expected != actual)
02959             {
02960                 comparisonSucceeded = true;
02961             }
02962             break;
02963         case    xtestsComparisonApproxNotEqual:
02964             if(!xtests_floatingPointClose(expected, actual))
02965             {
02966                 comparisonSucceeded = true;
02967             }
02968             break;
02969         case    xtestsComparisonGreaterThan:
02970             if(actual > expected)
02971             {
02972                 comparisonSucceeded = true;
02973             }
02974             break;
02975         case    xtestsComparisonLessThan:
02976             if(actual < expected)
02977             {
02978                 comparisonSucceeded = true;
02979             }
02980             break;
02981         case    xtestsComparisonGreaterThanOrEqual:
02982             if(actual >= expected)
02983             {
02984                 comparisonSucceeded = true;
02985             }
02986             break;
02987         case    xtestsComparisonLessThanOrEqual:
02988             if(actual <= expected)
02989             {
02990                 comparisonSucceeded = true;
02991             }
02992             break;
02993         case    xtestsComparison_max_enumerator:
02994             xtests_abend("invalid test comparison type: test framework may be out of date!");
02995             break;
02996     }
02997 
02998     if(comparisonSucceeded)
02999     {
03000         stlsoft_static_cast(void, xtests_testPassed(file, line, function, expr));
03001     }
03002     else
03003     {
03004         stlsoft_static_cast(void, xtests_reportFailedFloatingPointComparison(file, line, function, expr, expected, actual, comp));
03005     }
03006 
03007     return comparisonSucceeded;
03008 }
03009 
03010 #  endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
03011 
03012 # ifndef _XTESTS_NO_NAMESPACE
03013 } /* namespace cpp */
03014 # endif /* !_XTESTS_NO_NAMESPACE */
03015 
03016 #else /* __cplusplus && !_XTESTS_NO_CPP_API */
03017 
03018 # define XTESTS_REQUIRE(test)           XTESTS_NS_C_QUAL(xtests_require_C)(!(!(test)))
03019 
03020 #endif /* __cplusplus) && !_XTESTS_NO_CPP_API */
03021 
03022 XTESTS_CALL(int) xtests_require_C(int success);
03023 
03024 XTESTS_CALL(int) xTests_hasRequiredConditionFailed(void);
03025 
03026 /* /////////////////////////////////////////////////////////////////////////
03027  * Helper functions
03028  */
03029 
03030 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
03031 XTESTS_CALL(int) xtests_commandLine_parseVerbosity(int argc, char** argv, int *verbosity);
03032 #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
03033 
03055 #define XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, pverbosity)                       \
03056                                                                                         \
03057     stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_commandLine_parseVerbosity)((argc), (argv), (pverbosity)))
03058 
03059 /* /////////////////////////////////////////////////////////////////////////
03060  * Obsolete names
03061  */
03062 
03063 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
03064 # define XTESTS_FAIL_WITH_QUALIFIER(msg, qualifier)     XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, qualifier)
03065 # define XTESTS_FAIL(msg)                               XTESTS_TEST_FAIL(msg)
03066 # define XTESTS_PASSED()                                XTESTS_TEST_PASSED()
03067 # define XTESTS_TEST_MULTIBYTE_STRINGS_EQUAL            XTESTS_TEST_MULTIBYTE_STRING_EQUAL
03068 #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
03069 
03070 /* /////////////////////////////////////////////////////////////////////////
03071  * Namespace
03072  */
03073 
03074 #ifndef _XTESTS_NO_NAMESPACE
03075 } /* namespace c */
03076 } /* namespace xtests */
03077 #endif /* !_XTESTS_NO_NAMESPACE */
03078 
03079 /* ////////////////////////////////////////////////////////////////////// */
03080 
03081 #endif /* !XTESTS_INCL_XTESTS_H_XTESTS */
03082 
03083 /* ////////////////////////////////////////////////////////////////////// */

b64 Library documentation © Synesis Software Pty Ltd, 2004-2007