?? class_test_caller.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>TestCaller< Fixture > Class Template Reference<br><small>[<a class="el" href="group___writing_test_fixture.html">Writing test fixture</a>]</small></h1>Generate a test case from a fixture method. <a href="#_details">More...</a><p><code>#include <<a class="el" href="_test_caller_8h-source.html">TestCaller.h</a>></code><p><p>Inheritance diagram for TestCaller< Fixture >:<p><center><img src="class_test_caller.png" usemap="#TestCaller< Fixture >_map" border="0" alt=""></center><map name="TestCaller< Fixture >_map"><area href="class_test_case.html" alt="TestCase" shape="rect" coords="71,112,203,136"><area href="class_test_leaf.html" alt="TestLeaf" shape="rect" coords="0,56,132,80"><area href="class_test_fixture.html" alt="TestFixture" shape="rect" coords="142,56,274,80"><area href="class_test.html" alt="Test" shape="rect" coords="0,0,132,24"></map><a href="class_test_caller-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_caller.html#a0">TestCaller</a> (std::string name, <a class="el" href="class_test_caller.html#y0">TestMethod</a> test)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#a1">TestCaller</a> (std::string name, <a class="el" href="class_test_caller.html#y0">TestMethod</a> test, Fixture &fixture)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#a2">TestCaller</a> (std::string name, <a class="el" href="class_test_caller.html#y0">TestMethod</a> test, Fixture *fixture)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#a3">~TestCaller</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#a4">runTest</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">FIXME: this should probably be pure virtual. <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_caller.html#a5">setUp</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set up context before running a test. <a href="#a5"></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_caller.html#a6">tearDown</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Clean up after the test run. <a href="#a6"></a><br><br></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_caller.html#a7">toString</a> () const</td></tr><tr><td colspan=2><br><h2>Private Types</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>typedef void(Fixture::* </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#y0">TestMethod</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_caller.html#d0">TestCaller</a> (const <a class="el" href="class_test_caller.html">TestCaller</a> &other)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_test_caller.html">TestCaller</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#d1">operator=</a> (const <a class="el" href="class_test_caller.html">TestCaller</a> &other)</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#r0">m_ownFixture</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>Fixture * </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#r1">m_fixture</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_test_caller.html#y0">TestMethod</a> </td><td class="memItemRight" valign=bottom><a class="el" href="class_test_caller.html#r2">m_test</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2><h3>template<class Fixture><br> class TestCaller< Fixture ></h3>Generate a test case from a fixture method. <p>A test caller provides access to a test case method on a test fixture class. <a class="el" href="class_test.html">Test</a> callers are useful when you want to run an individual test or add it to a suite. <a class="el" href="class_test.html">Test</a> Callers invoke only one <a class="el" href="class_test.html">Test</a> (i.e. test method) on one Fixture of a <a class="el" href="class_test_fixture.html">TestFixture</a>.<p>Here is an example: <pre><div class="fragment"> <span class="keyword">class </span>MathTest : <span class="keyword">public</span> CppUnit::<a class="code" href="class_test_fixture.html">TestFixture</a> { ... <span class="keyword">public</span>: <span class="keywordtype">void</span> <a class="code" href="class_test_caller.html#a5">setUp</a>(); <span class="keywordtype">void</span> <a class="code" href="class_test_caller.html#a6">tearDown</a>(); <span class="keywordtype">void</span> testAdd(); <span class="keywordtype">void</span> testSubtract(); }; CppUnit::Test *MathTest::suite() { CppUnit::TestSuite *suite = <span class="keyword">new</span> CppUnit::TestSuite; suite->addTest( <span class="keyword">new</span> CppUnit::TestCaller<MathTest>( <span class="stringliteral">"testAdd"</span>, testAdd ) ); <span class="keywordflow">return</span> suite; }</div></pre><p>You can use a TestCaller to bind any test method on a <a class="el" href="class_test_fixture.html">TestFixture</a> class, as long as it accepts void and returns void.<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="class_test_case.html">TestCase</a> </dd></dl><p><hr><h2>Member Typedef Documentation</h2><a class="anchor" name="y0" doxytag="TestCaller::TestMethod" ></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" colspan="4">template<class Fixture> </td> </tr> <tr> <td class="md" nowrap valign="top"> typedef void(Fixture::* <a class="el" href="class_test_caller.html">TestCaller</a>< Fixture >::<a class="el" href="class_test_caller.html#y0">TestMethod</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="TestCaller::TestCaller" ></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" colspan="4">template<class Fixture> </td> </tr> <tr> <td class="md" nowrap valign="top"> <a class="el" href="class_test_caller.html">TestCaller</a>< Fixture >::<a class="el" href="class_test_caller.html">TestCaller</a> </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">std::string </td> <td class="mdname" nowrap> <em>name</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="class_test_caller.html#y0">TestMethod</a> </td> <td class="mdname" nowrap> <em>test</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructor for TestCaller. This constructor builds a new Fixture instance owned by the TestCaller. <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 this TestCaller </td></tr> <tr><td></td><td valign=top><em>test</em> </td><td>the method this TestCaller calls in <a class="el" href="class_test_caller.html#a4">runTest()</a> </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a1" doxytag="TestCaller::TestCaller" ></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" colspan="4">template<class Fixture> </td> </tr> <tr> <td class="md" nowrap valign="top"> <a class="el" href="class_test_caller.html">TestCaller</a>< Fixture >::<a class="el" href="class_test_caller.html">TestCaller</a> </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">std::string </td> <td class="mdname" nowrap> <em>name</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="class_test_caller.html#y0">TestMethod</a> </td> <td class="mdname" nowrap> <em>test</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>Fixture & </td> <td class="mdname" nowrap> <em>fixture</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructor for TestCaller. This constructor does not create a new Fixture instance but accepts an existing one as parameter. The TestCaller will not own the Fixture object. <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 this TestCaller </td></tr> <tr><td></td><td valign=top><em>test</em> </td><td>the method this TestCaller calls in <a class="el" href="class_test_caller.html#a4">runTest()</a> </td></tr> <tr><td></td><td valign=top><em>fixture</em> </td><td>the Fixture to invoke the test method on. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a2" doxytag="TestCaller::TestCaller" ></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" colspan="4">template<class Fixture> </td> </tr> <tr> <td class="md" nowrap valign="top"> <a class="el" href="class_test_caller.html">TestCaller</a>< Fixture >::<a class="el" href="class_test_caller.html">TestCaller</a> </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">std::string </td> <td class="mdname" nowrap> <em>name</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="class_test_caller.html#y0">TestMethod</a> </td> <td class="mdname" nowrap> <em>test</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>Fixture * </td> <td class="mdname" nowrap> <em>fixture</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructor for TestCaller. This constructor does not create a new Fixture instance but accepts an existing one as parameter. The TestCaller will own the Fixture object and delete it in its destructor. <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 this TestCaller </td></tr> <tr><td></td><td valign=top><em>test</em> </td><td>the method this TestCaller calls in <a class="el" href="class_test_caller.html#a4">runTest()</a> </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a3" doxytag="TestCaller::~TestCaller" ></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" colspan="4">template<class Fixture> </td> </tr> <tr> <td class="md" nowrap valign="top"> <a class="el" href="class_test_caller.html">TestCaller</a>< Fixture >::~<a class="el" href="class_test_caller.html">TestCaller</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> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -