From c270c02940b931be3dfa0a102ce990a0471335b5 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Sun, 21 Feb 2016 17:10:52 +0100 Subject: [PATCH] Fixed asserts doxygen & integrated them into the assertion reference --- doc/assert.rst | 127 +----- include/criterion/assert.h | 629 +++++++++----------------- include/criterion/internal/assert.h | 168 +++++++ include/criterion/internal/redirect.h | 48 ++ include/criterion/redirect.h | 225 +++------ 5 files changed, 509 insertions(+), 688 deletions(-) diff --git a/doc/assert.rst b/doc/assert.rst index a80fe29..439b333 100644 --- a/doc/assert.rst +++ b/doc/assert.rst @@ -12,136 +12,35 @@ macros to this list. Hence only ``assert`` macros are represented here. All ``assert`` macros may take an optional ``printf`` format string and parameters. +Base Assertions +----------------- + +.. doxygengroup:: BaseAsserts + Common Assertions ----------------- -=========================================================================== =========================================================================== =========================================== -Macro Passes if and only if Notes -=========================================================================== =========================================================================== =========================================== -cr_assert(Condition, [FormatString, [Args...]]) ``Condition`` is true. ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_not(Condition, [FormatString, [Args...]]) ``Condition`` is false. ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_null(Value, [FormatString, [Args...]]) ``Value`` is ``NULL``. ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_not_null(Value, [FormatString, [Args...]]) ``Value`` is not ``NULL``. ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_eq(Actual, Expected, [FormatString, [Args...]]) ``Actual`` is equal to ``Expected``. Compatible with C++ operator overloading ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_neq(Actual, Unexpected, [FormatString, [Args...]]) ``Actual`` is not equal to ``Unexpected``. Compatible with C++ operator overloading ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_lt(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is less than ``Reference``. Compatible with C++ operator overloading ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_leq(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is less or equal to ``Reference``. Compatible with C++ operator overloading ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_gt(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is greater than ``Reference``. Compatible with C++ operator overloading ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_geq(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is greater or equal to ``Reference``. Compatible with C++ operator overloading ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_float_eq(Actual, Expected, Epsilon, [FormatString, [Args...]]) ``Actual`` is equal to ``Expected`` with a tolerance of ``Epsilon``. Use this to test equality between floats ---------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_float_neq(Actual, Unexpected, Epsilon, [FormatString, [Args...]]) ``Actual`` is not equal to ``Unexpected`` with a tolerance of ``Epsilon``. Use this to test inequality between floats -=========================================================================== =========================================================================== =========================================== +.. doxygengroup:: CommonBinAsserts +.. doxygengroup:: CommonUnaryAsserts +.. doxygengroup:: FloatAsserts String Assertions ----------------- -Note: these macros are meant to deal with *native* strings, i.e. char arrays. -Most of them won't work on ``std::string`` in C++, with some exceptions -- for -``std::string``, you should use regular comparison assersions, as listed above. - -================================================================ =================================================================== =========================================== -Macro Passes if and only if Notes -================================================================ =================================================================== =========================================== -cr_assert_str_empty(Value, [FormatString, [Args...]]) ``Value`` is an empty string. Also works on std::string ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_not_empty(Value, [FormatString, [Args...]]) ``Value`` is not an empty string. Also works on std::string ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_eq(Actual, Expected, [FormatString, [Args...]]) ``Actual`` is lexicographically equal to ``Expected``. ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_neq(Actual, Unexpected, [FormatString, [Args...]]) ``Actual`` is not lexicographically equal to ``Unexpected``. ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_lt(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is lexicographically less than ``Reference``. ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_leq(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is lexicographically less or equal to ``Reference``. ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_gt(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is lexicographically greater than ``Reference``. ----------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------- -cr_assert_str_geq(Actual, Reference, [FormatString, [Args...]]) ``Actual`` is lexicographically greater or equal to ``Reference``. -================================================================ =================================================================== =========================================== +.. doxygengroup:: StringAsserts Array Assertions ----------------- -=============================================================================== =========================================================================== =========================================== -Macro Passes if and only if Notes -=============================================================================== =========================================================================== =========================================== -cr_assert_arr_eq(Actual, Expected, Size, [FormatString, [Args...]]) ``Actual`` is byte-to-byte equal to ``Expected``. This should not be used on struct arrays, - consider using ``cr_assert_arr_eq_cmp`` - instead. -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_neq(Actual, Unexpected, Size, [FormatString, [Args...]]) ``Actual`` is not byte-to-byte equal to ``Unexpected``. This should not be used on struct arrays, - consider using ``cr_assert_arr_neq_cmp`` - instead. -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_eq_cmp(Actual, Expected, Size, Cmp, [FormatString, [Args...]]) ``Actual`` is comparatively equal to ``Expected`` Only available in C++ and GNU C99 -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_neq_cmp(Actual, Unexpected, Size, Cmp, [FormatString, [Args...]]) ``Actual`` is not comparatively equal to ``Expected`` Only available in C++ and GNU C99 -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_lt_cmp(Actual, Reference, Size, Cmp, [FormatString, [Args...]]) ``Actual`` is comparatively less than ``Reference`` Only available in C++ and GNU C99 -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_leq_cmp(Actual, Reference, Size, Cmp, [FormatString, [Args...]]) ``Actual`` is comparatively less or equal to ``Reference`` Only available in C++ and GNU C99 -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_gt_cmp(Actual, Reference, Size, Cmp, [FormatString, [Args...]]) ``Actual`` is comparatively greater than ``Reference`` Only available in C++ and GNU C99 -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_arr_geq_cmp(Actual, Reference, Size, Cmp, [FormatString, [Args...]]) ``Actual`` is comparatively greater or equal to ``Reference`` Only available in C++ and GNU C99 -=============================================================================== =========================================================================== =========================================== +.. doxygengroup:: ArrayAsserts +.. doxygengroup:: SafeArrCmpAsserts Exception Assertions -------------------- -The following assertion macros are only defined for C++. - -=============================================================================== =========================================================================== =========================================== -Macro Passes if and only if Notes -=============================================================================== =========================================================================== =========================================== -cr_assert_throw(Statement, Exception, [FormatString, [Args...]]) ``Statement`` throws an instance of ``Exception``. -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_no_throw(Statement, Exception, [FormatString, [Args...]]) ``Statement`` does not throws an instance of ``Exception``. -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_any_throw(Statement, [FormatString, [Args...]]) ``Statement`` throws any kind of exception. -------------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- -cr_assert_none_throw(Statement, [FormatString, [Args...]]) ``Statement`` does not throw any exception. -=============================================================================== =========================================================================== =========================================== +.. doxygengroup:: ExceptionAsserts File Assertions --------------- -=================================================================================== ============================================================================ =========================================== -Macro Passes if and only if Notes -=================================================================================== ============================================================================ =========================================== -cr_assert_file_contents_eq_str(File, ExpectedContents, [FormatString, [Args...]]) The contents of ``File`` are equal to the string ``ExpectedContents``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_file_contents_neq_str(File, ExpectedContents, [FormatString, [Args...]]) The contents of ``File`` are not equal to the string ``ExpectedContents``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stdout_eq_str(ExpectedContents, [FormatString, [Args...]]) The contents of ``stdout`` are equal to the string ``ExpectedContents``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stdout_neq_str(ExpectedContents, [FormatString, [Args...]]) The contents of ``stdout`` are not equal to the string ``ExpectedContents``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stderr_eq_str(ExpectedContents, [FormatString, [Args...]]) The contents of ``stderr`` are equal to the string ``ExpectedContents``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stderr_neq_str(ExpectedContents, [FormatString, [Args...]]) The contents of ``stderr`` are not equal to the string ``ExpectedContents``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_file_contents_eq(File, RefFile, [FormatString, [Args...]]) The contents of ``File`` are equal to the contents of ``RefFile``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_file_contents_neq(File, RefFile, [FormatString, [Args...]]) The contents of ``File`` are not equal to the contents of ``RefFile``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stdout_eq(RefFile, [FormatString, [Args...]]) The contents of ``stdout`` are equal to the contents of ``RefFile``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stdout_neq(RefFile, [FormatString, [Args...]]) The contents of ``stdout`` are not equal to the contents of ``RefFile``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stderr_eq(RefFile, [FormatString, [Args...]]) The contents of ``stderr`` are equal to the contents of ``RefFile``. ------------------------------------------------------------------------------------ ---------------------------------------------------------------------------- ------------------------------------------- -cr_assert_stderr_neq(RefFile, [FormatString, [Args...]]) The contents of ``stderr`` are not equal to the contents of ``RefFile``. -=================================================================================== ============================================================================ =========================================== - +.. doxygengroup:: FileAsserts diff --git a/include/criterion/assert.h b/include/criterion/assert.h index 102167b..a159425 100644 --- a/include/criterion/assert.h +++ b/include/criterion/assert.h @@ -33,8 +33,6 @@ # include # endif -# include "internal/assert.h" - /** * @defgroup BaseAsserts Base assertions * @{ @@ -43,40 +41,32 @@ /** * Fails always. * - * Call: \c cr_assert_fail([FormatString, [Args...]]). - * * The test is marked as failure and the execution of the function is aborted. * * The optional string is printed on failure. * - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert_fail(...) CR_EXPAND(cr_fail(CR_FAIL_ABORT_, __VA_ARGS__)) +# define cr_assert_fail(FormatString, ...) /** * Fails always. * - * Call: \c cr_expect_fail([FormatString, [Args...]]). - * * The test is marked as failure but the execution will continue. * * The optional string is printed on failure. * - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_fail(...) CR_EXPAND(cr_fail(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# define cr_expect_fail(FormatString, ...) /** * Passes if Condition is true * - * Call: \c cr_assert(Condition, [FormatString, [Args...]]). - * * Evaluates the condition and passes if it is true. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -84,36 +74,30 @@ * The optional string is printed on failure. * * @param[in] Condition Condition to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert(...) CR_EXPAND(cr_assert_(__VA_ARGS__)) +# define cr_assert(Condition, FormatString, ...) /** * Passes if Condition is true * - * Call: \c cr_expect(Condition, [FormatString, [Args...]]). - * * Evaluates the condition and passes if it is true. * Otherwise the test is marked as failure but the execution will continue. * * The optional string is printed on failure. * * @param[in] Condition Condition to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect(...) CR_EXPAND(cr_expect_(__VA_ARGS__)) +# define cr_expect(Condition, FormatString, ...) /** * Passes if Condition is false * - * Call: \c cr_assert_not(Condition, [FormatString, [Args...]]) - * * Evaluates the condition and passes if it is false. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -121,30 +105,26 @@ * The optional string is printed on failure. * * @param[in] Condition Condition to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert_not(...) CR_EXPAND(cr_assert_not_(__VA_ARGS__)) +# define cr_assert_not(Condition, FormatString, ...) /** * Passes if Condition is false * - * Call: \c cr_expect_not(Condition, [FormatString, [Args...]]) - * * Evaluates the condition and passes if it is false. * Otherwise the test is marked as failure but the execution will continue. * * The optional string is printed on failure. * * @param[in] Condition Condition to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_not(...) CR_EXPAND(cr_expect_not_(__VA_ARGS__)) +# define cr_expect_not(Condition, FormatString, ...) /**@}*/ @@ -156,8 +136,6 @@ /** * Passes if Actual is equal to Expected * - * Call: \c cr_assert_eq(Actual, Expected, [FormatString, [Args...]]) - * * Passes if Actual is equal to Expected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -168,18 +146,15 @@ * * @param[in] Actual Value to test * @param[in] Expected Expected value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert_eq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# define cr_assert_eq(Actual, Expected, FormatString, ...) /** * Passes if Actual is equal to Expected * - * Call: \c cr_expect_eq(Actual, Expected, [FormatString, [Args...]]) - * * Passes if Actual is equal to Expected. * Otherwise the test is marked as failure but the execution will continue. * @@ -189,18 +164,15 @@ * * @param[in] Actual Value to test * @param[in] Expected Expected value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_eq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# define cr_expect_eq(Actual, Expected, FormatString, ...) /** * Passes if Actual is not equal to Unexpected * - * Call: \c cr_assert_neq(Actual, Unexpected, [FormatString, [Args...]]) - * * Passes if Actual is not equal to Unexpected * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -211,18 +183,15 @@ * * @param[in] Actual Value to test * @param[in] Unexpected Unexpected Value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert_neq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# define cr_assert_neq(Actual, Unexpected, FormatString, ...) /** * Passes if Actual is not equal to Unexpected * - * Call: \c cr_expect_neq(Actual, Unexpected, [FormatString, [Args...]]) - * * Passes if Actual is not equal to Unexpected. * Otherwise the test is marked as failure but the execution will continue. * @@ -232,18 +201,15 @@ * * @param[in] Actual Value to test * @param[in] Unexpected Unexpected Value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_neq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# define cr_expect_neq(Actual, Unexpected, FormatString, ...) /** * Passes if Actual is less than Reference * - * Call: \c cr_assert_lt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is less than Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -254,18 +220,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert_lt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, <, __VA_ARGS__)) +# define cr_assert_lt(Actual, Reference, FormatString, ...) /** * Passes if Actual is less than Reference * - * Call: \c cr_expect_lt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is less than Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -275,19 +238,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_lt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, <, __VA_ARGS__)) - +# define cr_expect_lt(Actual, Reference, FormatString, ...) /** * Passes if Actual is less or equal to Reference * - * Call: \c cr_assert_leq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is less or equal to Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -298,17 +257,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_leq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, <=, __VA_ARGS__)) +# define cr_assert_leq(Actual, Reference, FormatString, ...) /** * Passes if Actual is less or equal to Reference * - * Call: \c cr_expect_leq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is less or equal to Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -318,19 +275,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_leq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, <=, __VA_ARGS__)) - +# define cr_expect_leq(Actual, Reference, FormatString, ...) /** * Passes if Actual is greater than Reference * - * Call: \c cr_assert_gt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is greater than Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -341,17 +294,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_gt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, >, __VA_ARGS__)) +# define cr_assert_gt(Actual, Reference, FormatString, ...) /** * Passes if Actual is greater than Reference * - * Call: \c cr_expect_gt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is greater than Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -361,18 +312,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_expect_gt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, >, __VA_ARGS__)) - +# define cr_expect_gt(Actual, Reference, FormatString, ...) /** * Passes if Actual is greater or equal to Reference * - * Call: \c cr_assert_geq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is greater or equal to Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -383,17 +331,15 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_geq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, >=, __VA_ARGS__)) +# define cr_assert_geq(Actual, Reference, FormatString, ...) /** * Passes if Actual is greater or equal to Reference * - * Call: \c cr_expect_geq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is greater or equal to Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -403,11 +349,11 @@ * * @param[in] Actual Value to test * @param[in] Reference Reference value - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_expect_geq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, >=, __VA_ARGS__)) +# define cr_expect_geq(Actual, Reference, FormatString, ...) /**@}*/ @@ -419,8 +365,6 @@ /** * Passes if Value is NULL * - * Call: \c cr_expect_null(Value, [FormatString, [Args...]]) - * * Passes if Value is NULL. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -428,65 +372,57 @@ * The optional string is printed on failure. * * @param[in] Actual Value to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_ABORT_, ==, CRITERION_ASSERT_MSG_IS_NOT_NULL, __VA_ARGS__)) +# define cr_assert_null(Value, FormatString, ...) /** * Passes if Value is NULL * - * Call: \c cr_expect_null(Value, [FormatString, [Args...]]) - * * Passes if Value is NULL. * Otherwise the test is marked as failure but the execution will continue. * * The optional string is printed on failure. * * @param[in] Actual Value to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_CONTINUES_, ==, CRITERION_ASSERT_MSG_IS_NOT_NULL, __VA_ARGS__)) +# define cr_expect_null(Value, FormatString, ...) /** * Passes if Value is not NULL * - * Call: \c cr_assert_not_null(Value, [FormatString, [Args...]]) - * * Passes if Value is not NULL. * Otherwise the test is marked as failure and the execution of the function * is aborted. * * The optional string is printed on failure. * - * @param[in] Actual Value to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] Value Value to test + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_not_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_ABORT_, !=, CRITERION_ASSERT_MSG_IS_NULL, __VA_ARGS__)) +# define cr_assert_not_null(Value, FormatString, ...) /** * Passes if Value is not NULL * - * Call: \c cr_expect_not_null(Value, [FormatString, [Args...]]) - * * Passes if Value is not NULL. * Otherwise the test is marked as failure but the execution will continue. * * The optional string is printed on failure. * - * @param[in] Actual Value to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] Value Value to test + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_not_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_CONTINUES_, !=, CRITERION_ASSERT_MSG_IS_NULL, __VA_ARGS__)) +# define cr_expect_not_null(Value, FormatString, ...) /**@}*/ @@ -498,9 +434,6 @@ /** * Passes if Actual is equal to Expected with a tolerance of Epsilon * - * Call: \c cr_assert_float_eq(Actual, Expected, Epsilon, [FormatString, - * [Args...]]) - * * Passes if Actual is equal to Expected with a tolerance of Epsilon. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -512,18 +445,15 @@ * @param[in] Actual Value to test * @param[in] Expected Expected value * @param[in] Epsilon Tolerance between Actual and Expected - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_float_eq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_ABORT_, cr_assert_float_eq_op_, __VA_ARGS__)) +# define cr_assert_float_eq(Actual, Expected, Epsilon, FormatString, ...) /** * Passes if Actual is equal to Expected with a tolerance of Epsilon * - * Call: \c cr_expect_float_eq(Actual, Expected, Epsilon, [FormatString, - * [Args...]]) - * * Passes if Actual is equal to Expected with a tolerance of Epsilon. * Otherwise the test is marked as failure but the execution will continue. * @@ -534,19 +464,15 @@ * @param[in] Actual Value to test * @param[in] Expected Expected value * @param[in] Epsilon Tolerance between Actual and Expected - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_float_eq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_CONTINUES_, cr_assert_float_eq_op_, __VA_ARGS__)) +# define cr_expect_float_eq(Actual, Expected, Epsilon, FormatString, ...) /** * Passes if Actual is not equal to Unexpected with a tolerance of Epsilon * - * Call: \c cr_assert_float_neq(Actual, Unexpected, Epsilon, [FormatString, - * [Args...]]) - * * Passes if Actual is not equal to Unexpected with a tolerance of Epsilon. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -558,18 +484,15 @@ * @param[in] Actual Value to test * @param[in] Unexpected Unexpected value * @param[in] Epsilon Tolerance between Actual and Expected - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_float_neq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_ABORT_, cr_assert_float_neq_op_, __VA_ARGS__)) +# define cr_assert_float_neq(Actual, Unexpected, Epsilon, FormatString, ...) /** * Passes if Actual is not equal to Unexpected with a tolerance of Epsilon * - * Call: \c cr_expect_float_neq(Actual, Unexpected, Epsilon, [FormatString, - * [Args...]]) - * * Passes if Actual is not equal to Unexpected with a tolerance of Epsilon. * Otherwise the test is marked as failure but the execution will continue. * @@ -580,25 +503,28 @@ * @param[in] Actual Value to test * @param[in] Unexpected Unexpected value * @param[in] Epsilon Tolerance between Actual and Expected - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_float_neq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_CONTINUES_, cr_assert_float_neq_op_, __VA_ARGS__)) +# define cr_expect_float_neq(Actual, Unexpected, Epsilon, FormatString, ...) /**@}*/ /** * @defgroup StringAsserts String assertions + * + * @note + * These macros are meant to deal with *native* strings, i.e. char arrays. + * Most of them won't work on ``std::string`` in C++, with some exceptions -- + * for ``std::string``, you should use regular comparison assersions. + * * @{ */ /** * Passes if Value is an empty string * - * Call: \c cr_assert_str_empty(Value, [FormatString, [Args...]]) - * * Passes if Value is an empty string. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -608,17 +534,15 @@ * @note Also works on std::string. * * @param[in] Value String to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_ABORT_, ==, CRITERION_ASSERT_MSG_IS_NOT_EMPTY, __VA_ARGS__)) +# define cr_assert_str_empty(Value, FormatString, ...) /** * Passes if Value is an empty string * - * Call: \c cr_expect_str_empty(Value, [FormatString, [Args...]]) - * * Passes if Value is an empty string. * Otherwise the test is marked as failure but the execution will continue. * @@ -627,18 +551,15 @@ * @note Also works on std::string. * * @param[in] Value String to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_CONTINUES_, ==, CRITERION_ASSERT_MSG_IS_NOT_EMPTY, __VA_ARGS__)) +# define cr_expect_str_empty(Value, FormatString, ...) /** * Passes if Value is not an empty string * - * Call: \c cr_assert_str_not_empty(Value, [FormatString, [Args...]]) - * * Passes if Value is not an empty string. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -648,17 +569,15 @@ * @note Also works on std::string. * * @param[in] Value String to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_not_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_ABORT_, !=, CRITERION_ASSERT_MSG_IS_EMPTY, __VA_ARGS__)) +# define cr_assert_str_not_empty(Value, FormatString, ...) /** * Passes if Value is not an empty string * - * Call: \c cr_expect_str_not_empty(Value, [FormatString, [Args...]]) - * * Passes if Value is not an empty string. * Otherwise the test is marked as failure but the execution will continue. * @@ -667,18 +586,15 @@ * @note Also works on std::string. * * @param[in] Value String to test - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_not_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_CONTINUES_, !=, CRITERION_ASSERT_MSG_IS_EMPTY, __VA_ARGS__)) +# define cr_expect_str_not_empty(Value, FormatString, ...) /** * Passes if Actual is lexicographically equal to Expected * - * Call: \c cr_assert_str_eq(Actual, Expected, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically equal to Expected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -687,17 +603,15 @@ * * @param[in] Actual String to test * @param[in] Expected Expected String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_eq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# define cr_assert_str_eq(Actual, Expected, FormatString, ...) /** * Passes if Actual is lexicographically equal to Expected * - * Call: \c cr_expect_str_eq(Actual, Expected, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically equal to Expected. * Otherwise the test is marked as failure but the execution will continue. * @@ -705,18 +619,15 @@ * * @param[in] Actual String to test * @param[in] Expected Expected String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_eq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# define cr_expect_str_eq(Actual, Expected, FormatString, ...) /** * Passes if Actual is not lexicographically equal to Unexpected * - * Call: \c cr_assert_str_neq(Actual, Unexpected, [FormatString, [Args...]]) - * * Passes if Actual is not lexicographically equal to Unexpected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -725,17 +636,15 @@ * * @param[in] Actual String to test * @param[in] Unexpected Unexpected String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_neq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# define cr_assert_str_neq(Actual, Unexpected, FormatString, ...) /** * Passes if Actual is not lexicographically equal to Unexpected * - * Call: \c cr_expect_str_neq(Actual, Unexpected, [FormatString, [Args...]]) - * * Passes if Actual is not lexicographically equal to Unexpected. * Otherwise the test is marked as failure but the execution will continue. * @@ -743,18 +652,15 @@ * * @param[in] Actual String to test * @param[in] Unexpected Unexpected String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_neq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# define cr_expect_str_neq(Actual, Unexpected, FormatString, ...) /** * Passes if Actual is lexicographically less than Reference * - * Call: \c cr_assert_str_lt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically less than Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -763,17 +669,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_lt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, <, __VA_ARGS__)) +# define cr_assert_str_lt(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically less than Reference * - * Call: \c cr_expect_str_lt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically less than Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -781,18 +685,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_lt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, <, __VA_ARGS__)) +# define cr_expect_str_lt(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically less or equal to Reference * - * Call: \c cr_assert_str_leq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically less or equal to Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -801,17 +702,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_leq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, <=, __VA_ARGS__)) +# define cr_assert_str_leq(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically less or equal to Reference * - * Call: \c cr_expect_str_leq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically less or equal to Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -819,18 +718,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_leq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, <=, __VA_ARGS__)) +# define cr_expect_str_leq(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically greater than Reference * - * Call: \c cr_assert_str_gt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically greater than Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -839,17 +735,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_gt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, >, __VA_ARGS__)) +# define cr_assert_str_gt(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically greater than Reference * - * Call: \c cr_expect_str_gt(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically greater than Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -857,18 +751,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_expect_str_gt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, >, __VA_ARGS__)) - +# define cr_expect_str_gt(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically greater or equal to Reference * - * Call: \c cr_assert_str_geq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically greater or equal to Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -877,17 +768,15 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_str_geq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, >=, __VA_ARGS__)) +# define cr_assert_str_geq(Actual, Reference, FormatString, ...) /** * Passes if Actual is lexicographically greater or equal to Reference * - * Call: \c cr_expect_str_geq(Actual, Reference, [FormatString, [Args...]]) - * * Passes if Actual is lexicographically greater or equal to Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -895,12 +784,11 @@ * * @param[in] Actual String to test * @param[in] Reference Reference String - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_str_geq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, >=, __VA_ARGS__)) +# define cr_expect_str_geq(Actual, Reference, FormatString, ...) /**@}*/ @@ -912,8 +800,6 @@ /** * Passes if Actual is byte-to-byte equal to Expected * - * Call: \c cr_assert_arr_eq(Actual, Expected, [FormatString, [Args...]]) - * * Passes if Actual is byte-to-byte equal to Expected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -925,17 +811,15 @@ * * @param[in] Actual Array to test * @param[in] Expected Expected array - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_eq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# define cr_assert_arr_eq(Actual, Expected, FormatString, ...) /** * Passes if Actual is byte-to-byte equal to Expected * - * Call: \c cr_expect_arr_eq(Actual, Expected, [FormatString, [Args...]]) - * * Passes if Actual is byte-to-byte equal to Expected. * Otherwise the test is marked as failure but the execution will continue. * @@ -946,20 +830,15 @@ * * @param[in] Actual Array to test * @param[in] Expected Expected array - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_eq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) - +# define cr_expect_arr_eq(Actual, Expected, FormatString, ...) /** * Passes if Actual is not byte-to-byte equal to Expected * - * Call: \c cr_assert_arr_neq(Actual, Unexpected, Size, [FormatString, - * [Args...]]) - * * Passes if Actual is not byte-to-byte equal to Unexpected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -972,18 +851,15 @@ * @param[in] Actual Array to test * @param[in] Unexpected Unexpected array * @param[in] Size Number of bytes to check - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_neq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# define cr_assert_arr_neq(Actual, Unexpected, Size, FormatString, ...) /** * Passes if Actual is not byte-to-byte equal to Unexpected * - * Call: \c cr_expect_arr_neq(Actual, Unexpected, Size, [FormatString, - * [Args...]]) - * * Passes if Actual is not byte-to-byte equal to Expected. * Otherwise the test is marked as failure but the execution will continue. * @@ -995,12 +871,11 @@ * @param[in] Actual Array to test * @param[in] Unexpected Unexpected array * @param[in] Size Number of bytes to check - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_neq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# define cr_expect_arr_neq(Actual, Unexpected, Size, FormatString, ...) /**@}*/ @@ -1012,15 +887,9 @@ * @{ */ -# if defined(__GNUC__) || defined(__clang__) || defined(__cplusplus) - - /** * Passes if Actual is comparatively equal to Expected (C++ / GNU C99 only) * - * Call: \c cr_assert_arr_eq_cmp(Actual, Expected, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively equal to Expected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1034,18 +903,15 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_eq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# define cr_assert_arr_eq_cmp(Actual, Expected, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively equal to Expected (C++ / GNU C99 only) * - * Call: \c cr_expect_arr_eq_cmp(Actual, Expected, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively equal to Expected. * Otherwise the test is marked as failure but the execution will continue. * @@ -1058,20 +924,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_eq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# define cr_expect_arr_eq_cmp(Actual, Expected, Size, Cmp, FormatString, ...) /** * Passes if Actual is not comparatively equal to Unexpected (C++ / GNU C99 * only) * - * Call: \c cr_assert_arr_neq_cmp(Actual, Unexpected, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is not comparatively equal to Unexpected. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1085,19 +947,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_neq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# define cr_assert_arr_neq_cmp(Actual, Unexpected, Size, Cmp, FormatString, ...) /** * Passes if Actual is not comparatively equal to Unexpected (C++ / GNU C99 * only) * - * Call: \c cr_expect_arr_neq_cmp(Actual, Unexpected, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is not comparatively equal to Unexpected. * Otherwise the test is marked as failure but the execution will continue. * @@ -1110,19 +969,15 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_neq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# define cr_expect_arr_neq_cmp(Actual, Unexpected, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively less than Reference (C++ / GNU C99 only) * - * Call: \c cr_assert_arr_lt_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively less than Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1136,18 +991,15 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_lt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, <, __VA_ARGS__)) +# define cr_assert_arr_lt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively less than Reference (C++ / GNU C99 only) * - * Call: \c cr_expect_arr_lt_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively less than Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -1160,20 +1012,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_lt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, <, __VA_ARGS__)) +# define cr_expect_arr_lt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively less or equal to Reference (C++ / GNU C99 * only) * - * Call: \c cr_assert_arr_leq_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively less or equal to Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1187,19 +1035,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_leq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, <=, __VA_ARGS__)) +# define cr_assert_arr_leq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively less or equal to Reference (C++ / GNU C99 * only) * - * Call: \c cr_expect_arr_leq_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively less or equal to Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -1212,19 +1057,15 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_leq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, <=, __VA_ARGS__)) +# define cr_expect_arr_leq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively greater than Reference (C++ / GNU C99 only) * - * Call: \c cr_assert_arr_gt_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively greater than Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1238,18 +1079,15 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_gt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, >, __VA_ARGS__)) +# define cr_assert_arr_gt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively greater than Reference (C++ / GNU C99 only) * - * Call: \c cr_expect_arr_gt_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively greater than Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -1262,20 +1100,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_arr_gt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, >, __VA_ARGS__)) +# define cr_expect_arr_gt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively greater or equal to Reference (C++ / GNU * C99 only) * - * Call: \c cr_assert_arr_geq_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively greater or equal to Reference. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1289,19 +1123,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_arr_geq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, >=, __VA_ARGS__)) +# define cr_assert_arr_geq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) /** * Passes if Actual is comparatively greater or equal to Reference (C++ / GNU * C99 only) * - * Call: \c cr_expect_arr_geq_cmp(Actual, Reference, Size, Cmp, [FormatString, - * [Args...]]) - * * Passes if Actual is comparatively greater or equal to Reference. * Otherwise the test is marked as failure but the execution will continue. * @@ -1314,40 +1145,16 @@ * @param[in] Size Number of bytes to check * @param[in] Cmp Function pointer to a function int fn(, * ) to do the comparison - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ +# define cr_expect_arr_geq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) -# define cr_expect_arr_geq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, >=, __VA_ARGS__)) - - -# else - -# define cr_assert_arr_eq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_eq_cmp) CR_NOOP -# define cr_expect_arr_eq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_eq_cmp) CR_NOOP - -# define cr_assert_arr_neq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_neq_cmp) CR_NOOP -# define cr_expect_arr_neq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_neq_cmp) CR_NOOP - -# define cr_assert_arr_lt_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_lt_cmp) CR_NOOP -# define cr_expect_arr_lt_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_lt_cmp) CR_NOOP - -# define cr_assert_arr_leq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_leq_cmp) CR_NOOP -# define cr_expect_arr_leq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_leq_cmp) CR_NOOP - -# define cr_assert_arr_gt_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_gt_cmp) CR_NOOP -# define cr_expect_arr_gt_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_gt_cmp) CR_NOOP - -# define cr_assert_arr_geq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_geq_cmp) CR_NOOP -# define cr_expect_arr_geq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_geq_cmp) CR_NOOP - -# endif /**@}*/ # ifdef __cplusplus - /** * @defgroup ExceptionAsserts Exception asserts * @brief C++ only! @@ -1359,8 +1166,6 @@ /** * Passes if Statement throws an instance of Exception (C++ only) * - * Call: \c cr_assert_throw(Statement, Exception, [FormatString, [Args...]]) - * * Passes if Statement throws an instance of Exception. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1371,17 +1176,15 @@ * * @param[in] Statement Statement to be executed * @param[in] Exception Expected exception - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_throw(...) CR_EXPAND(cr_assert_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# define cr_assert_throw(Statement, Exception, FormatString, ...) /** * Passes if Statement throws an instance of Exception (C++ only) * - * Call: \c cr_assert_throw(Statement, Exception, [FormatString, [Args...]]) - * * Passes if Statement throws an instance of Exception. * Otherwise the test is marked as failure but the execution will continue. * @@ -1391,18 +1194,15 @@ * * @param[in] Statement Statement to be executed * @param[in] Exception Expected exception - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_expect_throw(...) CR_EXPAND(cr_assert_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# define cr_expect_throw(Statement, Exception, FormatString, ...) /** * Passes if Statement does not throws an instance of Exception (C++ only) * - * Call: \c cr_assert_no_throw(Statement, Exception, [FormatString, - * [Args...]]) - * * Passes if Statement does not throws an instance of Exception. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1413,18 +1213,15 @@ * * @param[in] Statement Statement to be executed * @param[in] Exception Unexpected exception - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_no_throw(...) CR_EXPAND(cr_assert_no_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# define cr_assert_no_throw(Statement, Exception, FormatString, ...) /** * Passes if Statement does not throws an instance of Exception (C++ only) * - * Call: \c cr_assert_no_throw(Statement, Exception, [FormatString, - * [Args...]]) - * * Passes if Statement does not throws an instance of Exception. * Otherwise the test is marked as failure but the execution will continue. * @@ -1434,19 +1231,15 @@ * * @param[in] Statement Statement to be executed * @param[in] Exception Unexpected exception - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_no_throw(...) CR_EXPAND(cr_assert_no_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) - +# define cr_expect_no_throw(Statement, Exception, FormatString, ...) /** * Passes if Statement throws any kind of exception (C++ only) * - * Call: \c cr_assert_any_throw(Statement, [FormatString, [Args...]]) - * * Passes if Statement throws any kind of exception * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1456,17 +1249,15 @@ * @note This macro is only available on C++ compilers. * * @param[in] Statement Statement to be executed - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_any_throw(...) CR_EXPAND(cr_assert_any_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# define cr_assert_any_throw(Statement, FormatString, ...) /** * Passes if Statement throws any kind of exception (C++ only) * - * Call: \c cr_assert_any_throw(Statement, [FormatString, [Args...]]) - * * Passes if Statement throws any kind of exception * Otherwise the test is marked as failure but the execution will continue. * @@ -1475,18 +1266,15 @@ * @note This macro is only available on C++ compilers. * * @param[in] Statement Statement to be executed - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_any_throw(...) CR_EXPAND(cr_assert_any_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# define cr_expect_any_throw(Statement, FormatString, ...) /** * Passes if Statement does not throws any kind of exception (C++ only) * - * Call: \c cr_assert_any_throw(Statement, [FormatString, [Args...]]) - * * Passes if Statement does not throws any kind of exception * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -1496,17 +1284,15 @@ * @note This macro is only available on C++ compilers. * * @param[in] Statement Statement to be executed - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_none_throw(...) CR_EXPAND(cr_assert_none_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# define cr_assert_none_throw(Statement, FormatString, ...) /** * Passes if Statement does not throws any kind of exception (C++ only) * - * Call: \c cr_assert_any_throw(Statement, [FormatString, [Args...]]) - * * Passes if Statement does not throws any kind of exception * Otherwise the test is marked as failure but the execution will continue. * @@ -1515,12 +1301,11 @@ * @note This macro is only available on C++ compilers. * * @param[in] Statement Statement to be executed - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_none_throw(...) CR_EXPAND(cr_assert_none_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# define cr_expect_none_throw(Statement, FormatString, ...) # endif /**@}*/ @@ -1561,4 +1346,6 @@ # endif +# include "internal/assert.h" + #endif /* !CRITERION_ASSERT_H_ */ diff --git a/include/criterion/internal/assert.h b/include/criterion/internal/assert.h index ac8f53d..98cf0a5 100644 --- a/include/criterion/internal/assert.h +++ b/include/criterion/internal/assert.h @@ -460,4 +460,172 @@ CR_END_C_API "The `" #Name "` macro is only available on GNU C compilers." \ ) +// Actual implementation + +# undef cr_assert_fail +# define cr_assert_fail(...) CR_EXPAND(cr_fail(CR_FAIL_ABORT_, __VA_ARGS__)) +# undef cr_expect_fail +# define cr_expect_fail(...) CR_EXPAND(cr_fail(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# undef cr_assert +# define cr_assert(...) CR_EXPAND(cr_assert_(__VA_ARGS__)) +# undef cr_expect +# define cr_expect(...) CR_EXPAND(cr_expect_(__VA_ARGS__)) +# undef cr_assert_not +# define cr_assert_not(...) CR_EXPAND(cr_assert_not_(__VA_ARGS__)) +# undef cr_expect_not +# define cr_expect_not(...) CR_EXPAND(cr_expect_not_(__VA_ARGS__)) +# undef cr_assert_eq +# define cr_assert_eq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# undef cr_expect_eq +# define cr_expect_eq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# undef cr_assert_neq +# define cr_assert_neq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# undef cr_expect_neq +# define cr_expect_neq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# undef cr_assert_lt +# define cr_assert_lt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, <, __VA_ARGS__)) +# undef cr_expect_lt +# define cr_expect_lt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, <, __VA_ARGS__)) +# undef cr_assert_leq +# define cr_assert_leq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, <=, __VA_ARGS__)) +# undef cr_expect_leq +# define cr_expect_leq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, <=, __VA_ARGS__)) +# undef cr_assert_gt +# define cr_assert_gt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, >, __VA_ARGS__)) +# undef cr_expect_gt +# define cr_expect_gt(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, >, __VA_ARGS__)) +# undef cr_assert_geq +# define cr_assert_geq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_ABORT_, >=, __VA_ARGS__)) +# undef cr_expect_geq +# define cr_expect_geq(...) CR_EXPAND(cr_assert_op_va_(CR_FAIL_CONTINUES_, >=, __VA_ARGS__)) +# undef cr_assert_null +# define cr_assert_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_ABORT_, ==, CRITERION_ASSERT_MSG_IS_NOT_NULL, __VA_ARGS__)) +# undef cr_expect_null +# define cr_expect_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_CONTINUES_, ==, CRITERION_ASSERT_MSG_IS_NOT_NULL, __VA_ARGS__)) +# undef cr_assert_not_null +# define cr_assert_not_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_ABORT_, !=, CRITERION_ASSERT_MSG_IS_NULL, __VA_ARGS__)) +# undef cr_expect_not_null +# define cr_expect_not_null(...) CR_EXPAND(cr_assert_null_op_va_(CR_FAIL_CONTINUES_, !=, CRITERION_ASSERT_MSG_IS_NULL, __VA_ARGS__)) +# undef cr_assert_float_eq +# define cr_assert_float_eq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_ABORT_, cr_assert_float_eq_op_, __VA_ARGS__)) +# undef cr_expect_float_eq +# define cr_expect_float_eq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_CONTINUES_, cr_assert_float_eq_op_, __VA_ARGS__)) +# undef cr_assert_float_neq +# define cr_assert_float_neq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_ABORT_, cr_assert_float_neq_op_, __VA_ARGS__)) +# undef cr_expect_float_neq +# define cr_expect_float_neq(...) CR_EXPAND(cr_assert_float_op_va_(CR_FAIL_CONTINUES_, cr_assert_float_neq_op_, __VA_ARGS__)) +# undef cr_assert_str_empty +# define cr_assert_str_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_ABORT_, ==, CRITERION_ASSERT_MSG_IS_NOT_EMPTY, __VA_ARGS__)) +# undef cr_expect_str_empty +# define cr_expect_str_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_CONTINUES_, ==, CRITERION_ASSERT_MSG_IS_NOT_EMPTY, __VA_ARGS__)) +# undef cr_assert_str_not_empty +# define cr_assert_str_not_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_ABORT_, !=, CRITERION_ASSERT_MSG_IS_EMPTY, __VA_ARGS__)) +# undef cr_expect_str_not_empty +# define cr_expect_str_not_empty(...) CR_EXPAND(cr_assert_str_op_empty_va_(CR_FAIL_CONTINUES_, !=, CRITERION_ASSERT_MSG_IS_EMPTY, __VA_ARGS__)) +# undef cr_assert_str_eq +# define cr_assert_str_eq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# undef cr_expect_str_eq +# define cr_expect_str_eq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# undef cr_assert_str_neq +# define cr_assert_str_neq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# undef cr_expect_str_neq +# define cr_expect_str_neq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# undef cr_assert_str_lt +# define cr_assert_str_lt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, <, __VA_ARGS__)) +# undef cr_expect_str_lt +# define cr_expect_str_lt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, <, __VA_ARGS__)) +# undef cr_assert_str_leq +# define cr_assert_str_leq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, <=, __VA_ARGS__)) +# undef cr_expect_str_leq +# define cr_expect_str_leq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, <=, __VA_ARGS__)) +# undef cr_assert_str_gt +# define cr_assert_str_gt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, >, __VA_ARGS__)) +# undef cr_expect_str_gt +# define cr_expect_str_gt(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, >, __VA_ARGS__)) +# undef cr_assert_str_geq +# define cr_assert_str_geq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_ABORT_, >=, __VA_ARGS__)) +# undef cr_expect_str_geq +# define cr_expect_str_geq(...) CR_EXPAND(cr_assert_str_op_va_(CR_FAIL_CONTINUES_, >=, __VA_ARGS__)) +# undef cr_assert_arr_eq +# define cr_assert_arr_eq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# undef cr_expect_arr_eq +# define cr_expect_arr_eq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# undef cr_assert_arr_neq +# define cr_assert_arr_neq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# undef cr_expect_arr_neq +# define cr_expect_arr_neq(...) CR_EXPAND(cr_assert_mem_op_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) + +# if defined(__GNUC__) || defined(__clang__) || defined(__cplusplus) + +# undef cr_assert_arr_eq_cmp +# define cr_assert_arr_eq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, ==, __VA_ARGS__)) +# undef cr_expect_arr_eq_cmp +# define cr_expect_arr_eq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, ==, __VA_ARGS__)) +# undef cr_assert_arr_neq_cmp +# define cr_assert_arr_neq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, !=, __VA_ARGS__)) +# undef cr_expect_arr_neq_cmp +# define cr_expect_arr_neq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, !=, __VA_ARGS__)) +# undef cr_assert_arr_lt_cmp +# define cr_assert_arr_lt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, <, __VA_ARGS__)) +# undef cr_expect_arr_lt_cmp +# define cr_expect_arr_lt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, <, __VA_ARGS__)) +# undef cr_assert_arr_leq_cmp +# define cr_assert_arr_leq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, <=, __VA_ARGS__)) +# undef cr_expect_arr_leq_cmp +# define cr_expect_arr_leq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, <=, __VA_ARGS__)) +# undef cr_assert_arr_gt_cmp +# define cr_assert_arr_gt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, >, __VA_ARGS__)) +# undef cr_expect_arr_gt_cmp +# define cr_expect_arr_gt_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, >, __VA_ARGS__)) +# undef cr_assert_arr_geq_cmp +# define cr_assert_arr_geq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_ABORT_, >=, __VA_ARGS__)) +# undef cr_expect_arr_geq_cmp +# define cr_expect_arr_geq_cmp(...) CR_EXPAND(cr_assert_arr_op_cmp_va_(CR_FAIL_CONTINUES_, >=, __VA_ARGS__)) + +# else + +# undef cr_assert_arr_eq_cmp +# define cr_assert_arr_eq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_eq_cmp) CR_NOOP +# undef cr_expect_arr_eq_cmp +# define cr_expect_arr_eq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_eq_cmp) CR_NOOP +# undef cr_assert_arr_neq_cmp +# define cr_assert_arr_neq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_neq_cmp) CR_NOOP +# undef cr_expect_arr_neq_cmp +# define cr_expect_arr_neq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_neq_cmp) CR_NOOP +# undef cr_assert_arr_lt_cmp +# define cr_assert_arr_lt_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_lt_cmp) CR_NOOP +# undef cr_expect_arr_lt_cmp +# define cr_expect_arr_lt_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_lt_cmp) CR_NOOP +# undef cr_assert_arr_leq_cmp +# define cr_assert_arr_leq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_leq_cmp) CR_NOOP +# undef cr_expect_arr_leq_cmp +# define cr_expect_arr_leq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_leq_cmp) CR_NOOP +# undef cr_assert_arr_gt_cmp +# define cr_assert_arr_gt_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_gt_cmp) CR_NOOP +# undef cr_expect_arr_gt_cmp +# define cr_expect_arr_gt_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_gt_cmp) CR_NOOP +# undef cr_assert_arr_geq_cmp +# define cr_assert_arr_geq_cmp(...) CRITERION_GNUC_WARN_(cr_assert_arr_geq_cmp) CR_NOOP +# undef cr_expect_arr_geq_cmp +# define cr_expect_arr_geq_cmp(...) CRITERION_GNUC_WARN_(cr_expect_arr_geq_cmp) CR_NOOP + +# endif + +# undef cr_assert_throw +# define cr_assert_throw(...) CR_EXPAND(cr_assert_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# undef cr_expect_throw +# define cr_expect_throw(...) CR_EXPAND(cr_assert_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# undef cr_assert_no_throw +# define cr_assert_no_throw(...) CR_EXPAND(cr_assert_no_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# undef cr_expect_no_throw +# define cr_expect_no_throw(...) CR_EXPAND(cr_assert_no_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# undef cr_assert_any_throw +# define cr_assert_any_throw(...) CR_EXPAND(cr_assert_any_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# undef cr_expect_any_throw +# define cr_expect_any_throw(...) CR_EXPAND(cr_assert_any_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) +# undef cr_assert_none_throw +# define cr_assert_none_throw(...) CR_EXPAND(cr_assert_none_throw_va_(CR_FAIL_ABORT_, __VA_ARGS__)) +# undef cr_expect_none_throw +# define cr_expect_none_throw(...) CR_EXPAND(cr_assert_none_throw_va_(CR_FAIL_CONTINUES_, __VA_ARGS__)) + #endif /* !CRITERION_INTERNAL_ASSERT_H_ */ diff --git a/include/criterion/internal/redirect.h b/include/criterion/internal/redirect.h index 7fabbb2..6e08ca9 100644 --- a/include/criterion/internal/redirect.h +++ b/include/criterion/internal/redirect.h @@ -67,5 +67,53 @@ CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \ )) +# undef cr_assert_file_contents_eq_str +# define cr_assert_file_contents_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, __VA_ARGS__)) +# undef cr_expect_file_contents_eq_str +# define cr_expect_file_contents_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, __VA_ARGS__)) +# undef cr_assert_file_contents_neq_str +# define cr_assert_file_contents_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, __VA_ARGS__)) +# undef cr_expect_file_contents_neq_str +# define cr_expect_file_contents_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, __VA_ARGS__)) +# undef cr_assert_file_contents_eq +# define cr_assert_file_contents_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, __VA_ARGS__)) +# undef cr_expect_file_contents_eq +# define cr_expect_file_contents_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, __VA_ARGS__)) +# undef cr_assert_file_contents_neq +# define cr_assert_file_contents_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, __VA_ARGS__)) +# undef cr_expect_file_contents_neq +# define cr_expect_file_contents_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, __VA_ARGS__)) +# undef cr_assert_stdout_eq_str +# define cr_assert_stdout_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_expect_stdout_eq_str +# define cr_expect_stdout_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_assert_stdout_neq_str +# define cr_assert_stdout_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_expect_stdout_neq_str +# define cr_expect_stdout_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_assert_stderr_eq_str +# define cr_assert_stderr_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_expect_stderr_eq_str +# define cr_expect_stderr_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_assert_stderr_neq_str +# define cr_assert_stderr_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_expect_stderr_neq_str +# define cr_expect_stderr_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_assert_stdout_eq +# define cr_assert_stdout_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_expect_stdout_eq +# define cr_expect_stdout_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_assert_stdout_neq +# define cr_assert_stdout_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_expect_stdout_neq +# define cr_expect_stdout_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# undef cr_assert_stderr_eq +# define cr_assert_stderr_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_expect_stderr_eq +# define cr_expect_stderr_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_assert_stderr_neq +# define cr_assert_stderr_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# undef cr_expect_stderr_neq +# define cr_expect_stderr_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, cr_get_redirected_stderr(), __VA_ARGS__)) #endif /* !CRITERION_INTERNAL_REDIRECT_H_ */ diff --git a/include/criterion/redirect.h b/include/criterion/redirect.h index 3a248a6..e575505 100644 --- a/include/criterion/redirect.h +++ b/include/criterion/redirect.h @@ -104,7 +104,6 @@ CR_API CR_STDN FILE *cr_mock_file_size(size_t max_size); CR_END_C_API - /** * @defgroup FileAsserts File content assertions * @{ @@ -113,9 +112,6 @@ CR_END_C_API /** * Passes if the contents of \c File are equal to the string \c ExpectedContents * - * Call: \c cr_assert_file_contents_eq_str(File, ExpectedContents, - * [FormatString, [Args...]]) - * * Passes if the contents of \c File are equal to the string * \c ExpectedContents. * Otherwise the test is marked as failure and the execution of the function @@ -125,19 +121,15 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] ExpectedContents C string with the ExpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_assert_file_contents_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, __VA_ARGS__)) +# define cr_assert_file_contents_eq_str(File, ExpectedContents, FormatString, ...) /** * Passes if the contents of \c File are equal to the string \c ExpectedContents * - * Call: \c cr_expect_file_contents_eq_str(File, ExpectedContents, - * [FormatString, [Args...]]) - * * Passes if the contents of \c File are equal to the string * \c ExpectedContents. * Otherwise the test is marked as failure but the execution will continue. @@ -146,20 +138,16 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] ExpectedContents C string with the ExpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_file_contents_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, __VA_ARGS__)) +# define cr_expect_file_contents_eq_str(File, ExpectedContents, FormatString, ...) /** * Passes if the contents of \c File are not equal to the string * \c UnexpectedContents * - * Call: \c cr_assert_file_contents_neq_str(File, UnexpectedContents, - * [FormatString, [Args...]]) - * * Passes if the contents of \c File are not equal to the string * \c UnexpectedContents. * Otherwise the test is marked as failure and the execution of the function @@ -169,19 +157,16 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] UnexpectedContents C string with the UnexpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_file_contents_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, __VA_ARGS__)) +# define cr_assert_file_contents_neq_str(File, UnexpectedContents, FormatString, ...) /** * Passes if the contents of \c File are not equal to the string * \c UnexpectedContents * - * Call: \c cr_expect_file_contents_neq_str(File, UnexpectedContents, - * [FormatString, [Args...]]) - * * Passes if the contents of \c File are not equal to the string * \c UnexpectedContents. * Otherwise the test is marked as failure but the execution will continue. @@ -190,19 +175,15 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] UnexpectedContents C string with the UnexpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_file_contents_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, __VA_ARGS__)) +# define cr_expect_file_contents_neq_str(File, UnexpectedContents, FormatString, ...) /** * Passes if the contents of \c File are equal to the contents of \c RefFile * - * Call: \c cr_assert_file_contents_eq(File, RefFile, [FormatString, - * [Args...]]) - * * Passes if the contents of \c File are equal to the contents of \c RefFile. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -211,18 +192,15 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_file_contents_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, __VA_ARGS__)) +# define cr_assert_file_contents_eq(File, RefFile, FormatString, ...) /** * Passes if the contents of \c File are equal to the contents of \c RefFile * - * Call: \c cr_expect_file_contents_eq(File, RefFile, [FormatString, - * [Args...]]) - * * Passes if the contents of \c File are equal to the contents of \c RefFile. * Otherwise the test is marked as failure but the execution will continue. * @@ -230,20 +208,16 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_file_contents_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, __VA_ARGS__)) +# define cr_expect_file_contents_eq(File, RefFile, FormatString, ...) /** * Passes if the contents of \c File are not equal to the contents of * \c RefFile * - * Call: \c cr_assert_file_contents_neq(File, RefFile, [FormatString, - * [Args...]]) - * * Passes if the contents of \c File are not equal to the contents of * \c RefFile. * Otherwise the test is marked as failure and the execution of the function @@ -253,19 +227,16 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_file_contents_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, __VA_ARGS__)) +# define cr_assert_file_contents_neq(File, RefFile, FormatString, ...) /** * Passes if the contents of \c File are not equal to the contents of * \c RefFile * - * Call: \c cr_expect_file_contents_neq(File, RefFile, [FormatString, - * [Args...]]) - * * Passes if the contents of \c File are not equal to the contents of * \c RefFile. * Otherwise the test is marked as failure but the execution will continue. @@ -274,12 +245,11 @@ CR_END_C_API * * @param[in] File Pointer to a FILE object that specifies an input stream * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_file_contents_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, __VA_ARGS__)) +# define cr_expect_file_contents_neq(File, RefFile, FormatString, ...) /**@}*/ @@ -292,9 +262,6 @@ CR_END_C_API * Passes if the contents of \c stdout are equal to the contents of the string * \c ExpectedContents * - * Call: \c cr_assert_stdout_eq_str(ExpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stdout are equal to the contents of the string * \c ExpectedContents. * Otherwise the test is marked as failure and the execution of the function @@ -303,19 +270,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] ExpectedContents C string with the ExpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stdout_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_assert_stdout_eq_str(ExpectedContents, FormatString, ...) /** * Passes if the contents of \c stdout are equal to the contents of the string * \c ExpectedContents * - * Call: \c cr_expect_stdout_eq_str(ExpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stdout are equal to the contents of the string * \c ExpectedContents. * Otherwise the test is marked as failure but the execution will continue. @@ -323,20 +287,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] ExpectedContents C string with the ExpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stdout_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_expect_stdout_eq_str(ExpectedContents, FormatString, ...) /** * Passes if the contents of \c stdout are not equal to the contents of the * string \c UnexpectedContents * - * Call: \c cr_assert_stdout_neq_str(UnexpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stdout are not equal to the contents of the * string \c UnexpectedContents. * Otherwise the test is marked as failure and the execution of the function @@ -345,19 +305,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] UnexpectedContents C string with the UnexpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stdout_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_assert_stdout_neq_str(UnexpectedContents, FormatString, ...) /** * Passes if the contents of \c stdout are not equal to the contents of the * string \c UnexpectedContents * - * Call: \c cr_expect_stdout_neq_str(UnexpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stdout are not equal to the contents of the * string \c UnexpectedContents. * Otherwise the test is marked as failure but the execution will continue. @@ -365,20 +322,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] UnexpectedContents C string with the UnexpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stdout_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_expect_stdout_neq_str(UnexpectedContents, FormatString, ...) /** * Passes if the contents of \c stderr are equal to the contents of the string * \c ExpectedContents * - * Call: \c cr_assert_stderr_eq_str(ExpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stderr are equal to the contents of the string * \c ExpectedContents. * Otherwise the test is marked as failure and the execution of the function @@ -387,19 +340,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] ExpectedContents C string with the ExpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stderr_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_assert_stderr_eq_str(ExpectedContents, FormatString, ...) /** * Passes if the contents of \c stderr are equal to the contents of the string * \c ExpectedContents * - * Call: \c cr_expect_stderr_eq_str(ExpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stderr are equal to the contents of the string * \c ExpectedContents. * Otherwise the test is marked as failure but the execution will continue. @@ -407,20 +357,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] ExpectedContents C string with the ExpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stderr_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_expect_stderr_eq_str(ExpectedContents, FormatString, ...) /** * Passes if the contents of \c stderr are not equal to the contents of the * string \c UnexpectedContents * - * Call: \c cr_assert_sterr_neq_str(UnexpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stderr are not equal to the contents of the * string \c UnexpectedContents. * Otherwise the test is marked as failure and the execution of the function @@ -429,19 +375,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] UnexpectedContents C string with the UnexpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stderr_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_assert_stderr_neq_str(UnexpectedContents, FormatString, ...) /** * Passes if the contents of \c stderr are not equal to the contents of the * string \c UnexpectedContents * - * Call: \c cr_expect_sterr_neq_str(UnexpectedContents, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stderr are not equal to the contents of the * string \c UnexpectedContents. * Otherwise the test is marked as failure but the execution will continue. @@ -449,19 +392,15 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] UnexpectedContents C string with the UnexpectedContents - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stderr_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_expect_stderr_neq_str(UnexpectedContents, FormatString, ...) /** * Passes if the contents of \c stdout are equal to the contents of \c RefFile * - * Call: \c cr_assert_stdout_eq(RefFile, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stdout are equal to the contents of \c RefFile. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -469,37 +408,31 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stdout_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_assert_stdout_eq(RefFile, FormatString, ...) /** * Passes if the contents of \c stdout are equal to the contents of \c RefFile * - * Call: \c cr_expect_stdout_eq(RefFile, [FormatString, - * [Args...]]) - * * Passes if the contents of \c stdout are equal to the contents of \c RefFile. * Otherwise the test is marked as failure but the execution will continue. * * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stdout_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_expect_stdout_eq(RefFile, FormatString, ...) /** * Passes if the contents of \c stdout are not equal to the contents of \c * RefFile * - * Call: \c cr_assert_stout_neq(RefFile, [FormatString, [Args...]]) - * * Passes if the contents of \c stdout are not equal to the contents of \c * RefFile. * Otherwise the test is marked as failure and the execution of the function @@ -508,18 +441,16 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stdout_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_assert_stdout_neq(RefFile, FormatString, ...) /** * Passes if the contents of \c stdout are not equal to the contents of \c * RefFile * - * Call: \c cr_expect_stout_neq(RefFile, [FormatString, [Args...]]) - * * Passes if the contents of \c stdout are not equal to the contents of \c * RefFile. * Otherwise the test is marked as failure but the execution will continue. @@ -527,18 +458,15 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stdout_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, cr_get_redirected_stdout(), __VA_ARGS__)) +# define cr_expect_stdout_neq(RefFile, FormatString, ...) /** * Passes if the contents of \c stderr are equal to the contents of \c RefFile * - * Call: \c cr_assert_stderr_eq(RefFile, [FormatString, [Args...]]) - * * Passes if the contents of \c stderr are equal to the contents of \c RefFile. * Otherwise the test is marked as failure and the execution of the function * is aborted. @@ -546,70 +474,61 @@ CR_END_C_API * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stderr_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_assert_stderr_eq(RefFile, FormatString, ...) /** * Passes if the contents of \c stderr are equal to the contents of \c RefFile * - * Call: \c cr_expect_stderr_eq(RefFile, [FormatString, [Args...]]) - * * Passes if the contents of \c stderr are equal to the contents of \c RefFile. * Otherwise the test is marked as failure but the execution will continue. * * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ - -# define cr_expect_stderr_eq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_expect_stderr_eq(RefFile, FormatString, ...) /** * Passes if the contents of \c stderr are not equal to the contents of \c * RefFile * - * Call: \c cr_expect_sterr_neq(RefFile, [FormatString, [Args...]]) - * * Passes if the contents of \c stderr are not equal to the contents of \c * RefFile. * Otherwise the test is marked as failure and the execution of the function * is aborted. * - * * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_assert_stderr_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_assert_stderr_neq(RefFile, FormatString, ...) /** * Passes if the contents of \c stderr are not equal to the contents of \c * RefFile * - * Call: \c cr_expect_sterr_neq(RefFile, [FormatString, [Args...]]) - * * Passes if the contents of \c stderr are not equal to the contents of \c * RefFile. * Otherwise the test is marked as failure but the execution will continue. * - * * The optional string is printed on failure. * * @param[in] RefFile Pointer to a FILE object that specifies an input stream - * @param[in] FormatString printf like format string - * @param[in] Args Additional arguments depending on FormatString + * @param[in] FormatString (optional) printf-like format string + * @param[in] ... (optional) format string parameters * *****************************************************************************/ -# define cr_expect_stderr_neq(...) CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, cr_get_redirected_stderr(), __VA_ARGS__)) +# define cr_expect_stderr_neq(RefFile, FormatString, ...) /**@}*/