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

📄 class_exception_test_case_decorator.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>ExceptionTestCaseDecorator&lt; ExpectedException &gt; Class Template Reference</h1>Expected exception test case decorator.  <a href="#_details">More...</a><p><code>#include &lt;<a class="el" href="_exception_test_case_decorator_8h-source.html">ExceptionTestCaseDecorator.h</a>&gt;</code><p><p>Inheritance diagram for ExceptionTestCaseDecorator&lt; ExpectedException &gt;:<p><center><img src="class_exception_test_case_decorator.png" usemap="#ExceptionTestCaseDecorator< ExpectedException >_map" border="0" alt=""></center><map name="ExceptionTestCaseDecorator< ExpectedException >_map"><area href="class_test_case_decorator.html" alt="TestCaseDecorator" shape="rect" coords="158,168,465,192"><area href="class_test_case.html" alt="TestCase" shape="rect" coords="158,112,465,136"><area href="class_test_leaf.html" alt="TestLeaf" shape="rect" coords="0,56,307,80"><area href="class_test_fixture.html" alt="TestFixture" shape="rect" coords="317,56,624,80"><area href="class_test.html" alt="Test" shape="rect" coords="0,0,307,24"></map><a href="class_exception_test_case_decorator-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 Types</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>typedef ExpectedException&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_exception_test_case_decorator.html#w0">ExpectedExceptionType</a></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_exception_test_case_decorator.html#a0">ExceptionTestCaseDecorator</a> (<a class="el" href="class_test_case.html">TestCase</a> *test)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Decorates the specified test.  <a href="#a0"></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_exception_test_case_decorator.html#a1">runTest</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Checks that the expected exception is thrown by the decorated test. is thrown.  <a href="#a1"></a><br><br></td></tr><tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_exception_test_case_decorator.html#d0">checkException</a> (<a class="el" href="class_exception_test_case_decorator.html#w0">ExpectedExceptionType</a> &amp;e)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Called when the exception is caught.  <a href="#d0"></a><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2><h3>template&lt;class ExpectedException&gt;<br> class ExceptionTestCaseDecorator&lt; ExpectedException &gt;</h3>Expected exception test case decorator. <p>A decorator used to assert that a specific test case should throw an exception of a given type.<p>You should use this class only if you need to check the exception object state (that a specific cause is set for example). If you don't need to do that, you might consider using <a class="el" href="group___writing_test_fixture.html#ga6">CPPUNIT_TEST_EXCEPTION()</a> instead.<p>Intended use is to subclass and override checkException(). Example:<p><pre><div class="fragment"> <span class="keyword">class </span>NetworkErrorTestCaseDecorator :            <span class="keyword">public</span> <a class="code" href="class_exception_test_case_decorator.html">ExceptionTestCaseDecorator</a>&lt;NetworkError&gt; { <span class="keyword">public</span>:   NetworkErrorTestCaseDecorator( NetworkError::Cause expectedCause )       : m_expectedCause( expectedCause )   {   } <span class="keyword">private</span>:   <span class="keywordtype">void</span> checkException( ExpectedExceptionType &amp;e )   {     <a class="code" href="group___assertions.html#ga3">CPPUNIT_ASSERT_EQUAL</a>( m_expectedCause, e.getCause() );   }   NetworkError::Cause m_expectedCause; };</div></pre><p><hr><h2>Member Typedef Documentation</h2><a class="anchor" name="w0" doxytag="ExceptionTestCaseDecorator::ExpectedExceptionType" ></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&lt;class ExpectedException&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> typedef ExpectedException <a class="el" href="class_exception_test_case_decorator.html">ExceptionTestCaseDecorator</a>&lt; ExpectedException &gt;::<a class="el" href="class_exception_test_case_decorator.html#w0">ExpectedExceptionType</a>          </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="ExceptionTestCaseDecorator::ExceptionTestCaseDecorator" ></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&lt;class ExpectedException&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> <a class="el" href="class_exception_test_case_decorator.html">ExceptionTestCaseDecorator</a>&lt; ExpectedException &gt;::<a class="el" href="class_exception_test_case_decorator.html">ExceptionTestCaseDecorator</a>           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="class_test_case.html">TestCase</a> *&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>test</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Decorates the specified test. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>test</em>&nbsp;</td><td><a class="el" href="class_test_case.html">TestCase</a> to decorate. Assumes ownership of the test. </td></tr>  </table></dl>    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="d0" doxytag="ExceptionTestCaseDecorator::checkException" ></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&lt;class ExpectedException&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> virtual void <a class="el" href="class_exception_test_case_decorator.html">ExceptionTestCaseDecorator</a>&lt; ExpectedException &gt;::checkException           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="class_exception_test_case_decorator.html#w0">ExpectedExceptionType</a> &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>e</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [inline, private, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Called when the exception is caught. <p>Should be overriden to check the exception.     </td>  </tr></table><a class="anchor" name="a1" doxytag="ExceptionTestCaseDecorator::runTest" ></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&lt;class ExpectedException&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> void <a class="el" href="class_exception_test_case_decorator.html">ExceptionTestCaseDecorator</a>&lt; ExpectedException &gt;::runTest           </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> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Checks that the expected exception is thrown by the decorated test. is thrown. <p>Calls the decorated test <a class="el" href="class_exception_test_case_decorator.html#a1">runTest()</a> and checks that an exception of type ExpectedException is thrown. Call checkException() passing the exception that was caught so that some assertions can be made if needed. <p>Reimplemented from <a class="el" href="class_test_case_decorator.html#a5">TestCaseDecorator</a>.    </td>  </tr></table><hr>The documentation for this class was generated from the following file:<ul><li><a class="el" href="_exception_test_case_decorator_8h-source.html">ExceptionTestCaseDecorator.h</a></ul><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 + -