Tue, 30 Aug 2022 19:55:56 +0200
some function can be macros using the default allocator
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>ucx: /home/mike/workspace/c/ucx/src/ucx/test.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">ucx </div> <div id="projectbrief">UAP Common Extensions</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Macros</a> | <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">test.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>UCX Test Framework. <a href="#details">More...</a></p> <div class="textblock"><code>#include "<a class="el" href="ucx_8h_source.html">ucx.h</a>"</code><br /> <code>#include <stdio.h></code><br /> <code>#include <<a class="el" href="string_8h_source.html">string.h</a>></code><br /> <code>#include <setjmp.h></code><br /> </div> <p><a href="test_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxTestList.html">UcxTestList</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Structure for the internal list of test cases. <a href="structUcxTestList.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A test suite containing multiple test cases. <a href="structUcxTestSuite.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:a828bb1dfda1afd67ca795075903d227d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a828bb1dfda1afd67ca795075903d227d">__FUNCTION__</a>   __func__</td></tr> <tr class="memdesc:a828bb1dfda1afd67ca795075903d227d"><td class="mdescLeft"> </td><td class="mdescRight">Alias for the <code>__func__</code> preprocessor macro. <a href="#a828bb1dfda1afd67ca795075903d227d">More...</a><br /></td></tr> <tr class="separator:a828bb1dfda1afd67ca795075903d227d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a66cfb29c329fc9eaef071f2449836659"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a66cfb29c329fc9eaef071f2449836659">UCX_TEST</a>(name)   void name(<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a>* _suite_,FILE *_output_)</td></tr> <tr class="memdesc:a66cfb29c329fc9eaef071f2449836659"><td class="mdescLeft"> </td><td class="mdescRight">Macro for a <a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c" title="Pointer to a test function. ">UcxTest</a> function header. <a href="#a66cfb29c329fc9eaef071f2449836659">More...</a><br /></td></tr> <tr class="separator:a66cfb29c329fc9eaef071f2449836659"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a0547b8d4f3bcdb0633fdd8925e8aa5d4"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4">UCX_TEST_BEGIN</a></td></tr> <tr class="memdesc:a0547b8d4f3bcdb0633fdd8925e8aa5d4"><td class="mdescLeft"> </td><td class="mdescRight">Marks the begin of a test. <a href="#a0547b8d4f3bcdb0633fdd8925e8aa5d4">More...</a><br /></td></tr> <tr class="separator:a0547b8d4f3bcdb0633fdd8925e8aa5d4"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a08f477cd12fc3fe741a92493e5df58a9"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9">UCX_TEST_ASSERT</a>(condition, message)</td></tr> <tr class="memdesc:a08f477cd12fc3fe741a92493e5df58a9"><td class="mdescLeft"> </td><td class="mdescRight">Checks a test assertion. <a href="#a08f477cd12fc3fe741a92493e5df58a9">More...</a><br /></td></tr> <tr class="separator:a08f477cd12fc3fe741a92493e5df58a9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae073cf5ead22cb27d662da048e16f44a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a">UCX_TEST_SUBROUTINE</a>(name, ...)</td></tr> <tr class="memdesc:ae073cf5ead22cb27d662da048e16f44a"><td class="mdescLeft"> </td><td class="mdescRight">Macro for a test subroutine function header. <a href="#ae073cf5ead22cb27d662da048e16f44a">More...</a><br /></td></tr> <tr class="separator:ae073cf5ead22cb27d662da048e16f44a"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a0efbab91c54f5237a2ab207f48cf0e51"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a0efbab91c54f5237a2ab207f48cf0e51">UCX_TEST_CALL_SUBROUTINE</a>(name, ...)   name(_suite_,_output_,_env_,__VA_ARGS__);</td></tr> <tr class="memdesc:a0efbab91c54f5237a2ab207f48cf0e51"><td class="mdescLeft"> </td><td class="mdescRight">Macro for calling a test subroutine. <a href="#a0efbab91c54f5237a2ab207f48cf0e51">More...</a><br /></td></tr> <tr class="separator:a0efbab91c54f5237a2ab207f48cf0e51"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a86e64857c04f0447f8b16fb9c2b3b639"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a86e64857c04f0447f8b16fb9c2b3b639">UCX_TEST_END</a>   fwrite("success.\n", 1, 9, _output_); _suite_->success++;}</td></tr> <tr class="memdesc:a86e64857c04f0447f8b16fb9c2b3b639"><td class="mdescLeft"> </td><td class="mdescRight">Marks the end of a test. <a href="#a86e64857c04f0447f8b16fb9c2b3b639">More...</a><br /></td></tr> <tr class="separator:a86e64857c04f0447f8b16fb9c2b3b639"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr class="memitem:a52115d1d0f1c4a565ed6ef7c1bfd0363"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a52115d1d0f1c4a565ed6ef7c1bfd0363">UcxTestSuite</a></td></tr> <tr class="memdesc:a52115d1d0f1c4a565ed6ef7c1bfd0363"><td class="mdescLeft"> </td><td class="mdescRight">Type for the <a class="el" href="structUcxTestSuite.html" title="A test suite containing multiple test cases. ">UcxTestSuite</a>. <a href="#a52115d1d0f1c4a565ed6ef7c1bfd0363">More...</a><br /></td></tr> <tr class="separator:a52115d1d0f1c4a565ed6ef7c1bfd0363"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae906817354c010b83c2784260cce7a1c"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c">UcxTest</a>) (<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> *, FILE *)</td></tr> <tr class="memdesc:ae906817354c010b83c2784260cce7a1c"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to a test function. <a href="#ae906817354c010b83c2784260cce7a1c">More...</a><br /></td></tr> <tr class="separator:ae906817354c010b83c2784260cce7a1c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8048c50ae73ea690b776edfd63bd6a5d"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structUcxTestList.html">UcxTestList</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a8048c50ae73ea690b776edfd63bd6a5d">UcxTestList</a></td></tr> <tr class="memdesc:a8048c50ae73ea690b776edfd63bd6a5d"><td class="mdescLeft"> </td><td class="mdescRight">Type for the internal list of test cases. <a href="#a8048c50ae73ea690b776edfd63bd6a5d">More...</a><br /></td></tr> <tr class="separator:a8048c50ae73ea690b776edfd63bd6a5d"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a531f0df90363e0befbe900878f65f09e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a531f0df90363e0befbe900878f65f09e">ucx_test_suite_new</a> ()</td></tr> <tr class="memdesc:a531f0df90363e0befbe900878f65f09e"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new test suite. <a href="#a531f0df90363e0befbe900878f65f09e">More...</a><br /></td></tr> <tr class="separator:a531f0df90363e0befbe900878f65f09e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a4a6ac61a6f72722273f8eaa7a343edde"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a4a6ac61a6f72722273f8eaa7a343edde">ucx_test_suite_free</a> (<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> *suite)</td></tr> <tr class="memdesc:a4a6ac61a6f72722273f8eaa7a343edde"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a test suite. <a href="#a4a6ac61a6f72722273f8eaa7a343edde">More...</a><br /></td></tr> <tr class="separator:a4a6ac61a6f72722273f8eaa7a343edde"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8dfabc42f183d3a4d79379a5d17bf67d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a8dfabc42f183d3a4d79379a5d17bf67d">ucx_test_register</a> (<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> *suite, <a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c">UcxTest</a> test)</td></tr> <tr class="memdesc:a8dfabc42f183d3a4d79379a5d17bf67d"><td class="mdescLeft"> </td><td class="mdescRight">Registers a test function with the specified test suite. <a href="#a8dfabc42f183d3a4d79379a5d17bf67d">More...</a><br /></td></tr> <tr class="separator:a8dfabc42f183d3a4d79379a5d17bf67d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a3721458deeecb43aa322428f007714c3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="test_8h.html#a3721458deeecb43aa322428f007714c3">ucx_test_run</a> (<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> *suite, FILE *outstream)</td></tr> <tr class="memdesc:a3721458deeecb43aa322428f007714c3"><td class="mdescLeft"> </td><td class="mdescRight">Runs a test suite and writes the test log to the specified stream. <a href="#a3721458deeecb43aa322428f007714c3">More...</a><br /></td></tr> <tr class="separator:a3721458deeecb43aa322428f007714c3"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>UCX Test Framework. </p> <p>Usage of this test framework:</p> <p>**** IN HEADER FILE: ****</p> <pre> <a class="el" href="test_8h.html#a66cfb29c329fc9eaef071f2449836659" title="Macro for a UcxTest function header. ">UCX_TEST(function_name)</a>; <a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE(subroutine_name, paramlist)</a>; // optional </pre><p>**** IN SOURCE FILE: **** </p><pre> <a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE(subroutine_name, paramlist)</a> { // tests with <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> }</pre><pre><a class="el" href="test_8h.html#a66cfb29c329fc9eaef071f2449836659" title="Macro for a UcxTest function header. ">UCX_TEST(function_name)</a> { // memory allocation and other stuff here <a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4" title="Marks the begin of a test. ">UCX_TEST_BEGIN</a> // tests with <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> and/or // calls with <a class="el" href="test_8h.html#a0efbab91c54f5237a2ab207f48cf0e51" title="Macro for calling a test subroutine. ">UCX_TEST_CALL_SUBROUTINE()</a> here <a class="el" href="test_8h.html#a86e64857c04f0447f8b16fb9c2b3b639" title="Marks the end of a test. ">UCX_TEST_END</a> // cleanup of memory here } </pre><p><b>Note:</b> if a test fails, a longjump is performed back to the <a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4" title="Marks the begin of a test. ">UCX_TEST_BEGIN</a> macro!</p> <p><b>Attention:</b> Do not call own functions within a test, that use <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> macros and are not defined by using <a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE()</a>.</p> <dl class="section author"><dt>Author</dt><dd>Mike Becker </dd> <dd> Olaf Wintermann </dd></dl> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="a828bb1dfda1afd67ca795075903d227d"></a> <h2 class="memtitle"><span class="permalink"><a href="#a828bb1dfda1afd67ca795075903d227d">◆ </a></span>__FUNCTION__</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define __FUNCTION__   __func__</td> </tr> </table> </div><div class="memdoc"> <p>Alias for the <code>__func__</code> preprocessor macro. </p> <p>Some compilers use <code>__func__</code> and others use <b>FUNCTION</b>. We use <b>FUNCTION</b> so we define it for those compilers which use <code>__func__</code>. </p> </div> </div> <a id="a66cfb29c329fc9eaef071f2449836659"></a> <h2 class="memtitle"><span class="permalink"><a href="#a66cfb29c329fc9eaef071f2449836659">◆ </a></span>UCX_TEST</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_TEST</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">name</td><td>)</td> <td>   void name(<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a>* _suite_,FILE *_output_)</td> </tr> </table> </div><div class="memdoc"> <p>Macro for a <a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c" title="Pointer to a test function. ">UcxTest</a> function header. </p> <p>Use this macro to declare and/or define a <a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c" title="Pointer to a test function. ">UcxTest</a> function.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">name</td><td>the name of the test function </td></tr> </table> </dd> </dl> </div> </div> <a id="a08f477cd12fc3fe741a92493e5df58a9"></a> <h2 class="memtitle"><span class="permalink"><a href="#a08f477cd12fc3fe741a92493e5df58a9">◆ </a></span>UCX_TEST_ASSERT</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_TEST_ASSERT</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">condition, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">message </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <b>Value:</b><div class="fragment"><div class="line"><span class="keywordflow">if</span> (!(condition)) { \</div><div class="line"> fwrite(message<span class="stringliteral">".\n"</span>, 1, 2+strlen(message), _output_); \</div><div class="line"> _suite_->failure++; \</div><div class="line"> longjmp(_env_, 1);\</div><div class="line"> }</div></div><!-- fragment --> <p>Checks a test assertion. </p> <p>If the assertion is correct, the test carries on. If the assertion is not correct, the specified message (terminated by a dot and a line break) is written to the test suites output stream. </p><dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">condition</td><td>the condition to check </td></tr> <tr><td class="paramname">message</td><td>the message that shall be printed out on failure </td></tr> </table> </dd> </dl> </div> </div> <a id="a0547b8d4f3bcdb0633fdd8925e8aa5d4"></a> <h2 class="memtitle"><span class="permalink"><a href="#a0547b8d4f3bcdb0633fdd8925e8aa5d4">◆ </a></span>UCX_TEST_BEGIN</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_TEST_BEGIN</td> </tr> </table> </div><div class="memdoc"> <b>Value:</b><div class="fragment"><div class="line">fwrite(<span class="stringliteral">"Running "</span>, 1, 8, _output_);\</div><div class="line"> fwrite(<a class="code" href="test_8h.html#a828bb1dfda1afd67ca795075903d227d">__FUNCTION__</a>, 1, strlen(<a class="code" href="test_8h.html#a828bb1dfda1afd67ca795075903d227d">__FUNCTION__</a>), _output_);\</div><div class="line"> fwrite(<span class="stringliteral">"... "</span>, 1, 4, _output_);\</div><div class="line"> jmp_buf _env_; \</div><div class="line"> if (!setjmp(_env_)) {</div><div class="ttc" id="test_8h_html_a828bb1dfda1afd67ca795075903d227d"><div class="ttname"><a href="test_8h.html#a828bb1dfda1afd67ca795075903d227d">__FUNCTION__</a></div><div class="ttdeci">#define __FUNCTION__</div><div class="ttdoc">Alias for the __func__ preprocessor macro. </div><div class="ttdef"><b>Definition:</b> test.h:91</div></div> </div><!-- fragment --> <p>Marks the begin of a test. </p> <p><b>Note:</b> Any <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> calls must be performed <b>after</b> <a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4" title="Marks the begin of a test. ">UCX_TEST_BEGIN</a>.</p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="test_8h.html#a86e64857c04f0447f8b16fb9c2b3b639" title="Marks the end of a test. ">UCX_TEST_END</a> </dd></dl> </div> </div> <a id="a0efbab91c54f5237a2ab207f48cf0e51"></a> <h2 class="memtitle"><span class="permalink"><a href="#a0efbab91c54f5237a2ab207f48cf0e51">◆ </a></span>UCX_TEST_CALL_SUBROUTINE</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_TEST_CALL_SUBROUTINE</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">name, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname"><em>...</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   name(_suite_,_output_,_env_,__VA_ARGS__);</td> </tr> </table> </div><div class="memdoc"> <p>Macro for calling a test subroutine. </p> <p>Subroutines declared with <a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE()</a> can be called by using this macro.</p> <p><b>Note:</b> You may <b>only</b> call subroutines within a <a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4" title="Marks the begin of a test. ">UCX_TEST_BEGIN</a>- <a class="el" href="test_8h.html#a86e64857c04f0447f8b16fb9c2b3b639" title="Marks the end of a test. ">UCX_TEST_END</a>-block.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">name</td><td>the name of the subroutine </td></tr> <tr><td class="paramname">...</td><td>the argument list</td></tr> </table> </dd> </dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE()</a> </dd></dl> </div> </div> <a id="a86e64857c04f0447f8b16fb9c2b3b639"></a> <h2 class="memtitle"><span class="permalink"><a href="#a86e64857c04f0447f8b16fb9c2b3b639">◆ </a></span>UCX_TEST_END</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_TEST_END   fwrite("success.\n", 1, 9, _output_); _suite_->success++;}</td> </tr> </table> </div><div class="memdoc"> <p>Marks the end of a test. </p> <p><b>Note:</b> Any <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> calls must be performed <b>before</b> <a class="el" href="test_8h.html#a86e64857c04f0447f8b16fb9c2b3b639" title="Marks the end of a test. ">UCX_TEST_END</a>.</p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4" title="Marks the begin of a test. ">UCX_TEST_BEGIN</a> </dd></dl> </div> </div> <a id="ae073cf5ead22cb27d662da048e16f44a"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae073cf5ead22cb27d662da048e16f44a">◆ </a></span>UCX_TEST_SUBROUTINE</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_TEST_SUBROUTINE</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">name, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname"><em>...</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <b>Value:</b><div class="fragment"><div class="line"><span class="keywordtype">void</span> name(<a class="code" href="structUcxTestSuite.html">UcxTestSuite</a>* _suite_,\</div><div class="line"> FILE *_output_, jmp_buf _env_, __VA_ARGS__)</div><div class="ttc" id="structUcxTestSuite_html"><div class="ttname"><a href="structUcxTestSuite.html">UcxTestSuite</a></div><div class="ttdoc">A test suite containing multiple test cases. </div><div class="ttdef"><b>Definition:</b> test.h:116</div></div> </div><!-- fragment --> <p>Macro for a test subroutine function header. </p> <p>Use this to declare and/or define a subroutine that can be called by using <a class="el" href="test_8h.html#a0efbab91c54f5237a2ab207f48cf0e51" title="Macro for calling a test subroutine. ">UCX_TEST_CALL_SUBROUTINE()</a>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">name</td><td>the name of the subroutine </td></tr> <tr><td class="paramname">...</td><td>the parameter list</td></tr> </table> </dd> </dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="test_8h.html#a0efbab91c54f5237a2ab207f48cf0e51" title="Macro for calling a test subroutine. ">UCX_TEST_CALL_SUBROUTINE()</a> </dd></dl> </div> </div> <h2 class="groupheader">Typedef Documentation</h2> <a id="ae906817354c010b83c2784260cce7a1c"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae906817354c010b83c2784260cce7a1c">◆ </a></span>UcxTest</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void(* UcxTest) (<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> *, FILE *)</td> </tr> </table> </div><div class="memdoc"> <p>Pointer to a test function. </p> </div> </div> <a id="a8048c50ae73ea690b776edfd63bd6a5d"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8048c50ae73ea690b776edfd63bd6a5d">◆ </a></span>UcxTestList</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct <a class="el" href="structUcxTestList.html">UcxTestList</a> <a class="el" href="structUcxTestList.html">UcxTestList</a></td> </tr> </table> </div><div class="memdoc"> <p>Type for the internal list of test cases. </p> </div> </div> <a id="a52115d1d0f1c4a565ed6ef7c1bfd0363"></a> <h2 class="memtitle"><span class="permalink"><a href="#a52115d1d0f1c4a565ed6ef7c1bfd0363">◆ </a></span>UcxTestSuite</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct <a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> <a class="el" href="structUcxTestSuite.html">UcxTestSuite</a></td> </tr> </table> </div><div class="memdoc"> <p>Type for the <a class="el" href="structUcxTestSuite.html" title="A test suite containing multiple test cases. ">UcxTestSuite</a>. </p> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="a8dfabc42f183d3a4d79379a5d17bf67d"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8dfabc42f183d3a4d79379a5d17bf67d">◆ </a></span>ucx_test_register()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_test_register </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td> <td class="paramname"><em>suite</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c">UcxTest</a> </td> <td class="paramname"><em>test</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Registers a test function with the specified test suite. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">suite</td><td>the suite, the test function shall be added to </td></tr> <tr><td class="paramname">test</td><td>the test function to register </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd><code>EXIT_SUCCESS</code> on success or <code>EXIT_FAILURE</code> on failure </dd></dl> </div> </div> <a id="a3721458deeecb43aa322428f007714c3"></a> <h2 class="memtitle"><span class="permalink"><a href="#a3721458deeecb43aa322428f007714c3">◆ </a></span>ucx_test_run()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_test_run </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td> <td class="paramname"><em>suite</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">FILE * </td> <td class="paramname"><em>outstream</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Runs a test suite and writes the test log to the specified stream. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">suite</td><td>the test suite to run </td></tr> <tr><td class="paramname">outstream</td><td>the stream the log shall be written to </td></tr> </table> </dd> </dl> </div> </div> <a id="a4a6ac61a6f72722273f8eaa7a343edde"></a> <h2 class="memtitle"><span class="permalink"><a href="#a4a6ac61a6f72722273f8eaa7a343edde">◆ </a></span>ucx_test_suite_free()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_test_suite_free </td> <td>(</td> <td class="paramtype"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td> <td class="paramname"><em>suite</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys a test suite. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">suite</td><td>the test suite to destroy </td></tr> </table> </dd> </dl> </div> </div> <a id="a531f0df90363e0befbe900878f65f09e"></a> <h2 class="memtitle"><span class="permalink"><a href="#a531f0df90363e0befbe900878f65f09e">◆ </a></span>ucx_test_suite_new()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a>* ucx_test_suite_new </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Creates a new test suite. </p> <dl class="section return"><dt>Returns</dt><dd>a new test suite </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>