00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
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 31
00054 # define XTESTS_VER_XTESTS_H_XTESTS_REVISION 4
00055 # define XTESTS_VER_XTESTS_H_XTESTS_EDIT 306
00056 #endif
00057
00058
00059
00060
00061
00076 #define _XTESTS_VER_MAJOR 0
00077 #define _XTESTS_VER_MINOR 16
00078 #define _XTESTS_VER_REVISION 4
00079
00080 #define _XTESTS_VER 0x001004ff
00081
00082
00083
00084
00085
00086 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00087 # include <stlsoft/stlsoft.h>
00088 #endif
00089
00090
00091
00092
00093
00094 #if _STLSOFT_VER < 0x01096fff
00095 # error xTests requires version 1.9.111 (or later) of STLSoft; download from www.stlsoft.org
00096 #endif
00097
00098 #if defined(STLSOFT_COMPILER_IS_WATCOM)
00099 # define _XTESTS_NO_CPP_API
00100 #endif
00101
00102
00103
00104
00105
00106 #ifdef __cplusplus
00107 # include <platformstl/platformstl.h>
00108 # if defined(PLATFORMSTL_OS_IS_UNIX)
00109
00110
00111
00112
00113
00114 # include <unixstl/synch/util/features.h>
00115 # elif defined(PLATFORMSTL_OS_IS_WINDOWS)
00116 # endif
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
00121 # ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_SAME_TYPE
00122 # include <stlsoft/meta/is_same_type.hpp>
00123 # endif
00124 # ifndef STLSOFT_INCL_STLSOFT_META_HPP_SELECT_FIRST_TYPE_IF
00125 # include <stlsoft/meta/select_first_type_if.hpp>
00126 # endif
00127 # ifdef STLSOFT_MINIMUM_SAS_INCLUDES
00128 # ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_H_C_STRING
00129 # include <stlsoft/shims/access/string/std/c_string.h>
00130 # endif
00131 # else
00132 # ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00133 # include <stlsoft/shims/access/string.hpp>
00134 # endif
00135 # endif
00136 # endif
00137 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
00138 # include <new>
00139 # include <stdexcept>
00140 # endif
00141 # if defined(STLSOFT_CF_RTTI_SUPPORT)
00142 # include <typeinfo>
00143 # endif
00144
00145 # include <algorithm>
00146 #endif
00147
00148 #include <stdio.h>
00149
00150
00151
00152
00153
00154 #if defined(_STLSOFT_NO_NAMESPACE)
00155 # define _XTESTS_NO_NAMESPACE
00156 #endif
00157
00158 #ifndef _XTESTS_NO_NAMESPACE
00159 namespace xtests
00160 {
00161 namespace c
00162 {
00163 #endif
00164
00165
00166
00167
00168
00169 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
00170
00171 # ifndef XTESTS_CALL
00172 # ifdef __cplusplus
00173 # define XTESTS_CALL(x) extern "C" x
00174 # else
00175 # define XTESTS_CALL(x) extern x
00176 # endif
00177 # endif
00178
00179 # ifdef STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT
00180 # define XTESTS_GET_FUNCTION_() __FUNCTION__
00181 # else
00182 # define XTESTS_GET_FUNCTION_() stlsoft_static_cast(char const*, 0)
00183 # endif
00184
00185 # ifndef _XTESTS_NO_NAMESPACE
00186 # define XTESTS_NS_QUAL(ns, sym) ns::sym
00187 # else
00188 # define XTESTS_NS_QUAL(ns, sym) sym
00189 # endif
00190
00191 # define XTESTS_NS_C_QUAL(sym) XTESTS_NS_QUAL(xtests::c, sym)
00192 # define XTESTS_NS_CPP_QUAL(sym) XTESTS_NS_QUAL(xtests::c::cpp, sym)
00193
00194 # if defined(STLSOFT_CF_RTTI_SUPPORT) && \
00195 ( !defined(STLSOFT_COMPILER_IS_MSVC) || \
00196 _MSC_VER >= 1310)
00197 # define XTESTS_REPORT_EXCEPTION_(x) XTESTS_NS_C_QUAL(xtests_caseExcepted)(typeid(x).name(), x.what())
00198 # else
00199 # define XTESTS_REPORT_EXCEPTION_(x) XTESTS_NS_C_QUAL(xtests_caseExcepted)("<exception-type unknown: rtti not available>", x.what())
00200 # endif
00201
00202 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
00203
00204 # if defined(STLSOFT_COMPILER_IS_GCC)
00205
00206
00207
00208
00209
00210
00211 # define XTESTS_INVOKE_TEST_CASE_FN_INNER_(fn) do { try { (*fn)(); } catch(...) { throw; } } while(0)
00212 # else
00213 # define XTESTS_INVOKE_TEST_CASE_FN_INNER_(fn) (*fn)()
00214 # endif
00215
00216
00217
00218 # define XTESTS_INVOKE_TEST_CASE_FN_(fn, name) \
00219 \
00220 do \
00221 { \
00222 try \
00223 { \
00224 XTESTS_INVOKE_TEST_CASE_FN_INNER_(fn); \
00225 } \
00226 catch(std::bad_alloc& x) \
00227 { \
00228 XTESTS_REPORT_EXCEPTION_(x); \
00229 \
00230 throw; \
00231 } \
00232 catch(XTESTS_NS_CPP_QUAL(requirement_failed_exception)& ) \
00233 { \
00234 } \
00235 catch(std::exception& x) \
00236 { \
00237 XTESTS_REPORT_EXCEPTION_(x); \
00238 } \
00239 } while(0)
00240
00241 # define XTESTS_INVOKE_TEST_CASE_FN_THROWS_(fn, name, type) \
00242 \
00243 do \
00244 { \
00245 try \
00246 { \
00247 XTESTS_INVOKE_TEST_CASE_FN_INNER_(fn); \
00248 \
00249 XTESTS_NS_C_QUAL(xtests_caseExceptionExpected)(#type); \
00250 } \
00251 catch(XTESTS_NS_CPP_QUAL(requirement_failed_exception)& ) \
00252 { \
00253 } \
00254 catch(type& ) \
00255 { \
00256 XTESTS_TEST_PASSED(); \
00257 } \
00258 catch(std::bad_alloc& x) \
00259 { \
00260 XTESTS_REPORT_EXCEPTION_(x); \
00261 \
00262 throw; \
00263 } \
00264 catch(std::exception& x) \
00265 { \
00266 XTESTS_REPORT_EXCEPTION_(x); \
00267 } \
00268 } while(0)
00269
00270 # else
00271
00272 # define XTESTS_INVOKE_TEST_CASE_FN_(fn, name) (*fn)()
00273
00274 # endif
00275
00276
00277
00278 # if defined(STLSOFT_COMPILER_IS_DMC)
00279 # define XTESTS_INVOKE_c_str_data_a_(x) stlsoft_ns_qual(c_str_data_a)(x)
00280 # define XTESTS_INVOKE_c_str_data_w_(x) stlsoft_ns_qual(c_str_data_w)(x)
00281 # define XTESTS_INVOKE_c_str_len_a_(x) stlsoft_ns_qual(c_str_len_a)(x)
00282 # define XTESTS_INVOKE_c_str_len_w_(x) stlsoft_ns_qual(c_str_len_w)(x)
00283 # define XTESTS_INVOKE_c_str_ptr_a_(x) stlsoft_ns_qual(c_str_ptr_a)(x)
00284 # define XTESTS_INVOKE_c_str_ptr_w_(x) stlsoft_ns_qual(c_str_ptr_w)(x)
00285 # elif defined(STLSOFT_COMPILER_IS_GCC)
00286 # define XTESTS_INVOKE_c_str_data_a_(x) c_str_data_a(x)
00287 # define XTESTS_INVOKE_c_str_data_w_(x) c_str_data_w(x)
00288 # define XTESTS_INVOKE_c_str_len_a_(x) c_str_len_a(x)
00289 # define XTESTS_INVOKE_c_str_len_w_(x) c_str_len_w(x)
00290 # define XTESTS_INVOKE_c_str_ptr_a_(x) c_str_ptr_a(x)
00291 # define XTESTS_INVOKE_c_str_ptr_w_(x) c_str_ptr_w(x)
00292 # else
00293 # define XTESTS_INVOKE_c_str_data_a_(x) c_str_data_a(x)
00294 # define XTESTS_INVOKE_c_str_data_w_(x) c_str_data_w(x)
00295 # define XTESTS_INVOKE_c_str_len_a_(x) c_str_len_a(x)
00296 # define XTESTS_INVOKE_c_str_len_w_(x) c_str_len_w(x)
00297 # define XTESTS_INVOKE_c_str_ptr_a_(x) c_str_ptr_a(x)
00298 # define XTESTS_INVOKE_c_str_ptr_w_(x) c_str_ptr_w(x)
00299 # endif
00300
00301
00302
00303 # if defined(STLSOFT_COMPILER_IS_MSVC) && \
00304 ( _MSC_VER >= 1500 || \
00305 ( _MSC_VER >= 1400 && \
00306 defined(_MSC_FULL_VER) && \
00307 _MSC_FULL_VER >= 140050320))
00308 # 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"))
00309 # define XTESTS_CALL_DEPRECATED(rt, oldfn, newfn) XTESTS_DECLARE_DEPRECATION("function", oldfn, newfn) XTESTS_CALL(rt)
00310 # else
00311 # define XTESTS_DECLARE_DEPRECATION(symtype, oldfn, newfn)
00312 # define XTESTS_CALL_DEPRECATED(rt, oldfn, newfn) XTESTS_CALL(rt)
00313 # endif
00314
00315
00316
00317
00318 # define XTESTS_VOID_FUNCTION_CAST_(f) stlsoft_c_cast( void(*)(void), f )
00319
00320
00321
00322 #endif
00323
00324
00325
00326
00327
00339 enum xtests_runner_flags_t
00340 {
00341 xtestsRunnerFlagsNoWindowsDebugString = 0x0001
00342 , xtestsReportOnlyNonEmptyCases = 0x0002
00343 };
00344 #ifndef __cplusplus
00345 typedef enum xtests_runner_flags_t xtests_runner_flags_t;
00346 #endif
00347
00352 #define XTESTS_FP_APPROXIMATE_FACTOR (1.000001)
00353
00354
00355
00356
00357
00392 #define XTESTS_START_RUNNER(name, verbosity) \
00393 \
00394 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, NULL, 0, NULL, NULL, NULL))
00395
00396
00416 #define XTESTS_START_RUNNER_WITH_SETUP_FNS(name, verbosity, setup, teardown, setupParam) \
00417 \
00418 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, NULL, 0, (setup), (teardown), (setupParam)))
00419
00420
00434 #define XTESTS_START_RUNNER_WITH_STREAM(name, verbosity, stm) \
00435 \
00436 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, stm, 0, NULL, NULL, NULL))
00437
00438
00454 #define XTESTS_START_RUNNER_WITH_REPORTER(name, verbosity, reporter, reporterParam) \
00455 \
00456 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), NULL, 0, NULL, NULL, NULL))
00457
00458
00475 #define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM(name, verbosity, reporter, reporterParam, stm) \
00476 \
00477 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), stm, 0, NULL, NULL, NULL))
00478
00479
00498 #define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM_AND_FLAGS(name, verbosity, reporter, reporterParam, stm, flags) \
00499 \
00500 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), (stm), (flags), NULL, NULL, NULL))
00501
00502
00525 #define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM_AND_FLAGS_AND_SETUP_FNS(name, verbosity, reporter, reporterParam, stm, flags, setup, teardown, setupParam) \
00526 \
00527 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), (reporter), (reporterParam), (stm), (flags), (setup), (teardown), (setupParam)))
00528
00529
00544 #define XTESTS_START_RUNNER_WITH_FLAGS(name, verbosity, flags) \
00545 \
00546 (0 == XTESTS_NS_C_QUAL(xtests_startRunner)((name), (verbosity), NULL, NULL, NULL, (flags), NULL, NULL, NULL))
00547
00548
00560 #define XTESTS_PRINT_RESULTS() \
00561 \
00562 XTESTS_NS_C_QUAL(xtests_printRunnerResults)()
00563
00564
00571 #define XTESTS_END_RUNNER() \
00572 \
00573 XTESTS_NS_C_QUAL(xtests_endRunner)(NULL)
00574
00575
00582 #define XTESTS_ABEND(terminationMessage) \
00583 \
00584 XTESTS_NS_C_QUAL(xtests_abend)(terminationMessage)
00585
00586
00602 #define XTESTS_END_RUNNER_UPDATE_EXITCODE(retCode) \
00603 \
00604 stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_endRunner)(retCode))
00605
00606
00607
00608
00619 #define XTESTS_CASE_BEGIN(name, desc) \
00620 \
00621 (0 == XTESTS_NS_C_QUAL(xtests_beginTestCase)((name), (desc)))
00622
00623
00635 #define XTESTS_CASE_END(name) \
00636 \
00637 stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_endTestCase)((name)))
00638
00639
00655 #define XTESTS_RUN_CASE_WITH_NAME_AND_DESC(name, desc, fn) \
00656 \
00657 do \
00658 { \
00659 if(XTESTS_CASE_BEGIN(name, desc)) \
00660 { \
00661 XTESTS_INVOKE_TEST_CASE_FN_(fn, name); \
00662 \
00663 XTESTS_CASE_END(name); \
00664 } \
00665 \
00666 } while(0)
00667
00668
00683 #define XTESTS_RUN_CASE_WITH_DESC(fn, desc) \
00684 \
00685 XTESTS_RUN_CASE_WITH_NAME_AND_DESC(#fn, desc, fn)
00686 \
00700 #define XTESTS_RUN_CASE(fn) \
00701 \
00702 XTESTS_RUN_CASE_WITH_DESC(fn, "")
00703
00704
00705 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00706
00724 # define XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(name, desc, fn, type) \
00725 \
00726 do \
00727 { \
00728 if(XTESTS_CASE_BEGIN(name, desc)) \
00729 { \
00730 XTESTS_INVOKE_TEST_CASE_FN_THROWS_(fn, name, type); \
00731 \
00732 XTESTS_CASE_END(name); \
00733 } \
00734 \
00735 } while(0)
00736
00753 # define XTESTS_RUN_CASE_THAT_THROWS_WITH_DESC(fn, desc, type) \
00754 \
00755 XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(#fn, desc, fn, type)
00756
00772 # define XTESTS_RUN_CASE_THAT_THROWS(fn, type) \
00773 \
00774 XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(#fn, "", fn, type)
00775
00776 #endif
00777
00778
00792 #define XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, qualifier) \
00793 \
00794 XTESTS_NS_C_QUAL(xtests_writeFailMessage)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), msg, qualifier)
00795
00807 #define XTESTS_TEST_FAIL(msg) \
00808 \
00809 XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, stlsoft_static_cast(char const*, NULL))
00810
00820 #define XTESTS_TEST_PASSED() \
00821 \
00822 XTESTS_NS_C_QUAL(xtests_testPassed)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "")
00823
00837 #define XTESTS_TEST_WITH_MESSAGE(expr, msg) \
00838 \
00839 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
00840 ((expr) \
00841 ? XTESTS_NS_C_QUAL(xtests_testPassed)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), msg) \
00842 : XTESTS_NS_C_QUAL(xtests_testFailed)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), msg)))
00843
00855 #define XTESTS_TEST(expr) \
00856 \
00857 XTESTS_TEST_WITH_MESSAGE(expr, #expr)
00858
00859
00860
00861
00862
00863
00878 #define XTESTS_TEST_ENUM_EQUAL(expected, actual) XTESTS_TEST_INTEGER_EQUAL_EXACT(stlsoft_static_cast(int, (expected)), stlsoft_static_cast(int, (actual)))
00879
00894 #define XTESTS_TEST_ENUM_NOT_EQUAL(expected, actual) XTESTS_TEST_INTEGER_NOT_EQUAL(stlsoft_static_cast(int, (expected)), stlsoft_static_cast(int, (actual)))
00895
00896
00897
00898
00899
00900
00901 #if defined(__cplusplus) && \
00902 !defined(_XTESTS_NO_CPP_API)
00903
00918 # define XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual) \
00919 \
00920 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
00921 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
00922
00937 # define XTESTS_TEST_INTEGER_NOT_EQUAL(expected, actual) \
00938 \
00939 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
00940 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))))
00941
00954 # define XTESTS_TEST_INTEGER_GREATER(expected, actual) \
00955 \
00956 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
00957 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThan))))
00958
00971 # define XTESTS_TEST_INTEGER_LESS(expected, actual) \
00972 \
00973 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
00974 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThan))))
00975
00989 # define XTESTS_TEST_INTEGER_GREATER_OR_EQUAL(expected, actual) \
00990 \
00991 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
00992 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThanOrEqual))))
00993
01007 # define XTESTS_TEST_INTEGER_LESS_OR_EQUAL(expected, actual) \
01008 \
01009 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01010 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThanOrEqual))))
01011
01029 # define XTESTS_TEST_INTEGER_EQUAL_ANY_IN_RANGE(begin, end, actual) \
01030 \
01031 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01032 XTESTS_NS_CPP_QUAL(xtests_test_integer_any_in_range(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "XTESTS_TEST_INTEGER_EQUAL_ANY_IN_RANGE(" ## #begin ## ", " ## #end ## ", " ## #actual ## ")", (begin), (end), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
01033
01051 # define XTESTS_TEST_INTEGER_EQUAL_ANY_NOT_IN_RANGE(begin, end, actual) \
01052 \
01053 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01054 XTESTS_NS_CPP_QUAL(xtests_test_integer_any_in_range(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "XTESTS_TEST_INTEGER_EQUAL_ANY_IN_RANGE(" ## #begin ## ", " ## #end ## ", " ## #actual ## ")", (begin), (end), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))))
01055
01056
01057 #if 0
01058
01070 # define XTESTS_TEST_INTEGER_EQUAL_ANY_OF(expected, actual) \
01071 \
01072 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01073 \
01074 XTESTS_NS_CPP_QUAL(xtests_test_integer_one_of( \
01075 __FILE__ \
01076 , __LINE__ \
01077 , XTESTS_GET_FUNCTION_() \
01078 , "XTESTS_TEST_INTEGER_EQUAL_ANY_OF(" ## #expected ## ", " ## #actual ## ")" \
01079 , (expected) \
01080 , (actual) \
01081 , XTESTS_NS_C_QUAL(xtestsComparisonEqual))) \
01082 )
01083 #endif
01084
01085 # define XTESTS_TEST_INTEGER_EQUAL_ANY_OF2(expected0, expected1, actual) \
01086 \
01087 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01088 \
01089 XTESTS_NS_CPP_QUAL(xtests_test_integer_one_of( \
01090 __FILE__ \
01091 , __LINE__ \
01092 , XTESTS_GET_FUNCTION_() \
01093 , "XTESTS_TEST_INTEGER_EQUAL_ANY_OF(" ## #expected0 ## ", " ## #expected1 ## ", " ## #actual ## ")" \
01094 , (actual) \
01095 , (expected0) \
01096 , (expected1) \
01097 , XTESTS_NS_C_QUAL(xtestsComparisonEqual))) \
01098 )
01099
01100 # define XTESTS_TEST_INTEGER_EQUAL_ANY_OF3(expected0, expected1, expected2, actual) \
01101 \
01102 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01103 \
01104 XTESTS_NS_CPP_QUAL(xtests_test_integer_one_of( \
01105 __FILE__ \
01106 , __LINE__ \
01107 , XTESTS_GET_FUNCTION_() \
01108 , "XTESTS_TEST_INTEGER_EQUAL_ANY_OF(" ## #expected0 ## ", " ## #expected1 ## ", " ## #expected2 ## ", " ## #actual ## ")" \
01109 , (actual) \
01110 , (expected0) \
01111 , (expected1) \
01112 , (expected2) \
01113 , XTESTS_NS_C_QUAL(xtestsComparisonEqual))) \
01114 )
01115
01116
01117
01118
01119
01120
01121
01134 # define XTESTS_TEST_BOOLEAN_EQUAL(expected, actual) \
01135 \
01136 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01137 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
01138
01151 # define XTESTS_TEST_BOOLEAN_NOT_EQUAL(expected, actual) \
01152 \
01153 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01154 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))))
01155
01167 # define XTESTS_TEST_BOOLEAN_TRUE(actual) \
01168 \
01169 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01170 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", true, (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
01171
01183 # define XTESTS_TEST_BOOLEAN_FALSE(actual) \
01184 \
01185 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01186 XTESTS_NS_CPP_QUAL(xtests_test_integer(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", false, (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
01187
01188
01189
01190
01191
01192
01207 # define XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual) \
01208 \
01209 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01210 XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
01211
01226 # define XTESTS_TEST_CHARACTER_NOT_EQUAL(expected, actual) \
01227 \
01228 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01229 XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))))
01230
01243 # define XTESTS_TEST_CHARACTER_GREATER(expected, actual) \
01244 \
01245 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01246 XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThan))))
01247
01260 # define XTESTS_TEST_CHARACTER_LESS(expected, actual) \
01261 \
01262 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01263 XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThan))))
01264
01278 # define XTESTS_TEST_CHARACTER_GREATER_OR_EQUAL(expected, actual) \
01279 \
01280 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01281 XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThanOrEqual))))
01282
01296 # define XTESTS_TEST_CHARACTER_LESS_OR_EQUAL(expected, actual) \
01297 \
01298 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01299 XTESTS_NS_CPP_QUAL(xtests_test_character(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThanOrEqual))))
01300
01301
01302
01303
01304
01305
01306
01319 # define XTESTS_TEST_FLOATINGPOINT_EQUAL_EXACT(expected, actual) \
01320 \
01321 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01322 XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual))))
01323
01336 # define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_EXACT(expected, actual) \
01337 \
01338 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01339 XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual))))
01340
01354 # define XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual) \
01355 \
01356 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01357 XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual))))
01358
01372 # define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_APPROX(expected, actual) \
01373 \
01374 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01375 XTESTS_NS_CPP_QUAL(xtests_test_floating_point(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual))))
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01399 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
01400 # define XTESTS_REQUIRE(test) XTESTS_NS_CPP_QUAL(xtests_require)(!(!(test)))
01401 # else
01402 # define XTESTS_REQUIRE(test) XTESTS_NS_C_QUAL(xtests_require_C)(!(!(test)))
01403 # endif
01404
01405 #else
01406
01407 # define XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual) XTESTS_TEST((expected) == (actual))
01408 # define XTESTS_TEST_INTEGER_NOT_EQUAL(expected, actual) XTESTS_TEST((expected) != (actual))
01409 # define XTESTS_TEST_INTEGER_GREATER(expected, actual) XTESTS_TEST((expected) < (actual))
01410 # define XTESTS_TEST_INTEGER_LESS(expected, actual) XTESTS_TEST((expected) > (actual))
01411 # define XTESTS_TEST_INTEGER_GREATER_OR_EQUAL(expected, actual) XTESTS_TEST((expected) <= (actual))
01412 # define XTESTS_TEST_INTEGER_LESS_OR_EQUAL(expected, actual) XTESTS_TEST((expected) >= (actual))
01413
01414 # define XTESTS_TEST_BOOLEAN_EQUAL(expected, actual) XTESTS_TEST((expected) == (actual))
01415 # define XTESTS_TEST_BOOLEAN_NOT_EQUAL(expected, actual) XTESTS_TEST((expected) != (actual))
01416 # define XTESTS_TEST_BOOLEAN_TRUE(actual) XTESTS_TEST((actual))
01417 # define XTESTS_TEST_BOOLEAN_FALSE(actual) XTESTS_TEST(!(actual))
01418
01419 # define XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual) XTESTS_TEST((expected) == (actual))
01420 # define XTESTS_TEST_CHARACTER_NOT_EQUAL(expected, actual) XTESTS_TEST((expected) != (actual))
01421 # define XTESTS_TEST_CHARACTER_GREATER(expected, actual) XTESTS_TEST((expected) < (actual))
01422 # define XTESTS_TEST_CHARACTER_LESS(expected, actual) XTESTS_TEST((expected) > (actual))
01423 # define XTESTS_TEST_CHARACTER_GREATER_OR_EQUAL(expected, actual) XTESTS_TEST((expected) <= (actual))
01424 # define XTESTS_TEST_CHARACTER_LESS_OR_EQUAL(expected, actual) XTESTS_TEST((expected) >= (actual))
01425
01426 # define XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual) XTESTS_TEST(xtests_floatingPointClose((expected), (actual)))
01427 # define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_APPROX(expected, actual) XTESTS_TEST(!xtests_floatingPointClose((expected), (actual)))
01428
01429 #endif
01430
01437 #ifdef __DMC__
01438 # define XTESTS_ARRAY_END_POST(ar) (&(ar)[0] + STLSOFT_NUM_ELEMENTS(ar))
01439 #else
01440 # define XTESTS_ARRAY_END_POST(ar) (&0[(ar)] + STLSOFT_NUM_ELEMENTS(ar))
01441 #endif
01442
01443
01444
01445
01446
01447
01460 #define XTESTS_TEST_INTEGER_EQUAL(expected, actual) XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual)
01461
01474 #define XTESTS_TEST_FLOATINGPOINT_EQUAL(expected, actual) XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual)
01475
01488 #define XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL(expected, actual) XTESTS_TEST_FLOATINGPOINT_NOT_EQUAL_APPROX(expected, actual)
01489
01502 #define XTESTS_TEST_CHARACTER_EQUAL(expected, actual) XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual)
01503
01504
01505
01506
01507
01508
01509
01522 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL(expected, actual) \
01523 \
01524 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01525 XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01526
01540 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_APPROX(expected, actual) \
01541 \
01542 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01543 XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01544
01557 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL(expected, actual) \
01558 \
01559 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01560 XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01561
01575 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_APPROX(expected, actual) \
01576 \
01577 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01578 XTESTS_NS_C_QUAL(xtests_testMultibyteStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01579
01593 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_N(expected, actual, n) \
01594 \
01595 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01596 XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01597
01612 #define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_N_APPROX(expected, actual, n) \
01613 \
01614 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01615 XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01616
01630 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_N(expected, actual, n) \
01631 \
01632 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01633 XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01634
01649 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_N_APPROX(expected, actual, n) \
01650 \
01651 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01652 XTESTS_NS_C_QUAL(xtests_testMultibyteStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01653
01654
01655
01656
01657
01658
01671 #define XTESTS_TEST_WIDE_STRING_EQUAL(expected, actual) \
01672 \
01673 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01674 XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01675
01688 #define XTESTS_TEST_WIDE_STRING_EQUAL_APPROX(expected, actual) \
01689 \
01690 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01691 XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01692
01705 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL(expected, actual) \
01706 \
01707 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01708 XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01709
01723 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_APPROX(expected, actual) \
01724 \
01725 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01726 XTESTS_NS_C_QUAL(xtests_testWideStrings)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01727
01741 #define XTESTS_TEST_WIDE_STRING_EQUAL_N(expected, actual, n) \
01742 \
01743 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01744 XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01745
01760 #define XTESTS_TEST_WIDE_STRING_EQUAL_N_APPROX(expected, actual, n) \
01761 \
01762 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01763 XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01764
01778 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_N(expected, actual, n) \
01779 \
01780 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01781 XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01782
01796 #define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_N_APPROX(expected, actual, n) \
01797 \
01798 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01799 XTESTS_NS_C_QUAL(xtests_testWideStringsN)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), n, XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01800
01801
01802
01815 #define XTESTS_TEST_MULTIBYTE_STRING_CONTAIN(expected, actual) \
01816 \
01817 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01818 XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01819
01833 #define XTESTS_TEST_MULTIBYTE_STRING_CONTAIN_APPROX(expected, actual) \
01834 \
01835 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01836 XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01837
01850 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_CONTAIN(expected, actual) \
01851 \
01852 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01853 XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01854
01868 #define XTESTS_TEST_MULTIBYTE_STRING_NOT_CONTAIN_APPROX(expected, actual) \
01869 \
01870 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01871 XTESTS_NS_C_QUAL(xtests_testMultibyteStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01872
01873
01874
01887 #define XTESTS_TEST_WIDE_STRING_CONTAIN(expected, actual) \
01888 \
01889 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01890 XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01891
01905 #define XTESTS_TEST_WIDE_STRING_CONTAIN_APPROX(expected, actual) \
01906 \
01907 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01908 XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxEqual)))
01909
01922 #define XTESTS_TEST_WIDE_STRING_NOT_CONTAIN(expected, actual) \
01923 \
01924 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01925 XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01926
01939 #define XTESTS_TEST_WIDE_STRING_NOT_CONTAIN_APPROX(expected, actual) \
01940 \
01941 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01942 XTESTS_NS_C_QUAL(xtests_testWideStringContains)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonApproxNotEqual)))
01943
01944
01945
01946
01947
01948
01949
01962 #define XTESTS_TEST_POINTER_EQUAL(expected, actual) \
01963 \
01964 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01965 XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
01966
01981 # define XTESTS_TEST_POINTER_NOT_EQUAL(expected, actual) \
01982 \
01983 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
01984 XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
01985
01998 # define XTESTS_TEST_POINTER_GREATER(expected, actual) \
01999 \
02000 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
02001 XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThan)))
02002
02015 # define XTESTS_TEST_POINTER_LESS(expected, actual) \
02016 \
02017 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
02018 XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThan)))
02019
02033 # define XTESTS_TEST_POINTER_GREATER_OR_EQUAL(expected, actual) \
02034 \
02035 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
02036 XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonGreaterThanOrEqual)))
02037
02051 # define XTESTS_TEST_POINTER_LESS_OR_EQUAL(expected, actual) \
02052 \
02053 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
02054 XTESTS_NS_C_QUAL(xtests_testPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", (expected), (actual), XTESTS_NS_C_QUAL(xtestsComparisonLessThanOrEqual)))
02055
02056
02057
02058
02059
02060
02073 #define XTESTS_TEST_FUNCTION_POINTER_EQUAL(expected, actual) \
02074 \
02075 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
02076 XTESTS_NS_C_QUAL(xtests_testFunctionPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", XTESTS_VOID_FUNCTION_CAST_(expected), XTESTS_VOID_FUNCTION_CAST_(actual), XTESTS_NS_C_QUAL(xtestsComparisonEqual)))
02077
02092 # define XTESTS_TEST_FUNCTION_POINTER_NOT_EQUAL(expected, actual) \
02093 \
02094 (!XTESTS_NS_C_QUAL(xTests_hasRequiredConditionFailed()) && \
02095 XTESTS_NS_C_QUAL(xtests_testFunctionPointers)(__FILE__, __LINE__, XTESTS_GET_FUNCTION_(), "", XTESTS_VOID_FUNCTION_CAST_(expected), XTESTS_VOID_FUNCTION_CAST_(actual), XTESTS_NS_C_QUAL(xtestsComparisonNotEqual)))
02096
02097
02098
02099
02100
02101
02102 #ifdef __cplusplus
02103 # if !defined(_XTESTS_NO_CPP_API)
02104 # ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
02105
02106
02107
02108
02109
02110
02111 inline size_t c_str_len_n_a(char const* s, size_t n)
02112 {
02113 size_t len = 0;
02114
02115 for(; '\0' != *s && len != n; ++s, ++len)
02116 {}
02117
02118 return len;
02119 }
02120
02121 inline size_t c_str_len_n_w(wchar_t const* s, size_t n)
02122 {
02123 size_t len = 0;
02124
02125 for(; '\0' != *s && len != n; ++s, ++len)
02126 {}
02127
02128 return len;
02129 }
02130
02131 template <typename S>
02132 inline size_t c_str_len_n_a(S const& s, size_t n)
02133 {
02134 stlsoft_ns_using(c_str_len_a);
02135
02136 size_t len = XTESTS_INVOKE_c_str_len_a_(s);
02137
02138 return (len < n) ? len : n;
02139 }
02140
02141 template <typename S>
02142 inline size_t c_str_len_n_w(S const& s, size_t n)
02143 {
02144 stlsoft_ns_using(c_str_len_w);
02145
02146 size_t len = XTESTS_INVOKE_c_str_len_w_(s);
02147
02148 return (len < n) ? len : n;
02149 }
02150
02151 # endif
02152 # endif
02153 #endif
02154
02155
02156
02157
02158
02175 enum xtests_verbosity_t
02176 {
02177 XTESTS_VERBOSITY_SILENT = -1
02178 , XTESTS_VERBOSITY_RUNNER_SUMMARY_ON_ERROR = 0
02179 , XTESTS_VERBOSITY_RUNNER_SUMMARY = 1
02180 , XTESTS_VERBOSITY_FIRST_CASE_SUMMARY_ON_ERROR = 2
02181 , XTESTS_VERBOSITY_CASE_SUMMARY_ON_ERROR = 3
02182 , XTESTS_VERBOSITY_CASE_SUMMARY = 4
02184 , XTESTS_VERBOSITY_VERBOSE = 9
02185 };
02186 #ifndef __cplusplus
02187 typedef enum xtests_verbosity_t xtests_verbosity_t;
02188 #endif
02189
02190
02191 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
02192
02193 enum xtests_comparison_t
02194 {
02195
02196
02197 xtestsComparisonEqual = 0
02198 , xtestsComparisonNotEqual
02199 , xtestsComparisonGreaterThan
02200 , xtestsComparisonLessThan
02201 , xtestsComparisonGreaterThanOrEqual
02202 , xtestsComparisonLessThanOrEqual
02203 , xtestsComparisonApproxEqual
02204 , xtestsComparisonApproxNotEqual
02205
02206
02207
02208 , xtestsComparison_max_enumerator
02209
02210 };
02211 # ifndef __cplusplus
02212 typedef enum xtests_comparison_t xtests_comparison_t;
02213 # endif
02214
02215
02216 # ifdef __cplusplus
02217
02218 enum xtests_variable_type_t
02219 {
02220 xtestsVariableNone = 0
02221 , xtestsVariableBoolean = 1
02222 , xtestsVariableOpaquePointer = 3
02223 , xtestsVariableMultibyteCharacter = 5
02224 , xtestsVariableWideCharacter = 6
02225 , xtestsVariableMultibyteString = 7
02226 , xtestsVariableWideString = 8
02227 , xtestsVariableSignedChar = 11
02228 , xtestsVariableUnsignedChar = 12
02229 , xtestsVariableShort = 13
02230 , xtestsVariableUnsignedShort = 14
02231 , xtestsVariableInt = 15
02232 , xtestsVariableUnsignedInt = 16
02233 , xtestsVariableLong = 17
02234 , xtestsVariableUnsignedLong = 18
02235 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02236 , xtestsVariableLongLong = 19
02237 , xtestsVariableUnsignedLongLong = 20
02238 #endif
02239 , xtestsVariableDouble = 31
02240 };
02241 #ifndef __cplusplus
02242 typedef enum xtests_variable_type_t xtests_variable_type_t;
02243 #endif
02244
02245 enum xtests_test_type_t
02246 {
02247 xtestsTestFullComparison = 0
02248 , xtestsTestPartialComparison = 1
02249 , xtestsTestContainment = 2
02250 };
02251 #ifndef __cplusplus
02252 typedef enum xtests_test_type_t xtests_test_type_t;
02253 #endif
02254
02255 union xtests_variable_value_t
02256 {
02257 int booleanValue;
02258 int intValue;
02259 unsigned int uintValue;
02260 long longValue;
02261 unsigned long ulongValue;
02262 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02263 stlsoft_ns_qual(ss_sint64_t) longlongValue;
02264 stlsoft_ns_qual(ss_uint64_t) ulonglongValue;
02265 #endif
02266 char multibyteCharacterValue;
02267 wchar_t wideCharacterValue;
02268 char const* multibyteStringValue;
02269 wchar_t const* wideStringValue;
02270 double doubleValue;
02271 void const volatile* opaquePointerValue;
02272
02273 explicit xtests_variable_value_t(bool b);
02274 explicit xtests_variable_value_t(char ch);
02275 explicit xtests_variable_value_t(wchar_t ch, xtests_variable_type_t type );
02276 explicit xtests_variable_value_t(signed int i);
02277 explicit xtests_variable_value_t(unsigned int i);
02278 explicit xtests_variable_value_t(signed long i);
02279 explicit xtests_variable_value_t(unsigned long i);
02280 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02281 explicit xtests_variable_value_t(stlsoft_ns_qual(ss_sint64_t) const& i);
02282 explicit xtests_variable_value_t(stlsoft_ns_qual(ss_uint64_t) const& i);
02283 #endif
02284 explicit xtests_variable_value_t(char const* s);
02285 explicit xtests_variable_value_t(wchar_t const* s);
02286 explicit xtests_variable_value_t(char const* s, size_t n);
02287 explicit xtests_variable_value_t(wchar_t const* s, size_t n);
02288 explicit xtests_variable_value_t(double const& d);
02289 explicit xtests_variable_value_t(void const volatile* pv);
02290 };
02291 #ifndef __cplusplus
02292 typedef union xtests_variable_value_t xtests_variable_value_t;
02293 #endif
02294
02295 struct xtests_variable_t
02296 {
02297 xtests_variable_type_t variableType;
02298 xtests_test_type_t testType;
02299 xtests_variable_value_t value;
02300 size_t valueLen;
02301
02302 public:
02303 explicit xtests_variable_t(char ch);
02304 explicit xtests_variable_t(wchar_t ch, xtests_variable_type_t type );
02305 explicit xtests_variable_t(bool b);
02306 explicit xtests_variable_t(int b, xtests_variable_type_t type );
02307 explicit xtests_variable_t(signed char i);
02308 explicit xtests_variable_t(unsigned char i);
02309 explicit xtests_variable_t(signed short i);
02310 explicit xtests_variable_t(unsigned short i);
02311 explicit xtests_variable_t(signed int i);
02312 explicit xtests_variable_t(unsigned int i);
02313 explicit xtests_variable_t(signed long i);
02314 explicit xtests_variable_t(unsigned long i);
02315 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02316 explicit xtests_variable_t(stlsoft_ns_qual(ss_sint64_t) const& i);
02317 explicit xtests_variable_t(stlsoft_ns_qual(ss_uint64_t) const& i);
02318 #endif
02319 explicit xtests_variable_t(char const* s, size_t n, xtests_test_type_t testType = xtestsTestFullComparison);
02320 explicit xtests_variable_t(wchar_t const* s, size_t n, xtests_test_type_t testType = xtestsTestFullComparison);
02321 explicit xtests_variable_t(char const* s, xtests_test_type_t testType = xtestsTestFullComparison);
02322 explicit xtests_variable_t(wchar_t const* s, xtests_test_type_t testType = xtestsTestFullComparison);
02323 explicit xtests_variable_t(double const& d);
02324 explicit xtests_variable_t(void const volatile* pv);
02325 };
02326 #ifndef __cplusplus
02327 typedef union xtests_variable_t xtests_variable_t;
02328 #endif
02329
02333 struct xTests_runner_results_t
02334 {
02335 typedef stlsoft_ns_qual(uint32_t) uint32_t;
02336
02337 char const* name;
02338 uint32_t numCases;
02339 uint32_t numTests;
02340 uint32_t numFailedCases;
02341 uint32_t numFailedTests;
02342 uint32_t numMissingExpectedExceptions;
02343 uint32_t numUnexpectedExceptions;
02344 };
02345
02348 struct xTests_Reporter_t
02349 {
02350 protected:
02351 # if defined(STLSOFT_COMPILER_IS_GCC)
02352 virtual ~xTests_Reporter_t()
02353 {}
02354 # else
02355 ~xTests_Reporter_t()
02356 {}
02357 private:
02358 virtual void dummy_dtor()
02359 {}
02360 # endif
02361
02362 public:
02363 virtual void onStartRunner(void* reporterParam, char const* name, int verbosity) = 0;
02364
02365 virtual void onBeginTestCase(void* reporterParam, char const* name, char const* desc, int verbosity) = 0;
02366
02367 virtual void onTestPassed(void* reporterParam, char const* file, int line, char const* function, char const* expr, xtests_comparison_t comparison, int verbosity) = 0;
02368
02369 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, ptrdiff_t length, xtests_comparison_t comparison, int verbosity) = 0;
02370
02371 virtual void onWriteFailMessage(void* reporterParam, char const* file, int line, char const* function, char const* message, char const* qualifyingInformation, int verbosity) = 0;
02372
02373 virtual void onCaseExcepted(void* reporterParam, char const* caseName, char const* exceptionType, char const* exceptionMessage, int verbosity) = 0;
02374
02375 virtual void onCaseExceptionExpected(void* reporterParam, char const* caseName, char const* exceptionType, int verbosity) = 0;
02376
02377 virtual void onEndTestCase(void* reporterParam, char const* name, xTests_runner_results_t const* results, int verbosity) = 0;
02378
02379 virtual void onPrintRunnerResults(void* reporterParam, xTests_runner_results_t const* results, int verbosity) = 0;
02380
02381 virtual void onAbend(void* reporterParam, char const* message, int verbosity) = 0;
02382
02383 virtual void onDefect(void* reporterParam, char const* message, char const* qualifier, int verbosity) = 0;
02384
02385 virtual void onEndRunner(void* reporterParam, char const* name, int verbosity) = 0;
02386 };
02387 # else
02388 struct xTests_Reporter_t;
02389 typedef struct xTests_Reporter_t xTests_Reporter_t;
02390 # endif
02391
02392
02393 #endif
02394
02405 typedef int (*xTests_Setup_t)(void* param);
02406
02416 typedef int (*xTests_Teardown_t)(void* param);
02417
02418 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
02419
02420 XTESTS_CALL(int)
02421 xtests_startRunner(
02422 char const* name
02423 , int verbosity
02424 , xTests_Reporter_t* reporter
02425 , void* reporterParam
02426 , FILE* stm
02427 , int flags
02428 , xTests_Setup_t setup
02429 , xTests_Teardown_t teardown
02430 , void* setupParam
02431 );
02432
02433 XTESTS_CALL(int)
02434 xtests_endRunner(int *retCode);
02435
02436 XTESTS_CALL(void)
02437 xtests_printRunnerResults(void);
02438
02439 XTESTS_CALL(void)
02440 xtests_abend(char const* message);
02441
02442
02443 XTESTS_CALL(int)
02444 xtests_beginTestCase(
02445 char const* name
02446 , char const* desc
02447 );
02448
02449 XTESTS_CALL(int)
02450 xtests_endTestCase(char const* name);
02451
02452
02453 XTESTS_CALL(int)
02454 xtests_testPassed(
02455 char const* file
02456 , int line
02457 , char const* function
02458 , char const* expr
02459 );
02460
02461 XTESTS_CALL(int)
02462 xtests_testFailed(
02463 char const* file
02464 , int line
02465 , char const* function
02466 , char const* expr
02467 );
02468
02469 XTESTS_CALL(int)
02470 xtests_testFailed_int(
02471 char const* file
02472 , int line
02473 , char const* function
02474 , char const* expr
02475 , int expected
02476 , int actual
02477 , xtests_comparison_t comp
02478 );
02479
02480 XTESTS_CALL(int)
02481 xtests_testFailed_long(
02482 char const* file
02483 , int line
02484 , char const* function
02485 , char const* expr
02486 , long expected
02487 , long actual
02488 , xtests_comparison_t comp
02489 );
02490 XTESTS_CALL(int)
02491 xtests_testFailed_ulong(
02492 char const* file
02493 , int line
02494 , char const* function
02495 , char const* expr
02496 , unsigned long expected
02497 , unsigned long actual
02498 , xtests_comparison_t comp
02499 );
02500 # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
02501 XTESTS_CALL(int)
02502 xtests_testFailed_longlong(
02503 char const* file
02504 , int line
02505 , char const* function
02506 , char const* expr
02507 , stlsoft_ns_qual(ss_sint64_t) expected
02508 , stlsoft_ns_qual(ss_sint64_t) actual
02509 , xtests_comparison_t comp
02510 );
02511 XTESTS_CALL(int)
02512 xtests_testFailed_ulonglong(
02513 char const* file
02514 , int line
02515 , char const* function
02516 , char const* expr
02517 , stlsoft_ns_qual(ss_uint64_t) expected
02518 , stlsoft_ns_qual(ss_uint64_t) actual
02519 , xtests_comparison_t comp
02520 );
02521 # endif
02522
02523 XTESTS_CALL(int)
02524 xtests_testFailed_boolean(
02525 char const* file
02526 , int line
02527 , char const* function
02528 , char const* expr
02529 , int expected
02530 , int actual
02531 , xtests_comparison_t comp
02532 );
02533
02534 XTESTS_CALL(int)
02535 xtests_testFailed_double(
02536 char const* file
02537 , int line
02538 , char const* function
02539 , char const* expr
02540 , double expected
02541 , double actual
02542 , xtests_comparison_t comp
02543 );
02544
02545 XTESTS_CALL(int)
02546 xtests_testMultibyteStrings(
02547 char const* file
02548 , int line
02549 , char const* function
02550 , char const* expr
02551 , char const* expected
02552 , char const* actual
02553 , xtests_comparison_t comp
02554 );
02555
02556 XTESTS_CALL(int)
02557 xtests_testMultibyteStringsN(
02558 char const* file
02559 , int line
02560 , char const* function
02561 , char const* expr
02562 , char const* expected
02563 , char const* actual
02564 , ptrdiff_t n
02565 , xtests_comparison_t comp
02566 );
02567
02568 XTESTS_CALL(int)
02569 xtests_testMultibyteStringsN_(
02570 char const* file
02571 , int line
02572 , char const* function
02573 , char const* expr
02574 , char const* expected
02575 , char const* actual
02576 , ptrdiff_t n
02577 , size_t cchExpected
02578 , size_t cchActual
02579 , xtests_comparison_t comp
02580 );
02581
02582 #if defined(__cplusplus) && \
02583 !defined(_XTESTS_NO_CPP_API)
02584 template<
02585 typename S0
02586 , typename S1
02587 >
02588 inline
02589 int
02590 xtests_testMultibyteStrings(
02591 char const* file
02592 , int line
02593 , char const* function
02594 , char const* expr
02595 , S0 const& expected
02596 , S1 const& actual
02597 , xtests_comparison_t comp
02598 )
02599 {
02600 stlsoft_ns_using(c_str_ptr_a);
02601
02602 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);
02603 }
02604
02605 template<
02606 typename S0
02607 , typename S1
02608 >
02609 inline
02610 int
02611 xtests_testMultibyteStringsN(
02612 char const* file
02613 , int line
02614 , char const* function
02615 , char const* expr
02616 , S0 const& expected
02617 , S1 const& actual
02618 , int n
02619 , xtests_comparison_t comp
02620 )
02621 {
02622 stlsoft_ns_using(c_str_data_a);
02623
02624 return xtests_testMultibyteStringsN_(
02625 file
02626 , line
02627 , function
02628 , expr
02629 , XTESTS_INVOKE_c_str_data_a_(XTESTS_INVOKE_c_str_data_a_(expected))
02630 , XTESTS_INVOKE_c_str_data_a_(XTESTS_INVOKE_c_str_data_a_(actual))
02631 , n
02632 , c_str_len_n_a(expected, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02633 , c_str_len_n_a(actual, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02634 , comp
02635 );
02636 }
02637 #endif
02638
02639 XTESTS_CALL(int)
02640 xtests_testWideStrings(
02641 char const* file
02642 , int line
02643 , char const* function
02644 , char const* expr
02645 , wchar_t const* expected
02646 , wchar_t const* actual
02647 , xtests_comparison_t comp
02648 );
02649
02650 XTESTS_CALL(int)
02651 xtests_testWideStringsN_(
02652 char const* file
02653 , int line
02654 , char const* function
02655 , char const* expr
02656 , wchar_t const* expected
02657 , wchar_t const* actual
02658 , int n
02659 , size_t cchExpected
02660 , size_t cchActual
02661 , xtests_comparison_t comp
02662 );
02663
02664 XTESTS_CALL(int)
02665 xtests_testWideStringsN(
02666 char const* file
02667 , int line
02668 , char const* function
02669 , char const* expr
02670 , wchar_t const* expected
02671 , wchar_t const* actual
02672 , int n
02673 , xtests_comparison_t comp
02674 );
02675
02676 #if defined(__cplusplus) && \
02677 !defined(_XTESTS_NO_CPP_API)
02678 template<
02679 typename S0
02680 , typename S1
02681 >
02682 inline
02683 int
02684 xtests_testWideStrings(
02685 char const* file
02686 , int line
02687 , char const* function
02688 , char const* expr
02689 , S0 const& expected
02690 , S1 const& actual
02691 , xtests_comparison_t comp
02692 )
02693 {
02694 stlsoft_ns_using(c_str_ptr_w);
02695
02696 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);
02697 }
02698
02699 template<
02700 typename S0
02701 , typename S1
02702 >
02703 inline
02704 int
02705 xtests_testWideStringsN(
02706 char const* file
02707 , int line
02708 , char const* function
02709 , char const* expr
02710 , S0 const& expected
02711 , S1 const& actual
02712 , int n
02713 , xtests_comparison_t comp
02714 )
02715 {
02716 stlsoft_ns_using(c_str_data_w);
02717
02718 return xtests_testWideStringsN_(
02719 file
02720 , line
02721 , function
02722 , expr
02723 , XTESTS_INVOKE_c_str_data_w_(XTESTS_INVOKE_c_str_data_w_(expected))
02724 , XTESTS_INVOKE_c_str_data_w_(XTESTS_INVOKE_c_str_data_w_(actual))
02725 , n
02726 , c_str_len_n_w(expected, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02727 , c_str_len_n_w(actual, stlsoft_static_cast(size_t, (n < 0) ? -n : n))
02728 , comp
02729 );
02730 }
02731 #endif
02732
02733
02734
02735
02736 XTESTS_CALL(int)
02737 xtests_testMultibyteStringContains(
02738 char const* file
02739 , int line
02740 , char const* function
02741 , char const* expr
02742 , char const* expected
02743 , char const* actual
02744 , xtests_comparison_t comp
02745 );
02746
02747 #if defined(__cplusplus) && \
02748 !defined(_XTESTS_NO_CPP_API)
02749 template<
02750 typename S0
02751 , typename S1
02752 >
02753 inline
02754 int
02755 xtests_testMultibyteStringContains(
02756 char const* file
02757 , int line
02758 , char const* function
02759 , char const* expr
02760 , S0 const& expected
02761 , S1 const& actual
02762 , xtests_comparison_t comp
02763 )
02764 {
02765 stlsoft_ns_using(c_str_ptr_a);
02766
02767 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);
02768 }
02769 #endif
02770
02771 XTESTS_CALL(int)
02772 xtests_testWideStringContains(
02773 char const* file
02774 , int line
02775 , char const* function
02776 , char const* expr
02777 , wchar_t const* expected
02778 , wchar_t const* actual
02779 , xtests_comparison_t comp
02780 );
02781
02782 #if defined(__cplusplus) && \
02783 !defined(_XTESTS_NO_CPP_API)
02784 template<
02785 typename S0
02786 , typename S1
02787 >
02788 inline
02789 int
02790 xtests_testWideStringContains(
02791 char const* file
02792 , int line
02793 , char const* function
02794 , char const* expr
02795 , S0 const& expected
02796 , S1 const& actual
02797 , xtests_comparison_t comp
02798 )
02799 {
02800 stlsoft_ns_using(c_str_ptr_w);
02801
02802 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);
02803 }
02804 #endif
02805
02806
02807
02808 XTESTS_CALL(int)
02809 xtests_testPointers(
02810 char const* file
02811 , int line
02812 , char const* function
02813 , char const* expr
02814 , void volatile const* expected
02815 , void volatile const* actual
02816 , xtests_comparison_t comp
02817 );
02818
02819 XTESTS_CALL(int)
02820 xtests_testFunctionPointers(
02821 char const* file
02822 , int line
02823 , char const* function
02824 , char const* expr
02825 , void (*expected)(void)
02826 , void (*actual)(void)
02827 , xtests_comparison_t comp
02828 );
02829
02830 XTESTS_CALL(int)
02831 xtests_testCharactersA(
02832 char const* file
02833 , int line
02834 , char const* function
02835 , char const* expr
02836 , char expected
02837 , char actual
02838 , xtests_comparison_t comp
02839 );
02840 XTESTS_CALL(int)
02841 xtests_testCharactersW(
02842 char const* file
02843 , int line
02844 , char const* function
02845 , char const* expr
02846 , wchar_t expected
02847 , wchar_t actual
02848 , xtests_comparison_t comp
02849 );
02850
02851 XTESTS_CALL(int)
02852 xtests_writeFailMessage(
02853 char const* file
02854 , int line
02855 , char const* function
02856 , char const* message
02857 , char const* qualifyingInformation
02858 );
02859
02860 #if defined(__cplusplus) && \
02861 !defined(_XTESTS_NO_CPP_API)
02862 template<
02863 typename S0
02864 , typename S1
02865 >
02866 inline
02867 int
02868 xtests_writeFailMessage(
02869 char const* file
02870 , int line
02871 , char const* function
02872 , S0 const& message
02873 , S1 const& qualifyingInformation
02874 )
02875 {
02876 stlsoft_ns_using(c_str_ptr_a);
02877
02878 return xtests_writeFailMessage(
02879 file
02880 , line
02881 , function
02882 , XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(message))
02883 , XTESTS_INVOKE_c_str_ptr_a_(XTESTS_INVOKE_c_str_ptr_a_(qualifyingInformation)));
02884 }
02885 #endif
02886
02887 XTESTS_CALL(void)
02888 xtests_caseExcepted(
02889 char const* exceptionType
02890 , char const* exceptionMessage
02891 );
02892
02893 XTESTS_CALL(void)
02894 xtests_caseExceptionExpected(
02895 char const* exceptionType
02896 );
02897
02898
02899 XTESTS_CALL(int)
02900 xtests_floatingPointClose(
02901 double expected
02902 , double actual
02903 );
02904
02913 XTESTS_CALL(double)
02914 xtests_setFloatingPointCloseFactor(
02915 double factor
02916 , double* old
02917 );
02918
02919 #endif
02920
02921
02922
02923
02924
02925 #if defined(__cplusplus) && \
02926 !defined(_XTESTS_NO_CPP_API)
02927
02928 # ifndef _XTESTS_NO_NAMESPACE
02929 namespace cpp
02930 {
02931 # endif
02932
02933
02934 # if defined(STLSOFT_CF_EXCEPTION_SUPPORT)
02935
02936 # ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
02937 class requirement_failed_exception
02938 : public std::runtime_error
02939 {
02940 public:
02941 typedef std::runtime_error parent_class_type;
02942 typedef requirement_failed_exception class_type;
02943
02944 public:
02945 explicit requirement_failed_exception(char const* message)
02946 : parent_class_type(message)
02947 {}
02948 };
02949
02950 inline
02951 void
02952 xtests_require(int success)
02953 {
02954 if(!success)
02955 {
02956 throw requirement_failed_exception("XTESTS_REQUIRE()'d test failed");
02957 }
02958 }
02959
02960 # endif
02961 # endif
02962
02966 class xtest_floatingpoint_factor_scope
02967 {
02968 public:
02970 xtest_floatingpoint_factor_scope(double const& factor)
02971 : m_original(xtests_setFloatingPointCloseFactor(factor, NULL))
02972 {}
02974 ~xtest_floatingpoint_factor_scope() stlsoft_throw_0()
02975 {
02976 xtests_setFloatingPointCloseFactor(m_original, NULL);
02977 }
02978 private:
02979 xtest_floatingpoint_factor_scope(xtest_floatingpoint_factor_scope const&);
02980 xtest_floatingpoint_factor_scope &operator =(xtest_floatingpoint_factor_scope const&);
02981
02982 private:
02983 const double m_original;
02984 };
02985
03000 # define XTESTS_FLOATINGPOINT_FACTOR_SCOPE XTESTS_NS_CPP_QUAL(xtest_floatingpoint_factor_scope)
03001
03002
03003 # ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
03004
03005
03006 template <typename T>
03007 struct xtests_failure_reporter;
03008
03009 template <>
03010 struct xtests_failure_reporter<int>
03011 {
03012 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)
03013 {
03014 stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, expected, actual, comp));
03015 }
03016 };
03017
03018 template <>
03019 struct xtests_failure_reporter<unsigned int>
03020 {
03021 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)
03022 {
03023 stlsoft_static_cast(void, xtests_testFailed_ulong(file, line, function, expr, static_cast<unsigned long>(expected), static_cast<unsigned long>(actual), comp));
03024 }
03025 };
03026
03027 template <>
03028 struct xtests_failure_reporter<signed char>
03029 {
03030 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)
03031 {
03032 stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
03033 }
03034 };
03035
03036 template <>
03037 struct xtests_failure_reporter<unsigned char>
03038 {
03039 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)
03040 {
03041 stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
03042 }
03043 };
03044
03045 template <>
03046 struct xtests_failure_reporter<short>
03047 {
03048 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)
03049 {
03050 stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
03051 }
03052 };
03053
03054 template <>
03055 struct xtests_failure_reporter<unsigned short>
03056 {
03057 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)
03058 {
03059 stlsoft_static_cast(void, xtests_failure_reporter<int>::xtests_report_failure_equal(file, line, function, expr, int(expected), int(actual), comp));
03060 }
03061 };
03062
03063 #ifdef STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
03064 template <>
03065 struct xtests_failure_reporter<stlsoft::sint16_t>
03066 {
03067 static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, stlsoft::sint16_t expected, stlsoft::sint16_t actual, xtests_comparison_t comp)
03068 {
03069 stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, int(expected), int(actual), comp));
03070 }
03071 };
03072 template <>
03073 struct xtests_failure_reporter<stlsoft::uint16_t>
03074 {
03075 static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, stlsoft::uint16_t expected, stlsoft::uint16_t actual, xtests_comparison_t comp)
03076 {
03077 stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, int(expected), int(actual), comp));
03078 }
03079 };
03080 #endif
03081
03082 #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
03083 template <>
03084 struct xtests_failure_reporter<stlsoft::sint32_t>
03085 {
03086 static void xtests_report_failure_equal(char const* file, int line, char const* function, char const* expr, stlsoft::sint32_t expected, stlsoft::sint32_t actual, xtests_comparison_t comp)
03087 {
03088 stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, int(expected), int(actual), comp));
03089 }
03090 };
03091 template <>
03092 struct xtests_failure_reporter<stlsoft::uint32_t>
03093 {
03094 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)
03095 {
03096 stlsoft_static_cast(void, xtests_testFailed_int(file, line, function, expr, int(expected), int(actual), comp));
03097 }
03098 };
03099 #endif
03100
03101 template <>
03102 struct xtests_failure_reporter<long>
03103 {
03104 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)
03105 {
03106 stlsoft_static_cast(void, xtests_testFailed_long(file, line, function, expr, expected, actual, comp));
03107 }
03108 };
03109
03110 template <>
03111 struct xtests_failure_reporter<unsigned long>
03112 {
03113 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)
03114 {
03115 stlsoft_static_cast(void, xtests_testFailed_ulong(file, line, function, expr, expected, actual, comp));
03116 }
03117 };
03118
03119 # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
03120 template <>
03121 struct xtests_failure_reporter< stlsoft_ns_qual(ss_sint64_t)>
03122 {
03123 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)
03124 {
03125 stlsoft_static_cast(void, xtests_testFailed_longlong(file, line, function, expr, expected, actual, comp));
03126 }
03127 };
03128
03129 template <>
03130 struct xtests_failure_reporter< stlsoft_ns_qual(ss_uint64_t)>
03131 {
03132 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)
03133 {
03134 stlsoft_static_cast(void, xtests_testFailed_ulonglong(file, line, function, expr, expected, actual, comp));
03135 }
03136 };
03137 # endif
03138
03139 template <>
03140 struct xtests_failure_reporter<bool>
03141 {
03142 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)
03143 {
03144 stlsoft_static_cast(void, xtests_testFailed_boolean(file, line, function, expr, expected, actual, comp));
03145 }
03146 };
03147
03148
03149
03150 template<
03151 typename T1
03152 , typename T2
03153 >
03154 struct xtests_integer_failure_reporter_selector
03155 {
03156 private:
03157 enum { are_types_same = (0 != stlsoft::is_same_type<T1, T2>::value) };
03158 enum { T1_is_larger_than_T2 = sizeof(T1) > sizeof(T2) };
03159
03160 typedef typename stlsoft::select_first_type_if< T1
03161 , T2
03162 , T1_is_larger_than_T2
03163 >::type larger_type_;
03164
03165 public:
03166 typedef xtests_failure_reporter<larger_type_> type;
03167 };
03168
03169 template<
03170 typename I1
03171 , typename I2
03172 >
03173 inline
03174 void
03175 xtests_reportFailedIntegerComparison(
03176 char const* file
03177 , int line
03178 , char const* function
03179 , char const* expr
03180 , I1 const& expected
03181 , I2 const& actual
03182 , xtests_comparison_t comp
03183 )
03184 {
03185 STLSOFT_STATIC_ASSERT(0 != stlsoft::is_integral_type<I1>::value);
03186 STLSOFT_STATIC_ASSERT(0 != stlsoft::is_integral_type<I2>::value);
03187
03188 # if defined(STLSOFT_COMPILER_IS_BORLAND)
03189
03190 xtests_integer_failure_reporter_selector<I1, I2>::type::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
03191
03192 # else
03193
03194 typedef typename xtests_integer_failure_reporter_selector<I1, I2>::type failure_reporter_t;
03195
03196 failure_reporter_t::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
03197
03198 # endif
03199 }
03200
03201 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
03202 _MSC_VER >= 1310 && \
03203 !defined(_WIN64) && \
03204 defined(_Wp64)
03205
03206
03207
03208
03209 inline
03210 void
03211 xtests_reportFailedIntegerComparison(
03212 char const* file
03213 , int line
03214 , char const* function
03215 , char const* expr
03216 , unsigned int expected
03217 , size_t actual
03218 , xtests_comparison_t comp
03219 )
03220 {
03221 stlsoft_static_cast(void, xtests_testFailed_ulong(file, line, function, expr, static_cast<unsigned long>(expected), static_cast<unsigned long>(actual), comp));
03222 }
03223 #endif
03224
03225 inline
03226 void
03227 xtests_reportFailedIntegerComparison(
03228 char const* file
03229 , int line
03230 , char const* function
03231 , char const* expr
03232 , bool expected
03233 , bool actual
03234 , xtests_comparison_t comp
03235 )
03236 {
03237 # if defined(STLSOFT_COMPILER_IS_BORLAND)
03238
03239 xtests_integer_failure_reporter_selector<bool, bool>::type::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
03240
03241 # else
03242
03243 typedef xtests_integer_failure_reporter_selector<bool, bool>::type failure_reporter_t;
03244
03245 failure_reporter_t::xtests_report_failure_equal(file, line, function, expr, expected, actual, comp);
03246
03247 # endif
03248 }
03249
03250 #if 0
03251 inline
03252 void
03253 xtests_reportFailedIntegerComparison(
03254 char const* file
03255 , int line
03256 , char const* function
03257 , char const* expr
03258 , int expected
03259 , bool actual
03260 , xtests_comparison_t comp
03261 )
03262 {
03263 xtests_reportFailedIntegerComparison(file, line, function, expr, 0 != expected, actual, comp);
03264 }
03265 #endif
03266
03267 inline
03268 void
03269 xtests_reportFailedFloatingPointComparison(
03270 char const* file
03271 , int line
03272 , char const* function
03273 , char const* expr
03274 , double const& expected
03275 , double const& actual
03276 , xtests_comparison_t comp
03277 )
03278 {
03279 stlsoft_static_cast(void, xtests_testFailed_double(file, line, function, expr, expected, actual, comp));
03280 }
03281
03282 template<
03283 typename I
03284 , typename II
03285 >
03286 inline
03287 int
03288 xtests_test_integer_compare_to_range_(
03289 char const*
03290 , int
03291 , char const*
03292 , char const*
03293 , II begin
03294 , II end
03295 , I const& actual
03296 , xtests_comparison_t comp
03297 )
03298 {
03299 for(; begin != end; ++begin)
03300 {
03301 I const& expected = *begin;
03302
03303 switch(comp)
03304 {
03305 case xtestsComparisonEqual:
03306 case xtestsComparisonApproxEqual:
03307 if(expected == actual)
03308 {
03309 return true;
03310 }
03311 break;
03312 case xtestsComparisonNotEqual:
03313 case xtestsComparisonApproxNotEqual:
03314 if(expected != actual)
03315 {
03316 return true;
03317 }
03318 break;
03319 case xtestsComparisonGreaterThan:
03320 if(actual > expected)
03321 {
03322 return true;
03323 }
03324 break;
03325 case xtestsComparisonLessThan:
03326 if(actual < expected)
03327 {
03328 return true;
03329 }
03330 break;
03331 case xtestsComparisonGreaterThanOrEqual:
03332 if(actual >= expected)
03333 {
03334 return true;
03335 }
03336 break;
03337 case xtestsComparisonLessThanOrEqual:
03338 if(actual <= expected)
03339 {
03340 return true;
03341 }
03342 break;
03343 default:
03344 STLSOFT_MESSAGE_ASSERT("unrecognised enumerator", false);
03345 case xtestsComparison_max_enumerator:
03346 xtests_abend("invalid test comparison type: test framework may be out of date!");
03347 break;
03348 }
03349 }
03350
03351 return false;
03352 }
03353
03354 template<
03355 typename I
03356 , typename II
03357 >
03358 inline
03359 int
03360 xtests_test_integer_any_in_range(
03361 char const* file
03362 , int line
03363 , char const* function
03364 , char const* expr
03365 , II begin
03366 , II end
03367 , I const& actual
03368 , xtests_comparison_t comp
03369 )
03370 {
03371 int comparisonSucceeded = xtests_test_integer_compare_to_range_(file, line, function, expr, begin, end, actual, comp);
03372
03373 if(comparisonSucceeded)
03374 {
03375 xtests_testPassed(file, line, function, expr);
03376 }
03377 else
03378 {
03379 #if 0
03380 xtests_reportFailedIntegerComparison(file, line, function, expr, expected, actual, comp);
03381 #else
03382 xtests_testFailed(file, line, function, expr);
03383 #endif
03384 }
03385
03386 return comparisonSucceeded;
03387 }
03388
03389 template<
03390 typename I1
03391 , typename I2
03392 >
03393 inline
03394 int
03395 xtests_test_integer(
03396 char const* file
03397 , int line
03398 , char const* function
03399 , char const* expr
03400 , I1 const& expected
03401 , I2 const& actual
03402 , xtests_comparison_t comp
03403 )
03404 {
03405 int comparisonSucceeded = false;
03406
03407 switch(comp)
03408 {
03409 case xtestsComparisonEqual:
03410 case xtestsComparisonApproxEqual:
03411 if(expected == actual)
03412 {
03413 comparisonSucceeded = true;
03414 }
03415 break;
03416 case xtestsComparisonNotEqual:
03417 case xtestsComparisonApproxNotEqual:
03418 if(expected != actual)
03419 {
03420 comparisonSucceeded = true;
03421 }
03422 break;
03423 case xtestsComparisonGreaterThan:
03424 if(actual > expected)
03425 {
03426 comparisonSucceeded = true;
03427 }
03428 break;
03429 case xtestsComparisonLessThan:
03430 if(actual < expected)
03431 {
03432 comparisonSucceeded = true;
03433 }
03434 break;
03435 case xtestsComparisonGreaterThanOrEqual:
03436 if(actual >= expected)
03437 {
03438 comparisonSucceeded = true;
03439 }
03440 break;
03441 case xtestsComparisonLessThanOrEqual:
03442 if(actual <= expected)
03443 {
03444 comparisonSucceeded = true;
03445 }
03446 break;
03447 default:
03448 STLSOFT_MESSAGE_ASSERT("unrecognised enumerator", false);
03449 case xtestsComparison_max_enumerator:
03450 xtests_abend("invalid test comparison type: test framework may be out of date!");
03451 break;
03452 }
03453
03454 if(comparisonSucceeded)
03455 {
03456 xtests_testPassed(file, line, function, expr);
03457 }
03458 else
03459 {
03460 xtests_reportFailedIntegerComparison(file, line, function, expr, expected, actual, comp);
03461 }
03462
03463 return comparisonSucceeded;
03464 }
03465
03466 template<
03467 typename I0
03468 , typename I1
03469 >
03470 inline
03471 int
03472 xtests_test_integer_one_of(
03473 char const* file
03474 , int line
03475 , char const* function
03476 , char const* expr
03477 , I1 const& actual
03478 , I0 const& expected0
03479 , I0 const& expected1
03480 , I0 const& expected2
03481 , I0 const& expected3
03482 , I0 const& expected4
03483 , I0 const& expected5
03484 , I0 const& expected6
03485 , I0 const& expected7
03486 , xtests_comparison_t comp
03487 )
03488 {
03489 I0 const range[] = {
03490 expected0
03491 , expected1
03492 , expected2
03493 , expected3
03494 , expected4
03495 , expected5
03496 , expected6
03497 , expected7
03498 };
03499
03500 return xtests_test_integer_any_in_range(file, line, function, expr, &range[0], &range[0] + STLSOFT_NUM_ELEMENTS(range), actual, comp);
03501 }
03502
03503 template<
03504 typename I0
03505 , typename I1
03506 >
03507 inline
03508 int
03509 xtests_test_integer_one_of(
03510 char const* file
03511 , int line
03512 , char const* function
03513 , char const* expr
03514 , I1 const& actual
03515 , I0 const& expected0
03516 , I0 const& expected1
03517 , I0 const& expected2
03518 , I0 const& expected3
03519 , I0 const& expected4
03520 , I0 const& expected5
03521 , I0 const& expected6
03522 , xtests_comparison_t comp
03523 )
03524 {
03525 return xtests_test_integer_one_of(
03526 file, line, function, expr
03527 , actual
03528 , expected0, expected1, expected2, expected3, expected4, expected5, expected6, expected0
03529 , comp
03530 );
03531 }
03532
03533 template<
03534 typename I0
03535 , typename I1
03536 >
03537 inline
03538 int
03539 xtests_test_integer_one_of(
03540 char const* file
03541 , int line
03542 , char const* function
03543 , char const* expr
03544 , I1 const& actual
03545 , I0 const& expected0
03546 , I0 const& expected1
03547 , I0 const& expected2
03548 , I0 const& expected3
03549 , I0 const& expected4
03550 , I0 const& expected5
03551 , xtests_comparison_t comp
03552 )
03553 {
03554 return xtests_test_integer_one_of(
03555 file, line, function, expr
03556 , actual
03557 , expected0, expected1, expected2, expected3, expected4, expected5, expected0, expected0
03558 , comp
03559 );
03560 }
03561
03562 template<
03563 typename I0
03564 , typename I1
03565 >
03566 inline
03567 int
03568 xtests_test_integer_one_of(
03569 char const* file
03570 , int line
03571 , char const* function
03572 , char const* expr
03573 , I1 const& actual
03574 , I0 const& expected0
03575 , I0 const& expected1
03576 , I0 const& expected2
03577 , I0 const& expected3
03578 , I0 const& expected4
03579 , xtests_comparison_t comp
03580 )
03581 {
03582 return xtests_test_integer_one_of(
03583 file, line, function, expr
03584 , actual
03585 , expected0, expected1, expected2, expected3, expected4, expected0, expected0, expected0
03586 , comp
03587 );
03588 }
03589
03590 template<
03591 typename I0
03592 , typename I1
03593 >
03594 inline
03595 int
03596 xtests_test_integer_one_of(
03597 char const* file
03598 , int line
03599 , char const* function
03600 , char const* expr
03601 , I1 const& actual
03602 , I0 const& expected0
03603 , I0 const& expected1
03604 , I0 const& expected2
03605 , I0 const& expected3
03606 , xtests_comparison_t comp
03607 )
03608 {
03609 return xtests_test_integer_one_of(
03610 file, line, function, expr
03611 , actual
03612 , expected0, expected1, expected2, expected3, expected0, expected0, expected0, expected0
03613 , comp
03614 );
03615 }
03616
03617 template<
03618 typename I0
03619 , typename I1
03620 >
03621 inline
03622 int
03623 xtests_test_integer_one_of(
03624 char const* file
03625 , int line
03626 , char const* function
03627 , char const* expr
03628 , I1 const& actual
03629 , I0 const& expected0
03630 , I0 const& expected1
03631 , I0 const& expected2
03632 , xtests_comparison_t comp
03633 )
03634 {
03635 return xtests_test_integer_one_of(
03636 file, line, function, expr
03637 , actual
03638 , expected0, expected1, expected2, expected0, expected0, expected0, expected0, expected0
03639 , comp
03640 );
03641 }
03642
03643 template<
03644 typename I0
03645 , typename I1
03646 >
03647 inline
03648 int
03649 xtests_test_integer_one_of(
03650 char const* file
03651 , int line
03652 , char const* function
03653 , char const* expr
03654 , I1 const& actual
03655 , I0 const& expected0
03656 , I0 const& expected1
03657 , xtests_comparison_t comp
03658 )
03659 {
03660 return xtests_test_integer_one_of(
03661 file, line, function, expr
03662 , actual
03663 , expected0, expected1, expected0, expected0, expected0, expected0, expected0, expected0
03664 , comp
03665 );
03666 }
03667
03668
03669 inline
03670 int
03671 xtests_test_character(
03672 char const* file
03673 , int line
03674 , char const* function
03675 , char const* expr
03676 , char expected
03677 , char actual
03678 , xtests_comparison_t comp
03679 )
03680 {
03681 return xtests_testCharactersA(file, line, function, expr, expected, actual, comp);
03682 }
03683 inline
03684 int
03685 xtests_test_character(
03686 char const* file
03687 , int line
03688 , char const* function
03689 , char const* expr
03690 , wchar_t expected
03691 , wchar_t actual
03692 , xtests_comparison_t comp
03693 )
03694 {
03695 return xtests_testCharactersW(file, line, function, expr, expected, actual, comp);
03696 }
03697
03698 inline
03699 int
03700 xtests_test_floating_point(
03701 char const* file
03702 , int line
03703 , char const* function
03704 , char const* expr
03705 , double const& expected
03706 , double const& actual
03707 , xtests_comparison_t comp
03708 )
03709 {
03710 int comparisonSucceeded = false;
03711
03712 switch(comp)
03713 {
03714 case xtestsComparisonEqual:
03715 if(expected == actual)
03716 {
03717 comparisonSucceeded = true;
03718 }
03719 break;
03720 case xtestsComparisonApproxEqual:
03721 if(xtests_floatingPointClose(expected, actual))
03722 {
03723 comparisonSucceeded = true;
03724 }
03725 break;
03726 case xtestsComparisonNotEqual:
03727 if(expected != actual)
03728 {
03729 comparisonSucceeded = true;
03730 }
03731 break;
03732 case xtestsComparisonApproxNotEqual:
03733 if(!xtests_floatingPointClose(expected, actual))
03734 {
03735 comparisonSucceeded = true;
03736 }
03737 break;
03738 case xtestsComparisonGreaterThan:
03739 if(actual > expected)
03740 {
03741 comparisonSucceeded = true;
03742 }
03743 break;
03744 case xtestsComparisonLessThan:
03745 if(actual < expected)
03746 {
03747 comparisonSucceeded = true;
03748 }
03749 break;
03750 case xtestsComparisonGreaterThanOrEqual:
03751 if(actual >= expected)
03752 {
03753 comparisonSucceeded = true;
03754 }
03755 break;
03756 case xtestsComparisonLessThanOrEqual:
03757 if(actual <= expected)
03758 {
03759 comparisonSucceeded = true;
03760 }
03761 break;
03762 default:
03763 STLSOFT_MESSAGE_ASSERT("unrecognised enumerator", false);
03764 case xtestsComparison_max_enumerator:
03765 xtests_abend("invalid test comparison type: test framework may be out of date!");
03766 break;
03767 }
03768
03769 if(comparisonSucceeded)
03770 {
03771 stlsoft_static_cast(void, xtests_testPassed(file, line, function, expr));
03772 }
03773 else
03774 {
03775 stlsoft_static_cast(void, xtests_reportFailedFloatingPointComparison(file, line, function, expr, expected, actual, comp));
03776 }
03777
03778 return comparisonSucceeded;
03779 }
03780
03781 # endif
03782
03783 # ifndef _XTESTS_NO_NAMESPACE
03784 }
03785 # endif
03786
03787 #else
03788
03789 # define XTESTS_REQUIRE(test) XTESTS_NS_C_QUAL(xtests_require_C)(!(!(test)))
03790
03791 #endif
03792
03795 XTESTS_CALL(int)
03796 xtests_require_C(
03797 int success
03798 );
03799
03802 XTESTS_CALL(int)
03803 xTests_hasRequiredConditionFailed(void);
03804
03805
03806
03807
03808
03809 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
03810 XTESTS_CALL(int)
03811 xtests_commandLine_parseVerbosity(
03812 int argc
03813 , char** argv
03814 , int* verbosity
03815 );
03816 #endif
03817
03839 #define XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, pverbosity) \
03840 \
03841 stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_commandLine_parseVerbosity)((argc), (argv), (pverbosity)))
03842
03843
03844
03845
03846
03847 #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
03848 # define XTESTS_FAIL_WITH_QUALIFIER(msg, qualifier) XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, qualifier)
03849 # define XTESTS_FAIL(msg) XTESTS_TEST_FAIL(msg)
03850 # define XTESTS_PASSED() XTESTS_TEST_PASSED()
03851 # define XTESTS_TEST_MULTIBYTE_STRINGS_EQUAL XTESTS_TEST_MULTIBYTE_STRING_EQUAL
03852 #endif
03853
03854
03855
03856
03857
03858 #ifndef _XTESTS_NO_NAMESPACE
03859 }
03860 }
03861 #endif
03862
03863
03864
03865 #endif
03866
03867