From 5e275da558ca70b671e3ff0548bb836b7382b9a5 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Mon, 14 Sep 2015 04:16:03 +0200 Subject: [PATCH] Updated documentation on asserts --- doc/assert.rst | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/doc/assert.rst b/doc/assert.rst index 720bcaf..46ad004 100644 --- a/doc/assert.rst +++ b/doc/assert.rst @@ -94,3 +94,51 @@ cr_assert_arr_gt_cmp(Actual, Reference, Size, Cmp, [Message, [Args...]]) ``Ac cr_assert_arr_geq_cmp(Actual, Reference, Size, Cmp, [Message, [Args...]]) ``Actual`` is comparatively greater or equal to ``Reference`` Only available in C++ and GNU C99 =========================================================================== =========================================================================== =========================================== +Exception Assertions +-------------------- + +The following assertion macros are only defined for C++. + +=========================================================================== =========================================================================== =========================================== +Macro Passes if and only if Notes +=========================================================================== =========================================================================== =========================================== +cr_assert_throw(Statement, Exception, [Message, [Args...]]) ``Statement`` throws an instance of ``Exception``. +--------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- +cr_assert_no_throw(Statement, Exception, [Message, [Args...]]) ``Statement`` does not throws an instance of ``Exception``. +--------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- +cr_assert_any_throw(Statement, [Message, [Args...]]) ``Statement`` throws any kind of exception. +--------------------------------------------------------------------------- --------------------------------------------------------------------------- ------------------------------------------- +cr_assert_none_throw(Statement, [Message, [Args...]]) ``Statement`` does not throw any exception. +=========================================================================== =========================================================================== =========================================== + +File Assertions +--------------- + +=============================================================================== ============================================================================ =========================================== +Macro Passes if and only if Notes +=============================================================================== ============================================================================ =========================================== +cr_assert_file_contents_eq_str(File, ExpectedContents, [Message, [Args...]]) The contents of ``File`` are equal to the string ``ExpectedContents``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_file_contents_neq_str(File, ExpectedContents, [Message, [Args...]]) The contents of ``File`` are not equal to the string ``ExpectedContents``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stdout_eq_str(ExpectedContents, [Message, [Args...]]) The contents of ``stdout`` are equal to the string ``ExpectedContents``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stdout_neq_str(ExpectedContents, [Message, [Args...]]) The contents of ``stdout`` are not equal to the string ``ExpectedContents``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stderr_eq_str(ExpectedContents, [Message, [Args...]]) The contents of ``stderr`` are equal to the string ``ExpectedContents``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stderr_neq_str(ExpectedContents, [Message, [Args...]]) The contents of ``stderr`` are not equal to the string ``ExpectedContents``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_file_contents_eq(File, RefFile, [Message, [Args...]]) The contents of ``File`` are equal to the contents of ``RefFile``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_file_contents_neq(File, RefFile, [Message, [Args...]]) The contents of ``File`` are not equal to the contents of ``RefFile``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stdout_eq(RefFile, [Message, [Args...]]) The contents of ``stdout`` are equal to the contents of ``RefFile``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stdout_neq(RefFile, [Message, [Args...]]) The contents of ``stdout`` are not equal to the contents of ``RefFile``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stderr_eq(RefFile, [Message, [Args...]]) The contents of ``stderr`` are equal to the contents of ``RefFile``. +------------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------------------------------------- +cr_assert_stderr_neq(RefFile, [Message, [Args...]]) The contents of ``stderr`` are not equal to the contents of ``RefFile``. +=============================================================================== ============================================================================ =========================================== +