?? class_test_factory_registry.html
字號(hào):
<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 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 Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related 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 <<a class="el" href="_test_factory_registry_8h-source.html">TestFactoryRegistry.h</a>></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> </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"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a1">~TestFactoryRegistry</a> ()</td></tr><tr><td class="mdescLeft"> </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> * </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a2">makeTest</a> ()</td></tr><tr><td class="mdescLeft"> </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 </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"> </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 </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"> </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 </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 </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a6">addRegistry</a> (const std::string &name)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#a7">registerFactory</a> (const std::string &name, <a class="el" href="class_test_factory.html">TestFactory</a> *factory)</td></tr><tr><td class="mdescLeft"> </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> & </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_factory_registry.html#e0">getRegistry</a> (const std::string &name="All Tests")</td></tr><tr><td class="mdescLeft"> </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 </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< <a class="el" href="class_test_factory.html">TestFactory</a> *,<br> std::less< <a class="el" href="class_test_factory.html">TestFactory</a> * > > </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> </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> &copy)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </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> &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> </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 </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 &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 &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->addTest( CppUnit::TestFactoryRegistry::getRegistry( <span class="stringliteral">"Graph"</span> ).<a class="code" href="class_test_factory_registry.html#a2">makeTest</a>() ); rootSuite->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 &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<<a class="el" href="class_test_factory.html">TestFactory</a> *, std::less<<a class="el" href="class_test_factory.html">TestFactory</a>*> > <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> </td> <td><p> </td> </tr></table><hr><h2>Constructor & 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">( </td> <td class="md" nowrap valign="top">std::string </td> <td class="mdname1" valign="top" nowrap> <em>name</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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> </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">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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">( </td> <td class="md" nowrap valign="top">const <a class="el" href="class_test_factory_registry.html">TestFactoryRegistry</a> & </td> <td class="mdname1" valign="top" nowrap> <em>copy</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [private]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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">( </td> <td class="md" nowrap valign="top">const std::string & </td> <td class="mdname1" valign="top" nowrap> <em>name</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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-><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> </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">( </td> <td class="md" nowrap valign="top"><a class="el" href="class_test_suite.html">TestSuite</a> * </td> <td class="mdname1" valign="top" nowrap> <em>suite</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </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> </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">
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -