⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 group___creating_test_suite.html

📁 c++开发的一个不错的工具
💻 HTML
字号:
<html><head><title>CppUnit - The Unit Testing Library</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"> <table width="100%">  <tr>    <td width="40%" align="left" valign="center">      <a href="http://sourceforge.net/projects/cppunit">      CppUnit project page      </a>    </td>    <td>      <a href="FAQ">FAQ</a>    </td>    <td width="40%" align="right" valign="center">      <a href="http://cppunit.sourceforge.net">CppUnit home page</a>    </td>  </tr></table><hr><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div><h1>Creating TestSuite</h1><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Classes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>class &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a></td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Registry for <a class="el" href="class_test_factory.html">TestFactory</a>.  <a href="class_test_factory_registry.html#_details">More...</a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>class &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_suite.html">TestSuite</a></td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A Composite of Tests.  <a href="class_test_suite.html#_details">More...</a><br><br></td></tr><tr><td colspan=2><br><h2>Defines</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION</a>(ATestFixtureType)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION</a>(ATestFixtureType, suiteName)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds the specified fixture suite to the specified registry suite.  <a href="#ga1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a>(which, to)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group___creating_test_suite.html#ga3">CPPUNIT_REGISTRY_ADD_TO_DEFAULT</a>(which)</td></tr></table><hr><h2>Define Documentation</h2><a class="anchor" name="ga2" doxytag="HelperMacros.h::CPPUNIT_REGISTRY_ADD" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> #define CPPUNIT_REGISTRY_ADD          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">which,         <tr>          <td class="md" nowrap align="right"></td>          <td></td>          <td class="md" nowrap>to&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p><b>Value:</b><pre class="fragment"><div><span class="keyword">static</span> CPPUNIT_NS::AutoRegisterRegistry                                     \             <a class="code" href="_portability_8h.html#a14">CPPUNIT_MAKE_UNIQUE_NAME</a>( autoRegisterRegistry__ )( which, to )</div></pre>Adds that the specified registry suite to another registry suite.<p>Use this macros to automatically create test registry suite hierarchy. For example, if you want to create the following hierarchy:<ul><li>Math<ul><li>IntegerMath</li><li>FloatMath<ul><li>FastFloat</li><li>StandardFloat</li></ul></li></ul></li></ul><p>You can do this automatically with: <pre><div class="fragment"> <a class="code" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a>( <span class="stringliteral">"FastFloat"</span>, <span class="stringliteral">"FloatMath"</span> ); <a class="code" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a>( <span class="stringliteral">"IntegerMath"</span>, <span class="stringliteral">"Math"</span> ); <a class="code" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a>( <span class="stringliteral">"FloatMath"</span>, <span class="stringliteral">"Math"</span> ); <a class="code" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a>( <span class="stringliteral">"StandardFloat"</span>, <span class="stringliteral">"FloatMath"</span> );</div></pre><p>There is no specific order of declaration. Think of it as declaring links.<p>You register the test in each suite using CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>which</em>&nbsp;</td><td>Name of the registry suite to add to the registry suite named <em>to</em>. </td></tr>    <tr><td></td><td valign=top><em>to</em>&nbsp;</td><td>Name of the registry suite <em>which</em> is added to. </td></tr>  </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group___creating_test_suite.html#ga3">CPPUNIT_REGISTRY_ADD_TO_DEFAULT</a>, <a class="el" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION</a>. </dd></dl>    </td>  </tr></table><a class="anchor" name="ga3" doxytag="HelperMacros.h::CPPUNIT_REGISTRY_ADD_TO_DEFAULT" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> #define CPPUNIT_REGISTRY_ADD_TO_DEFAULT          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">which&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p><b>Value:</b><pre class="fragment"><div><span class="keyword">static</span> CPPUNIT_NS::AutoRegisterRegistry                                \             <a class="code" href="_portability_8h.html#a14">CPPUNIT_MAKE_UNIQUE_NAME</a>( autoRegisterRegistry__ )( which )</div></pre>Adds that the specified registry suite to the default registry suite.<p>This macro is just like CPPUNIT_REGISTRY_ADD except the specified registry suite is added to the default suite (root suite).<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>which</em>&nbsp;</td><td>Name of the registry suite to add to the default registry suite. </td></tr>  </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a>. </dd></dl>    </td>  </tr></table><a class="anchor" name="ga1" doxytag="HelperMacros.h::CPPUNIT_TEST_SUITE_NAMED_REGISTRATION" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">ATestFixtureType,         <tr>          <td class="md" nowrap align="right"></td>          <td></td>          <td class="md" nowrap>suiteName&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p><b>Value:</b><pre class="fragment"><div><span class="keyword">static</span> CPPUNIT_NS::AutoRegisterSuite&lt; ATestFixtureType &gt;                   \             <a class="code" href="_portability_8h.html#a14">CPPUNIT_MAKE_UNIQUE_NAME</a>(autoRegisterRegistry__ )(suiteName)</div></pre>Adds the specified fixture suite to the specified registry suite. <p>This macro declares a static variable whose construction causes a test suite factory to be inserted in the global registry suite of the specified name. The registry is available by calling the static function CppUnit::TestFactoryRegistry::getRegistry().<p>For the suite name, use a string returned by a static function rather than a hardcoded string. That way, you can know what are the name of named registry and you don't risk mistyping the registry name.<p><pre><div class="fragment"> <span class="comment">// MySuites.h</span> <span class="keyword">namespace </span>MySuites {   std::string math() {      <span class="keywordflow">return</span> <span class="stringliteral">"Math"</span>;   } } <span class="comment">// ComplexNumberTest.cpp</span><span class="preprocessor"> #include "MySuites.h"</span>  <a class="code" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION</a>( ComplexNumberTest, MySuites::math() );</div></pre><p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>ATestFixtureType</em>&nbsp;</td><td>Type of the test case class. </td></tr>    <tr><td></td><td valign=top><em>suiteName</em>&nbsp;</td><td>Name of the global registry suite the test suite is registered into. </td></tr>  </table></dl><dl compact><dt><b>Warning:</b></dt><dd>This macro should be used only once per line of code (the line number is used to name a hidden static variable). </dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION</a> <p><a class="el" href="group___creating_test_suite.html#ga3">CPPUNIT_REGISTRY_ADD_TO_DEFAULT</a> <p><a class="el" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a> <p><a class="el" href="group___writing_test_fixture.html#ga0">CPPUNIT_TEST_SUITE</a>, CppUnit::AutoRegisterSuite, CppUnit::TestFactoryRegistry.. </dd></dl>    </td>  </tr></table><a class="anchor" name="ga0" doxytag="HelperMacros.h::CPPUNIT_TEST_SUITE_REGISTRATION" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> #define CPPUNIT_TEST_SUITE_REGISTRATION          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">ATestFixtureType&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p><b>Value:</b><pre class="fragment"><div><span class="keyword">static</span> CPPUNIT_NS::AutoRegisterSuite&lt; ATestFixtureType &gt;       \             <a class="code" href="_portability_8h.html#a14">CPPUNIT_MAKE_UNIQUE_NAME</a>(autoRegisterRegistry__ )</div></pre>Adds the specified fixture suite to the unnamed registry.<p>This macro declares a static variable whose construction causes a test suite factory to be inserted in a global registry of such factories. The registry is available by calling the static function CppUnit::TestFactoryRegistry::getRegistry().<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>ATestFixtureType</em>&nbsp;</td><td>Type of the test case class. </td></tr>  </table></dl><dl compact><dt><b>Warning:</b></dt><dd>This macro should be used only once per line of code (the line number is used to name a hidden static variable). </dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION</a> <p><a class="el" href="group___creating_test_suite.html#ga3">CPPUNIT_REGISTRY_ADD_TO_DEFAULT</a> <p><a class="el" href="group___creating_test_suite.html#ga2">CPPUNIT_REGISTRY_ADD</a> <p><a class="el" href="group___writing_test_fixture.html#ga0">CPPUNIT_TEST_SUITE</a>, CppUnit::AutoRegisterSuite, CppUnit::TestFactoryRegistry. </dd></dl>    </td>  </tr></table><hr><table width="100%">  <tr>    <td width="10%" align="left" valign="center">      <a href="http://sourceforge.net">       <img      src="http://sourceforge.net/sflogo.php?group_id=11795"      width="88" height="31" border="0" alt="SourceForge Logo"></a>    </td>    <td width="20%" align="left" valign="center">      hosts this site.    </td>    <td>    </td>    <td align="right" valign="center">      Send comments to:<br>      <a href="mailto:cppunit-devel@lists.sourceforge.net">CppUnit Developers</a>    </td>  </tr></table></body> </html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -