?? class_test.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 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>Test Class Reference<br><small>[<a class="el" href="group___browsing_collected_test_result.html">Browsing collected test result</a>]</small></h1>Base class for all test objects. <a href="#_details">More...</a><p><code>#include <<a class="el" href="_test_8h-source.html">Test.h</a>></code><p><p>Inheritance diagram for Test:<p><center><img src="class_test.png" usemap="#Test_map" border="0" alt=""></center><map name="Test_map"><area href="class_test_composite.html" alt="TestComposite" shape="rect" coords="0,56,307,80"><area href="class_test_decorator.html" alt="TestDecorator" shape="rect" coords="475,56,782,80"><area href="class_test_leaf.html" alt="TestLeaf" shape="rect" coords="951,56,1258,80"><area href="class_test_suite.html" alt="TestSuite" shape="rect" coords="0,112,307,136"><area href="class_repeated_test.html" alt="RepeatedTest" shape="rect" coords="317,112,624,136"><area href="class_test_set_up.html" alt="TestSetUp" shape="rect" coords="634,112,941,136"><area href="class_test_case.html" alt="TestCase" shape="rect" coords="951,112,1258,136"><area href="class_test_runner_1_1_wrapping_suite.html" alt="TestRunner::WrappingSuite" shape="rect" coords="0,168,307,192"><area href="class_orthodox.html" alt="Orthodox< ClassUnderTest >" shape="rect" coords="634,168,941,192"><area href="class_test_caller.html" alt="TestCaller< Fixture >" shape="rect" coords="951,168,1258,192"><area href="class_test_case_decorator.html" alt="TestCaseDecorator" shape="rect" coords="1268,168,1575,192"><area href="class_exception_test_case_decorator.html" alt="ExceptionTestCaseDecorator< ExpectedException >" shape="rect" coords="1268,224,1575,248"></map><a href="class_test-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>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a0">~Test</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a1">run</a> (<a class="el" href="class_test_result.html">TestResult</a> *result)=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Run the test, collecting results. <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual int </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a2">countTestCases</a> () const =0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of test cases invoked by run(). <a href="#a2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual int </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a3">getChildTestCount</a> () const =0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of direct child of the test. <a href="#a3"></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.html#a4">getChildTestAt</a> (int index) const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the child test of the specified index. <a href="#a4"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual std::string </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a5">getName</a> () const =0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the test name. <a href="#a5"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a6">findTestPath</a> (const std::string &testName, <a class="el" href="class_test_path.html">TestPath</a> &testPath) const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Finds the test with the specified name and its parents test. <a href="#a6"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a7">findTestPath</a> (const <a class="el" href="class_test.html">Test</a> *test, <a class="el" href="class_test_path.html">TestPath</a> &testPath) const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Finds the specified test and its parents test. <a href="#a7"></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.html#a8">findTest</a> (const std::string &testName) const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Finds the test with the specified name in the hierarchy. <a href="#a8"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="class_test_path.html">TestPath</a> </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#a9">resolveTestPath</a> (const std::string &testPath) const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Resolved the specified test path with this test acting as 'root'. <a href="#a9"></a><br><br></td></tr><tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_test.html#b0">checkIsValidIndex</a> (int index) const</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.html#b1">doGetChildTestAt</a> (int index) const =0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the child test of the specified valid index. <a href="#b1"></a><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Base class for all test objects. <p>All test objects should be a subclass of Test. Some test objects, <a class="el" href="class_test_case.html">TestCase</a> for example, represent one individual test. Other test objects, such as <a class="el" href="class_test_suite.html">TestSuite</a>, are comprised of several tests.<p>When a Test is run, the result is collected by a <a class="el" href="class_test_result.html">TestResult</a> object.<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="class_test_case.html">TestCase</a> <p><a class="el" href="class_test_suite.html">TestSuite</a> </dd></dl><p><hr><h2>Constructor & Destructor Documentation</h2><a class="anchor" name="a0" doxytag="Test::~Test" ></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"> virtual Test::~<a class="el" href="class_test.html">Test</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, virtual]</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="b0" doxytag="Test::checkIsValidIndex" ></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 Test::checkIsValidIndex </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>index</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const<code> [protected, virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Throws an exception if the specified index is invalid. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>index</em> </td><td>Zero base index of a child test. </td></tr> </table></dl><dl compact><dt><b>Exceptions:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>std::out_of_range</em> </td><td>is <em>index</em> is < 0 or >= getChildTestCount(). </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a2" doxytag="Test::countTestCases" ></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"> virtual int Test::countTestCases </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const<code> [pure virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Return the number of test cases invoked by run(). <p>The base unit of testing is the class <a class="el" href="class_test_case.html">TestCase</a>. This method returns the number of <a class="el" href="class_test_case.html">TestCase</a> objects invoked by the run() method. <p>Implemented in <a class="el" href="class_repeated_test.html#a2">RepeatedTest</a>, <a class="el" href="class_test_decorator.html#a2">TestDecorator</a>, <a class="el" href="class_test_composite.html#a3">TestComposite</a>, and <a class="el" href="class_test_leaf.html#a0">TestLeaf</a>. </td> </tr></table><a class="anchor" name="b1" doxytag="Test::doGetChildTestAt" ></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"> virtual <a class="el" href="class_test.html">Test</a>* Test::doGetChildTestAt </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>index</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const<code> [protected, pure virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Returns the child test of the specified valid index. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>index</em> </td><td>Zero based valid index of the child test to return. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>Pointer on the test. Never <code>NULL</code>. </dd></dl><p>Implemented in <a class="el" href="class_test_decorator.html#b0">TestDecorator</a>, <a class="el" href="class_test_leaf.html#a2">TestLeaf</a>, <a class="el" href="class_test_runner_1_1_wrapping_suite.html#b0">TestRunner::WrappingSuite</a>, and <a class="el" href="class_test_suite.html#a6">TestSuite</a>. </td> </tr></table><a class="anchor" name="a8" doxytag="Test::findTest" ></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"> <a class="el" href="class_test.html">Test</a> * Test::findTest </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const std::string & </td> <td class="mdname1" valign="top" nowrap> <em>testName</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const<code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Finds the test with the specified name in the hierarchy. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>testName</em> </td><td>Name of the test to find. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>Pointer on the first test found that is named <em>testName</em>. Never <code>NULL</code>. </dd></dl><dl compact><dt><b>Exceptions:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>std::invalid_argument</em> </td><td>if no test named <em>testName</em> is found. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a7" doxytag="Test::findTestPath" ></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"> bool Test::findTestPath </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="class_test.html">Test</a> * </td> <td class="mdname" nowrap> <em>test</em>, </td>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -