Fri, 20 Dec 2024 16:51:01 +0100
add cxJsonArrIter() - fixes #524
390 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
2 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | <head> | |
4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> | |
5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> | |
6 | <meta name="generator" content="Doxygen 1.8.13"/> | |
7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
8 | <title>ucx: /home/mike/workspace/c/ucx/src/ucx/test.h File Reference</title> | |
9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> | |
10 | <script type="text/javascript" src="jquery.js"></script> | |
11 | <script type="text/javascript" src="dynsections.js"></script> | |
12 | <link href="search/search.css" rel="stylesheet" type="text/css"/> | |
13 | <script type="text/javascript" src="search/searchdata.js"></script> | |
14 | <script type="text/javascript" src="search/search.js"></script> | |
15 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> | |
16 | </head> | |
17 | <body> | |
18 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> | |
19 | <div id="titlearea"> | |
20 | <table cellspacing="0" cellpadding="0"> | |
21 | <tbody> | |
22 | <tr style="height: 56px;"> | |
23 | <td id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> | |
24 | <td id="projectalign" style="padding-left: 0.5em;"> | |
25 | <div id="projectname">ucx | |
26 | </div> | |
27 | <div id="projectbrief">UAP Common Extensions</div> | |
28 | </td> | |
29 | </tr> | |
30 | </tbody> | |
31 | </table> | |
32 | </div> | |
33 | <!-- end header part --> | |
34 | <!-- Generated by Doxygen 1.8.13 --> | |
35 | <script type="text/javascript"> | |
36 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); | |
37 | </script> | |
38 | <script type="text/javascript" src="menudata.js"></script> | |
39 | <script type="text/javascript" src="menu.js"></script> | |
40 | <script type="text/javascript"> | |
41 | $(function() { | |
42 | initMenu('',true,false,'search.php','Search'); | |
43 | $(document).ready(function() { init_search(); }); | |
44 | }); | |
45 | </script> | |
46 | <div id="main-nav"></div> | |
47 | <!-- window showing the filter options --> | |
48 | <div id="MSearchSelectWindow" | |
49 | onmouseover="return searchBox.OnSearchSelectShow()" | |
50 | onmouseout="return searchBox.OnSearchSelectHide()" | |
51 | onkeydown="return searchBox.OnSearchSelectKey(event)"> | |
52 | </div> | |
53 | ||
54 | <!-- iframe showing the search results (closed by default) --> | |
55 | <div id="MSearchResultsWindow"> | |
56 | <iframe src="javascript:void(0)" frameborder="0" | |
57 | name="MSearchResults" id="MSearchResults"> | |
58 | </iframe> | |
59 | </div> | |
60 | ||
61 | <div id="nav-path" class="navpath"> | |
62 | <ul> | |
63 | <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> | |
64 | </div> | |
65 | </div><!-- top --> | |
66 | <div class="header"> | |
67 | <div class="summary"> | |
68 | <a href="#nested-classes">Data Structures</a> | | |
69 | <a href="#define-members">Macros</a> | | |
70 | <a href="#typedef-members">Typedefs</a> | | |
71 | <a href="#func-members">Functions</a> </div> | |
72 | <div class="headertitle"> | |
73 | <div class="title">test.h File Reference</div> </div> | |
74 | </div><!--header--> | |
75 | <div class="contents"> | |
76 | ||
77 | <p>UCX Test Framework. | |
78 | <a href="#details">More...</a></p> | |
79 | <div class="textblock"><code>#include "<a class="el" href="ucx_8h_source.html">ucx.h</a>"</code><br /> | |
80 | <code>#include <stdio.h></code><br /> | |
81 | <code>#include <<a class="el" href="string_8h_source.html">string.h</a>></code><br /> | |
82 | <code>#include <setjmp.h></code><br /> | |
83 | </div> | |
84 | <p><a href="test_8h_source.html">Go to the source code of this file.</a></p> | |
85 | <table class="memberdecls"> | |
86 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> | |
87 | Data Structures</h2></td></tr> | |
88 | <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> | |
89 | <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> | |
90 | <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> | |
91 | <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> | |
92 | <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> | |
93 | <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> | |
94 | </table><table class="memberdecls"> | |
95 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> | |
96 | Macros</h2></td></tr> | |
97 | <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> | |
98 | <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> | |
99 | <tr class="separator:a828bb1dfda1afd67ca795075903d227d"><td class="memSeparator" colspan="2"> </td></tr> | |
100 | <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> | |
101 | <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> | |
102 | <tr class="separator:a66cfb29c329fc9eaef071f2449836659"><td class="memSeparator" colspan="2"> </td></tr> | |
103 | <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> | |
104 | <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> | |
105 | <tr class="separator:a0547b8d4f3bcdb0633fdd8925e8aa5d4"><td class="memSeparator" colspan="2"> </td></tr> | |
106 | <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> | |
107 | <tr class="memdesc:a08f477cd12fc3fe741a92493e5df58a9"><td class="mdescLeft"> </td><td class="mdescRight">Checks a test assertion. <a href="#a08f477cd12fc3fe741a92493e5df58a9">More...</a><br /></td></tr> | |
108 | <tr class="separator:a08f477cd12fc3fe741a92493e5df58a9"><td class="memSeparator" colspan="2"> </td></tr> | |
109 | <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> | |
110 | <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> | |
111 | <tr class="separator:ae073cf5ead22cb27d662da048e16f44a"><td class="memSeparator" colspan="2"> </td></tr> | |
112 | <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> | |
113 | <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> | |
114 | <tr class="separator:a0efbab91c54f5237a2ab207f48cf0e51"><td class="memSeparator" colspan="2"> </td></tr> | |
115 | <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> | |
116 | <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> | |
117 | <tr class="separator:a86e64857c04f0447f8b16fb9c2b3b639"><td class="memSeparator" colspan="2"> </td></tr> | |
118 | </table><table class="memberdecls"> | |
119 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> | |
120 | Typedefs</h2></td></tr> | |
121 | <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> | |
122 | <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> | |
123 | <tr class="separator:a52115d1d0f1c4a565ed6ef7c1bfd0363"><td class="memSeparator" colspan="2"> </td></tr> | |
124 | <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> | |
125 | <tr class="memdesc:ae906817354c010b83c2784260cce7a1c"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to a test function. <a href="#ae906817354c010b83c2784260cce7a1c">More...</a><br /></td></tr> | |
126 | <tr class="separator:ae906817354c010b83c2784260cce7a1c"><td class="memSeparator" colspan="2"> </td></tr> | |
127 | <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> | |
128 | <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> | |
129 | <tr class="separator:a8048c50ae73ea690b776edfd63bd6a5d"><td class="memSeparator" colspan="2"> </td></tr> | |
130 | </table><table class="memberdecls"> | |
131 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> | |
132 | Functions</h2></td></tr> | |
133 | <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> | |
134 | <tr class="memdesc:a531f0df90363e0befbe900878f65f09e"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new test suite. <a href="#a531f0df90363e0befbe900878f65f09e">More...</a><br /></td></tr> | |
135 | <tr class="separator:a531f0df90363e0befbe900878f65f09e"><td class="memSeparator" colspan="2"> </td></tr> | |
136 | <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> | |
137 | <tr class="memdesc:a4a6ac61a6f72722273f8eaa7a343edde"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a test suite. <a href="#a4a6ac61a6f72722273f8eaa7a343edde">More...</a><br /></td></tr> | |
138 | <tr class="separator:a4a6ac61a6f72722273f8eaa7a343edde"><td class="memSeparator" colspan="2"> </td></tr> | |
139 | <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> | |
140 | <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> | |
141 | <tr class="separator:a8dfabc42f183d3a4d79379a5d17bf67d"><td class="memSeparator" colspan="2"> </td></tr> | |
142 | <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> | |
143 | <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> | |
144 | <tr class="separator:a3721458deeecb43aa322428f007714c3"><td class="memSeparator" colspan="2"> </td></tr> | |
145 | </table> | |
146 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> | |
147 | <div class="textblock"><p>UCX Test Framework. </p> | |
148 | <p>Usage of this test framework:</p> | |
149 | <p>**** IN HEADER FILE: ****</p> | |
150 | <pre> | |
151 | <a class="el" href="test_8h.html#a66cfb29c329fc9eaef071f2449836659" title="Macro for a UcxTest function header. ">UCX_TEST(function_name)</a>; | |
152 | <a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE(subroutine_name, paramlist)</a>; // optional | |
153 | </pre><p>**** IN SOURCE FILE: **** </p><pre> | |
154 | <a class="el" href="test_8h.html#ae073cf5ead22cb27d662da048e16f44a" title="Macro for a test subroutine function header. ">UCX_TEST_SUBROUTINE(subroutine_name, paramlist)</a> { | |
155 | // tests with <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> | |
156 | }</pre><pre><a class="el" href="test_8h.html#a66cfb29c329fc9eaef071f2449836659" title="Macro for a UcxTest function header. ">UCX_TEST(function_name)</a> { | |
157 | // memory allocation and other stuff here | |
158 | <a class="el" href="test_8h.html#a0547b8d4f3bcdb0633fdd8925e8aa5d4" title="Marks the begin of a test. ">UCX_TEST_BEGIN</a> | |
159 | // tests with <a class="el" href="test_8h.html#a08f477cd12fc3fe741a92493e5df58a9" title="Checks a test assertion. ">UCX_TEST_ASSERT()</a> and/or | |
160 | // calls with <a class="el" href="test_8h.html#a0efbab91c54f5237a2ab207f48cf0e51" title="Macro for calling a test subroutine. ">UCX_TEST_CALL_SUBROUTINE()</a> here | |
161 | <a class="el" href="test_8h.html#a86e64857c04f0447f8b16fb9c2b3b639" title="Marks the end of a test. ">UCX_TEST_END</a> | |
162 | // cleanup of memory here | |
163 | } | |
164 | </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> | |
165 | <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> | |
166 | <dl class="section author"><dt>Author</dt><dd>Mike Becker </dd> | |
167 | <dd> | |
168 | Olaf Wintermann </dd></dl> | |
169 | </div><h2 class="groupheader">Macro Definition Documentation</h2> | |
170 | <a id="a828bb1dfda1afd67ca795075903d227d"></a> | |
171 | <h2 class="memtitle"><span class="permalink"><a href="#a828bb1dfda1afd67ca795075903d227d">◆ </a></span>__FUNCTION__</h2> | |
172 | ||
173 | <div class="memitem"> | |
174 | <div class="memproto"> | |
175 | <table class="memname"> | |
176 | <tr> | |
177 | <td class="memname">#define __FUNCTION__   __func__</td> | |
178 | </tr> | |
179 | </table> | |
180 | </div><div class="memdoc"> | |
181 | ||
182 | <p>Alias for the <code>__func__</code> preprocessor macro. </p> | |
183 | <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> | |
184 | ||
185 | </div> | |
186 | </div> | |
187 | <a id="a66cfb29c329fc9eaef071f2449836659"></a> | |
188 | <h2 class="memtitle"><span class="permalink"><a href="#a66cfb29c329fc9eaef071f2449836659">◆ </a></span>UCX_TEST</h2> | |
189 | ||
190 | <div class="memitem"> | |
191 | <div class="memproto"> | |
192 | <table class="memname"> | |
193 | <tr> | |
194 | <td class="memname">#define UCX_TEST</td> | |
195 | <td>(</td> | |
196 | <td class="paramtype"> </td> | |
197 | <td class="paramname">name</td><td>)</td> | |
198 | <td>   void name(<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a>* _suite_,FILE *_output_)</td> | |
199 | </tr> | |
200 | </table> | |
201 | </div><div class="memdoc"> | |
202 | ||
203 | <p>Macro for a <a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c" title="Pointer to a test function. ">UcxTest</a> function header. </p> | |
204 | <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> | |
205 | <dl class="params"><dt>Parameters</dt><dd> | |
206 | <table class="params"> | |
207 | <tr><td class="paramname">name</td><td>the name of the test function </td></tr> | |
208 | </table> | |
209 | </dd> | |
210 | </dl> | |
211 | ||
212 | </div> | |
213 | </div> | |
214 | <a id="a08f477cd12fc3fe741a92493e5df58a9"></a> | |
215 | <h2 class="memtitle"><span class="permalink"><a href="#a08f477cd12fc3fe741a92493e5df58a9">◆ </a></span>UCX_TEST_ASSERT</h2> | |
216 | ||
217 | <div class="memitem"> | |
218 | <div class="memproto"> | |
219 | <table class="memname"> | |
220 | <tr> | |
221 | <td class="memname">#define UCX_TEST_ASSERT</td> | |
222 | <td>(</td> | |
223 | <td class="paramtype"> </td> | |
224 | <td class="paramname">condition, </td> | |
225 | </tr> | |
226 | <tr> | |
227 | <td class="paramkey"></td> | |
228 | <td></td> | |
229 | <td class="paramtype"> </td> | |
230 | <td class="paramname">message </td> | |
231 | </tr> | |
232 | <tr> | |
233 | <td></td> | |
234 | <td>)</td> | |
235 | <td></td><td></td> | |
236 | </tr> | |
237 | </table> | |
238 | </div><div class="memdoc"> | |
239 | <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 --> | |
240 | <p>Checks a test assertion. </p> | |
241 | <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> | |
242 | <table class="params"> | |
243 | <tr><td class="paramname">condition</td><td>the condition to check </td></tr> | |
244 | <tr><td class="paramname">message</td><td>the message that shall be printed out on failure </td></tr> | |
245 | </table> | |
246 | </dd> | |
247 | </dl> | |
248 | ||
249 | </div> | |
250 | </div> | |
251 | <a id="a0547b8d4f3bcdb0633fdd8925e8aa5d4"></a> | |
252 | <h2 class="memtitle"><span class="permalink"><a href="#a0547b8d4f3bcdb0633fdd8925e8aa5d4">◆ </a></span>UCX_TEST_BEGIN</h2> | |
253 | ||
254 | <div class="memitem"> | |
255 | <div class="memproto"> | |
256 | <table class="memname"> | |
257 | <tr> | |
258 | <td class="memname">#define UCX_TEST_BEGIN</td> | |
259 | </tr> | |
260 | </table> | |
261 | </div><div class="memdoc"> | |
262 | <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> | |
263 | </div><!-- fragment --> | |
264 | <p>Marks the begin of a test. </p> | |
265 | <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> | |
266 | <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> | |
267 | ||
268 | </div> | |
269 | </div> | |
270 | <a id="a0efbab91c54f5237a2ab207f48cf0e51"></a> | |
271 | <h2 class="memtitle"><span class="permalink"><a href="#a0efbab91c54f5237a2ab207f48cf0e51">◆ </a></span>UCX_TEST_CALL_SUBROUTINE</h2> | |
272 | ||
273 | <div class="memitem"> | |
274 | <div class="memproto"> | |
275 | <table class="memname"> | |
276 | <tr> | |
277 | <td class="memname">#define UCX_TEST_CALL_SUBROUTINE</td> | |
278 | <td>(</td> | |
279 | <td class="paramtype"> </td> | |
280 | <td class="paramname">name, </td> | |
281 | </tr> | |
282 | <tr> | |
283 | <td class="paramkey"></td> | |
284 | <td></td> | |
285 | <td class="paramtype"> </td> | |
286 | <td class="paramname"><em>...</em> </td> | |
287 | </tr> | |
288 | <tr> | |
289 | <td></td> | |
290 | <td>)</td> | |
291 | <td></td><td>   name(_suite_,_output_,_env_,__VA_ARGS__);</td> | |
292 | </tr> | |
293 | </table> | |
294 | </div><div class="memdoc"> | |
295 | ||
296 | <p>Macro for calling a test subroutine. </p> | |
297 | <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> | |
298 | <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> | |
299 | <dl class="params"><dt>Parameters</dt><dd> | |
300 | <table class="params"> | |
301 | <tr><td class="paramname">name</td><td>the name of the subroutine </td></tr> | |
302 | <tr><td class="paramname">...</td><td>the argument list</td></tr> | |
303 | </table> | |
304 | </dd> | |
305 | </dl> | |
306 | <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> | |
307 | ||
308 | </div> | |
309 | </div> | |
310 | <a id="a86e64857c04f0447f8b16fb9c2b3b639"></a> | |
311 | <h2 class="memtitle"><span class="permalink"><a href="#a86e64857c04f0447f8b16fb9c2b3b639">◆ </a></span>UCX_TEST_END</h2> | |
312 | ||
313 | <div class="memitem"> | |
314 | <div class="memproto"> | |
315 | <table class="memname"> | |
316 | <tr> | |
317 | <td class="memname">#define UCX_TEST_END   fwrite("success.\n", 1, 9, _output_); _suite_->success++;}</td> | |
318 | </tr> | |
319 | </table> | |
320 | </div><div class="memdoc"> | |
321 | ||
322 | <p>Marks the end of a test. </p> | |
323 | <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> | |
324 | <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> | |
325 | ||
326 | </div> | |
327 | </div> | |
328 | <a id="ae073cf5ead22cb27d662da048e16f44a"></a> | |
329 | <h2 class="memtitle"><span class="permalink"><a href="#ae073cf5ead22cb27d662da048e16f44a">◆ </a></span>UCX_TEST_SUBROUTINE</h2> | |
330 | ||
331 | <div class="memitem"> | |
332 | <div class="memproto"> | |
333 | <table class="memname"> | |
334 | <tr> | |
335 | <td class="memname">#define UCX_TEST_SUBROUTINE</td> | |
336 | <td>(</td> | |
337 | <td class="paramtype"> </td> | |
338 | <td class="paramname">name, </td> | |
339 | </tr> | |
340 | <tr> | |
341 | <td class="paramkey"></td> | |
342 | <td></td> | |
343 | <td class="paramtype"> </td> | |
344 | <td class="paramname"><em>...</em> </td> | |
345 | </tr> | |
346 | <tr> | |
347 | <td></td> | |
348 | <td>)</td> | |
349 | <td></td><td></td> | |
350 | </tr> | |
351 | </table> | |
352 | </div><div class="memdoc"> | |
353 | <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> | |
354 | </div><!-- fragment --> | |
355 | <p>Macro for a test subroutine function header. </p> | |
356 | <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> | |
357 | <dl class="params"><dt>Parameters</dt><dd> | |
358 | <table class="params"> | |
359 | <tr><td class="paramname">name</td><td>the name of the subroutine </td></tr> | |
360 | <tr><td class="paramname">...</td><td>the parameter list</td></tr> | |
361 | </table> | |
362 | </dd> | |
363 | </dl> | |
364 | <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> | |
365 | ||
366 | </div> | |
367 | </div> | |
368 | <h2 class="groupheader">Typedef Documentation</h2> | |
369 | <a id="ae906817354c010b83c2784260cce7a1c"></a> | |
370 | <h2 class="memtitle"><span class="permalink"><a href="#ae906817354c010b83c2784260cce7a1c">◆ </a></span>UcxTest</h2> | |
371 | ||
372 | <div class="memitem"> | |
373 | <div class="memproto"> | |
374 | <table class="memname"> | |
375 | <tr> | |
376 | <td class="memname">typedef void(* UcxTest) (<a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> *, FILE *)</td> | |
377 | </tr> | |
378 | </table> | |
379 | </div><div class="memdoc"> | |
380 | ||
381 | <p>Pointer to a test function. </p> | |
382 | ||
383 | </div> | |
384 | </div> | |
385 | <a id="a8048c50ae73ea690b776edfd63bd6a5d"></a> | |
386 | <h2 class="memtitle"><span class="permalink"><a href="#a8048c50ae73ea690b776edfd63bd6a5d">◆ </a></span>UcxTestList</h2> | |
387 | ||
388 | <div class="memitem"> | |
389 | <div class="memproto"> | |
390 | <table class="memname"> | |
391 | <tr> | |
392 | <td class="memname">typedef struct <a class="el" href="structUcxTestList.html">UcxTestList</a> <a class="el" href="structUcxTestList.html">UcxTestList</a></td> | |
393 | </tr> | |
394 | </table> | |
395 | </div><div class="memdoc"> | |
396 | ||
397 | <p>Type for the internal list of test cases. </p> | |
398 | ||
399 | </div> | |
400 | </div> | |
401 | <a id="a52115d1d0f1c4a565ed6ef7c1bfd0363"></a> | |
402 | <h2 class="memtitle"><span class="permalink"><a href="#a52115d1d0f1c4a565ed6ef7c1bfd0363">◆ </a></span>UcxTestSuite</h2> | |
403 | ||
404 | <div class="memitem"> | |
405 | <div class="memproto"> | |
406 | <table class="memname"> | |
407 | <tr> | |
408 | <td class="memname">typedef struct <a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> <a class="el" href="structUcxTestSuite.html">UcxTestSuite</a></td> | |
409 | </tr> | |
410 | </table> | |
411 | </div><div class="memdoc"> | |
412 | ||
413 | <p>Type for the <a class="el" href="structUcxTestSuite.html" title="A test suite containing multiple test cases. ">UcxTestSuite</a>. </p> | |
414 | ||
415 | </div> | |
416 | </div> | |
417 | <h2 class="groupheader">Function Documentation</h2> | |
418 | <a id="a8dfabc42f183d3a4d79379a5d17bf67d"></a> | |
419 | <h2 class="memtitle"><span class="permalink"><a href="#a8dfabc42f183d3a4d79379a5d17bf67d">◆ </a></span>ucx_test_register()</h2> | |
420 | ||
421 | <div class="memitem"> | |
422 | <div class="memproto"> | |
423 | <table class="memname"> | |
424 | <tr> | |
425 | <td class="memname">int ucx_test_register </td> | |
426 | <td>(</td> | |
427 | <td class="paramtype"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td> | |
428 | <td class="paramname"><em>suite</em>, </td> | |
429 | </tr> | |
430 | <tr> | |
431 | <td class="paramkey"></td> | |
432 | <td></td> | |
433 | <td class="paramtype"><a class="el" href="test_8h.html#ae906817354c010b83c2784260cce7a1c">UcxTest</a> </td> | |
434 | <td class="paramname"><em>test</em> </td> | |
435 | </tr> | |
436 | <tr> | |
437 | <td></td> | |
438 | <td>)</td> | |
439 | <td></td><td></td> | |
440 | </tr> | |
441 | </table> | |
442 | </div><div class="memdoc"> | |
443 | ||
444 | <p>Registers a test function with the specified test suite. </p> | |
445 | <dl class="params"><dt>Parameters</dt><dd> | |
446 | <table class="params"> | |
447 | <tr><td class="paramname">suite</td><td>the suite, the test function shall be added to </td></tr> | |
448 | <tr><td class="paramname">test</td><td>the test function to register </td></tr> | |
449 | </table> | |
450 | </dd> | |
451 | </dl> | |
452 | <dl class="section return"><dt>Returns</dt><dd><code>EXIT_SUCCESS</code> on success or <code>EXIT_FAILURE</code> on failure </dd></dl> | |
453 | ||
454 | </div> | |
455 | </div> | |
456 | <a id="a3721458deeecb43aa322428f007714c3"></a> | |
457 | <h2 class="memtitle"><span class="permalink"><a href="#a3721458deeecb43aa322428f007714c3">◆ </a></span>ucx_test_run()</h2> | |
458 | ||
459 | <div class="memitem"> | |
460 | <div class="memproto"> | |
461 | <table class="memname"> | |
462 | <tr> | |
463 | <td class="memname">void ucx_test_run </td> | |
464 | <td>(</td> | |
465 | <td class="paramtype"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td> | |
466 | <td class="paramname"><em>suite</em>, </td> | |
467 | </tr> | |
468 | <tr> | |
469 | <td class="paramkey"></td> | |
470 | <td></td> | |
471 | <td class="paramtype">FILE * </td> | |
472 | <td class="paramname"><em>outstream</em> </td> | |
473 | </tr> | |
474 | <tr> | |
475 | <td></td> | |
476 | <td>)</td> | |
477 | <td></td><td></td> | |
478 | </tr> | |
479 | </table> | |
480 | </div><div class="memdoc"> | |
481 | ||
482 | <p>Runs a test suite and writes the test log to the specified stream. </p> | |
483 | <dl class="params"><dt>Parameters</dt><dd> | |
484 | <table class="params"> | |
485 | <tr><td class="paramname">suite</td><td>the test suite to run </td></tr> | |
486 | <tr><td class="paramname">outstream</td><td>the stream the log shall be written to </td></tr> | |
487 | </table> | |
488 | </dd> | |
489 | </dl> | |
490 | ||
491 | </div> | |
492 | </div> | |
493 | <a id="a4a6ac61a6f72722273f8eaa7a343edde"></a> | |
494 | <h2 class="memtitle"><span class="permalink"><a href="#a4a6ac61a6f72722273f8eaa7a343edde">◆ </a></span>ucx_test_suite_free()</h2> | |
495 | ||
496 | <div class="memitem"> | |
497 | <div class="memproto"> | |
498 | <table class="memname"> | |
499 | <tr> | |
500 | <td class="memname">void ucx_test_suite_free </td> | |
501 | <td>(</td> | |
502 | <td class="paramtype"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a> * </td> | |
503 | <td class="paramname"><em>suite</em></td><td>)</td> | |
504 | <td></td> | |
505 | </tr> | |
506 | </table> | |
507 | </div><div class="memdoc"> | |
508 | ||
509 | <p>Destroys a test suite. </p> | |
510 | <dl class="params"><dt>Parameters</dt><dd> | |
511 | <table class="params"> | |
512 | <tr><td class="paramname">suite</td><td>the test suite to destroy </td></tr> | |
513 | </table> | |
514 | </dd> | |
515 | </dl> | |
516 | ||
517 | </div> | |
518 | </div> | |
519 | <a id="a531f0df90363e0befbe900878f65f09e"></a> | |
520 | <h2 class="memtitle"><span class="permalink"><a href="#a531f0df90363e0befbe900878f65f09e">◆ </a></span>ucx_test_suite_new()</h2> | |
521 | ||
522 | <div class="memitem"> | |
523 | <div class="memproto"> | |
524 | <table class="memname"> | |
525 | <tr> | |
526 | <td class="memname"><a class="el" href="structUcxTestSuite.html">UcxTestSuite</a>* ucx_test_suite_new </td> | |
527 | <td>(</td> | |
528 | <td class="paramname"></td><td>)</td> | |
529 | <td></td> | |
530 | </tr> | |
531 | </table> | |
532 | </div><div class="memdoc"> | |
533 | ||
534 | <p>Creates a new test suite. </p> | |
535 | <dl class="section return"><dt>Returns</dt><dd>a new test suite </dd></dl> | |
536 | ||
537 | </div> | |
538 | </div> | |
539 | </div><!-- contents --> | |
540 | <!-- start footer part --> | |
541 | <hr class="footer"/><address class="footer"><small> | |
542 | Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> | |
543 | <img class="footer" src="doxygen.png" alt="doxygen"/> | |
544 | </a> 1.8.13 | |
545 | </small></address> | |
546 | </body> | |
547 | </html> |