<ahref="testpools_8c.html">Go to the documentation of this file.</a><divclass="fragment"><preclass="fragment"><aname="l00001"></a>00001 <spanclass="comment">/*</span>
<aname="l00027"></a>00027 <spanclass="preprocessor">#include "<aclass="code"href="ch_8h.html"title="ChibiOS/RT main include file.">ch.h</a>"</span>
<aname="l00028"></a>00028 <spanclass="preprocessor">#include "<aclass="code"href="test_8h.html"title="Tests support header.">test.h</a>"</span>
<aname="l00059"></a>00059 <spanclass="keyword">static</span><aclass="code"href="group__pools.html#ga498d53232821de6ce2e3e150c76202f2"title="Static memory pool initializer in hungry mode.">MEMORYPOOL_DECL</a>(mp1, <aclass="code"href="group__core.html#gaf7a83c1c8bde96b77299c36dc598d33d"title="Computes the thread working area global size.">THD_WA_SIZE</a>(THREADS_STACK_SIZE), NULL);
<aname="l00083"></a>00083 <aclass="code"href="group__pools.html#ga9c53c25a5ae60930534cde8620775781"title="Initializes an empty memory pool.">chPoolInit</a>(&mp1, <aclass="code"href="group__core.html#gaf7a83c1c8bde96b77299c36dc598d33d"title="Computes the thread working area global size.">THD_WA_SIZE</a>(THREADS_STACK_SIZE), NULL);
<aname="l00089"></a>00089 <spanclass="comment">/* Adding the WAs to the pool. */</span>
<aname="l00090"></a>00090 <spanclass="keywordflow">for</span> (i = 0; i < MAX_THREADS; i++)
<aname="l00091"></a>00091 <aclass="code"href="group__pools.html#ga978f8d038e8e981bf9e5a104b81c6cb6"title="Releases (or adds) an object into (to) a memory pool.">chPoolFree</a>(&mp1, wa[i]);
<aname="l00092"></a>00092
<aname="l00093"></a>00093 <spanclass="comment">/* Empting the pool again. */</span>
<aname="l00094"></a>00094 <spanclass="keywordflow">for</span> (i = 0; i < MAX_THREADS; i++)
<aname="l00095"></a>00095 <aclass="code"href="group__test.html#ga835cb17ca3869922b49435d95324a68b"title="Test assertion.">test_assert</a>(1, <aclass="code"href="group__pools.html#gab86190d70893fe708c75570af6720bd5"title="Allocates an object from a memory pool.">chPoolAlloc</a>(&mp1) != NULL, <spanclass="stringliteral">"list empty"</span>);
<aname="l00096"></a>00096
<aname="l00097"></a>00097 <spanclass="comment">/* Now must be empty. */</span>
<aname="l00098"></a>00098 <aclass="code"href="group__test.html#ga835cb17ca3869922b49435d95324a68b"title="Test assertion.">test_assert</a>(2, <aclass="code"href="group__pools.html#gab86190d70893fe708c75570af6720bd5"title="Allocates an object from a memory pool.">chPoolAlloc</a>(&mp1) == NULL, <spanclass="stringliteral">"list not empty"</span>);
<aname="l00099"></a>00099
<aname="l00100"></a>00100 <spanclass="comment">/* Covering the case where a provider is unable to return more memory.*/</span>
<aname="l00101"></a>00101 <aclass="code"href="group__pools.html#ga9c53c25a5ae60930534cde8620775781"title="Initializes an empty memory pool.">chPoolInit</a>(&mp1, 16, null_provider);
<aname="l00102"></a>00102 <aclass="code"href="group__test.html#ga835cb17ca3869922b49435d95324a68b"title="Test assertion.">test_assert</a>(3, <aclass="code"href="group__pools.html#gab86190d70893fe708c75570af6720bd5"title="Allocates an object from a memory pool.">chPoolAlloc</a>(&mp1) == NULL, <spanclass="stringliteral">"provider returned memory"</span>);
<aname="l00103"></a>00103 }
<aname="l00104"></a>00104
<aname="l00105"></a>00105 <spanclass="keyword">const</span><spanclass="keyword">struct </span><aclass="code"href="structtestcase.html"title="Structure representing a test case.">testcase</a> testpools1 = {
Generated on Sun Oct 24 2010 09:40:38 for ChibiOS/RT by <ahref="http://www.doxygen.org/index.html"><imgsrc="doxygen.png"alt="doxygen"align="middle"border="0"></a> 1.7.1</small></address>