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

📄 class_test_factory_registry.html

📁 c++开发的一个不错的工具
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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>TestFactoryRegistry Class Reference<br><small>[<a class="el" href="group___creating_test_suite.html">Creating TestSuite</a>]</small></h1>Registry for <a class="el" href="class_test_factory.html">TestFactory</a>.  <a href="#_details">More...</a><p><code>#include &lt;<a class="el" href="_test_factory_registry_8h-source.html">TestFactoryRegistry.h</a>&gt;</code><p><p>Inheritance diagram for TestFactoryRegistry:<p><center><img src="class_test_factory_registry.png" usemap="#TestFactoryRegistry_map" border="0" alt=""></center><map name="TestFactoryRegistry_map"><area href="class_test_factory.html" alt="TestFactory" shape="rect" coords="0,0,125,24"></map><a href="class_test_factory_registry-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a0">TestFactoryRegistry</a> (std::string name)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructs the registry with the specified name.  <a href="#a0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a1">~TestFactoryRegistry</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor.  <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="class_test.html">Test</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a2">makeTest</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns a new <a class="el" href="class_test_suite.html">TestSuite</a> that contains the registered test.  <a href="#a2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a3">addTestToSuite</a> (<a class="el" href="class_test_suite.html">TestSuite</a> *suite)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds the registered tests to the specified suite.  <a href="#a3"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a4">registerFactory</a> (<a class="el" href="class_test_factory.html">TestFactory</a> *factory)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds the specified <a class="el" href="class_test_factory.html">TestFactory</a> to the registry.  <a href="#a4"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a5">unregisterFactory</a> (<a class="el" href="class_test_factory.html">TestFactory</a> *factory)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a6">addRegistry</a> (const std::string &amp;name)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a7">registerFactory</a> (const std::string &amp;name, <a class="el" href="class_test_factory.html">TestFactory</a> *factory)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds the specified <a class="el" href="class_test_factory.html">TestFactory</a> with a specific name (DEPRECATED).  <a href="#a7"></a><br><br></td></tr><tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#e0">getRegistry</a> (const std::string &amp;name="All Tests")</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns a named registry.  <a href="#e0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#e1">isValid</a> ()</td></tr><tr><td colspan=2><br><h2>Private Types</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>typedef CppUnitSet&lt; <a class="el" href="class_test_factory.html">TestFactory</a> *,<br> std::less&lt; <a class="el" href="class_test_factory.html">TestFactory</a> * &gt; &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#y0">Factories</a></td></tr><tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#d0">TestFactoryRegistry</a> (const <a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a> &amp;copy)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#d1">operator=</a> (const <a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a> &amp;copy)</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_test_factory_registry.html#y0">Factories</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#r0">m_factories</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#r1">m_name</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Registry for <a class="el" href="class_test_factory.html">TestFactory</a>. <p>Notes that the registry <b>DON'T</b> assumes lifetime control for any registered tests anymore.<p>The <em>default</em> registry is the registry returned by getRegistry() with the default name parameter value.<p>To register tests, use the macros:<ul><li><a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION()</a>: to add tests in the default registry.</li><li><a class="el" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION()</a>: to add tests in a named registry.</li></ul><p>Example 1: retreiving a suite that contains all the test registered with <a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION()</a>. <pre><div class="fragment"> CppUnit::TestFactoryRegistry &amp;registry = CppUnit::TestFactoryRegistry::getRegistry(); CppUnit::TestSuite *suite = registry.makeTest();</div></pre><p>Example 2: retreiving a suite that contains all the test registered with <a class="el" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ..., "Math" )</a>. <pre><div class="fragment"> CppUnit::TestFactoryRegistry &amp;mathRegistry = CppUnit::TestFactoryRegistry::getRegistry( <span class="stringliteral">"Math"</span> ); CppUnit::TestSuite *mathSuite = mathRegistry.makeTest();</div></pre><p>Example 3: creating a test suite hierarchy composed of unnamed registration and named registration:<ul><li>All Tests<ul><li>tests registered with CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ..., "Graph" )</li><li>tests registered with CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ..., "Math" )</li><li>tests registered with CPPUNIT_TEST_SUITE_REGISTRATION</li></ul></li></ul><p><pre><div class="fragment"> CppUnit::TestSuite *rootSuite = <span class="keyword">new</span> CppUnit::TestSuite( <span class="stringliteral">"All tests"</span> ); rootSuite-&gt;addTest( CppUnit::TestFactoryRegistry::getRegistry( <span class="stringliteral">"Graph"</span> ).<a class="code" href="class_test_factory_registry.html#a2">makeTest</a>() ); rootSuite-&gt;addTest( CppUnit::TestFactoryRegistry::getRegistry( <span class="stringliteral">"Math"</span> ).<a class="code" href="class_test_factory_registry.html#a2">makeTest</a>() ); CppUnit::TestFactoryRegistry::getRegistry().addTestToSuite( rootSuite );</div></pre><p>The same result can be obtained with: <pre><div class="fragment"> CppUnit::TestFactoryRegistry &amp;registry = CppUnit::TestFactoryRegistry::getRegistry(); registry.addRegistry( <span class="stringliteral">"Graph"</span> ); registry.addRegistry( <span class="stringliteral">"Math"</span> ); CppUnit::TestSuite *suite = registry.makeTest();</div></pre><p>Since a TestFactoryRegistry is a <a class="el" href="class_test_factory.html">TestFactory</a>, the named registries can be registered in the unnamed registry, creating the hierarchy links.<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="class_test_suite_factory.html">TestSuiteFactory</a>, <a class="el" href="class_auto_register_suite.html">AutoRegisterSuite</a> <p><a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION</a>, <a class="el" href="group___creating_test_suite.html#ga1">CPPUNIT_TEST_SUITE_NAMED_REGISTRATION</a> </dd></dl><p><hr><h2>Member Typedef Documentation</h2><a class="anchor" name="y0" doxytag="TestFactoryRegistry::Factories" ></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"> typedef CppUnitSet&lt;<a class="el" href="class_test_factory.html">TestFactory</a> *, std::less&lt;<a class="el" href="class_test_factory.html">TestFactory</a>*&gt; &gt; <a class="el" href="class_test_factory_registry.html#y0">TestFactoryRegistry::Factories</a><code> [private]</code>          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><hr><h2>Constructor &amp; Destructor Documentation</h2><a class="anchor" name="a0" doxytag="TestFactoryRegistry::TestFactoryRegistry" ></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"> TestFactoryRegistry::TestFactoryRegistry           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">std::string&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>name</em>          </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>Constructs the registry with the specified name. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>name</em>&nbsp;</td><td>Name of the registry. It is the name of <a class="el" href="class_test_suite.html">TestSuite</a> returned by <a class="el" href="class_test_factory_registry.html#a2">makeTest()</a>. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a1" doxytag="TestFactoryRegistry::~TestFactoryRegistry" ></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"> TestFactoryRegistry::~<a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a>           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Destructor. <p>    </td>  </tr></table><a class="anchor" name="d0" doxytag="TestFactoryRegistry::TestFactoryRegistry" ></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"> TestFactoryRegistry::TestFactoryRegistry           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a> &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>copy</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [private]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="a6" doxytag="TestFactoryRegistry::addRegistry" ></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"> void TestFactoryRegistry::addRegistry           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>name</em>          </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>Adds a registry to the registry.<p>Convenience method to help create test hierarchy. See TestFactoryRegistry detail for examples of use. Calling this method is equivalent to: <pre><div class="fragment"> this-&gt;<a class="code" href="class_test_factory_registry.html#a4">registerFactory</a>( TestFactoryRegistry::getRegistry( name ) );</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>name</em>&nbsp;</td><td>Name of the registry to add. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a3" doxytag="TestFactoryRegistry::addTestToSuite" ></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"> void TestFactoryRegistry::addTestToSuite           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="class_test_suite.html">TestSuite</a> *&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>suite</em>          </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>Adds the registered tests to the specified suite. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>suite</em>&nbsp;</td><td>Suite the tests are added to. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="e0" doxytag="TestFactoryRegistry::getRegistry" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">

⌨️ 快捷键说明

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