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

📄 group___writing_test_fixture.html

📁 c++开发的一个不错的工具
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<pre><div class="fragment"><span class="preprocessor"> #define CPPUNITEX_TEST_TIMELIMIT( testMethod, timeLimit )            \</span><span class="preprocessor">      CPPUNIT_TEST_SUITE_ADD_TEST( (new TimeOutTestCaller&lt;TestFixtureType&gt;(  \</span><span class="preprocessor">                  namer.getTestNameFor( #testMethod ),                \</span><span class="preprocessor">                  &amp;TestFixtureType::testMethod,                   \</span><span class="preprocessor">                  factory.makeFixture(),                              \</span><span class="preprocessor">                  timeLimit ) ) )</span><span class="preprocessor"></span>    <span class="keyword">class </span>PerformanceTest : CppUnit::<a class="code" href="class_test_fixture.html">TestFixture</a> { <span class="keyword">public</span>:   <a class="code" href="group___writing_test_fixture.html#ga0">CPPUNIT_TEST_SUITE</a>( PerformanceTest );   CPPUNITEX_TEST_TIMELIMIT( testSortReverseOrder, 5.0 );   <a class="code" href="group___writing_test_fixture.html#ga2">CPPUNIT_TEST_SUITE_END</a>();   <span class="keywordtype">void</span> testSortReverseOrder(); };</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>test</em>&nbsp;</td><td><a class="el" href="class_test.html">Test</a> to add to the suite. Must be a subclass of <a class="el" href="class_test.html">Test</a>. The test name should have been obtained using TestNamer::getTestNameFor(). </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="ga2" doxytag="HelperMacros.h::CPPUNIT_TEST_SUITE_END" ></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"> #define CPPUNIT_TEST_SUITE_END          </td>          <td class="md" valign="top">(&nbsp;</td>&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </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><b>Value:</b><pre class="fragment"><div>}                                                                          \                                                                               \    <span class="keyword">static</span> CPPUNIT_NS::TestSuite *suite()                                      \    {                                                                          \      <span class="keyword">const</span> CPPUNIT_NS::TestNamer &amp;namer = getTestNamer__();                   \      std::auto_ptr&lt;CPPUNIT_NS::TestSuite&gt; suite(                              \             <span class="keyword">new</span> CPPUNIT_NS::TestSuite( namer.getFixtureName() ));             \      CPPUNIT_NS::ConcretTestFixtureFactory&lt;TestFixtureType&gt; factory;          \      CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(),           \                                                       namer,                  \                                                       factory );              \      TestFixtureType::addTestsToSuite( context );                             \      <span class="keywordflow">return</span> suite.release();                                                  \    }                                                                          \  <span class="keyword">private</span>: <span class="comment">/* dummy typedef so that the macro can still end with ';'*/</span>         \    <span class="keyword">typedef</span> <span class="keywordtype">int</span> CppUnitDummyTypedefForSemiColonEnding__</div></pre>End declaration of the test suite. <p>After this macro, member access is set to "private".<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group___writing_test_fixture.html#ga0">CPPUNIT_TEST_SUITE</a>. <p><a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION</a>. </dd></dl>    </td>  </tr></table><a class="anchor" name="ga3" doxytag="HelperMacros.h::CPPUNIT_TEST_SUITE_END_ABSTRACT" ></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"> #define CPPUNIT_TEST_SUITE_END_ABSTRACT          </td>          <td class="md" valign="top">(&nbsp;</td>&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </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><b>Value:</b><pre class="fragment"><div>}                                                                          \  <span class="keyword">private</span>: <span class="comment">/* dummy typedef so that the macro can still end with ';'*/</span>         \    <span class="keyword">typedef</span> <span class="keywordtype">int</span> CppUnitDummyTypedefForSemiColonEnding__</div></pre>End declaration of an abstract test suite. <p>Use this macro to indicate that the TestFixture is abstract. No static suite() method will be declared.<p>After this macro, member access is set to "private".<p>Here is an example of usage:<p>The abstract test fixture: <pre><div class="fragment"><span class="preprocessor"> #include &lt;<a class="code" href="_helper_macros_8h.html">cppunit/extensions/HelperMacros.h</a>&gt;</span> <span class="keyword">class </span>AbstractDocument; <span class="keyword">class </span>AbstractDocumentTest : <span class="keyword">public</span> CppUnit::<a class="code" href="class_test_fixture.html">TestFixture</a> {   <a class="code" href="group___writing_test_fixture.html#ga0">CPPUNIT_TEST_SUITE</a>( AbstractDocumentTest );   <a class="code" href="group___writing_test_fixture.html#ga5">CPPUNIT_TEST</a>( testInsertText );   <a class="code" href="group___writing_test_fixture.html#ga3">CPPUNIT_TEST_SUITE_END_ABSTRACT</a>(); <span class="keyword">public</span>:   <span class="keywordtype">void</span> testInsertText();    <span class="keywordtype">void</span> setUp()   {     m_document = makeDocument();   }   <span class="keywordtype">void</span> tearDown()   {     <span class="keyword">delete</span> m_document;   } <span class="keyword">protected</span>:   <span class="keyword">virtual</span> AbstractDocument *makeDocument() =0;   AbstractDocument *m_document; };</div></pre><p>The concret test fixture: <pre><div class="fragment"> <span class="keyword">class </span>RichTextDocumentTest : <span class="keyword">public</span> AbstractDocumentTest {   <a class="code" href="group___writing_test_fixture.html#ga1">CPPUNIT_TEST_SUB_SUITE</a>( RichTextDocumentTest, AbstractDocumentTest );   <a class="code" href="group___writing_test_fixture.html#ga5">CPPUNIT_TEST</a>( testInsertFormatedText );   <a class="code" href="group___writing_test_fixture.html#ga2">CPPUNIT_TEST_SUITE_END</a>(); <span class="keyword">public</span>:   <span class="keywordtype">void</span> testInsertFormatedText(); <span class="keyword">protected</span>:   AbstractDocument *makeDocument()   {     <span class="keywordflow">return</span> <span class="keyword">new</span> RichTextDocument();   } };</div></pre><p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group___writing_test_fixture.html#ga1">CPPUNIT_TEST_SUB_SUITE</a>. <p><a class="el" href="group___creating_test_suite.html#ga0">CPPUNIT_TEST_SUITE_REGISTRATION</a>. </dd></dl>    </td>  </tr></table><a class="anchor" name="ga9" doxytag="HelperMacros.h::CPPUNIT_TEST_SUITE_PROPERTY" ></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"> #define CPPUNIT_TEST_SUITE_PROPERTY          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">APropertyKey,         <tr>          <td class="md" nowrap align="right"></td>          <td></td>          <td class="md" nowrap>APropertyValue&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </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><b>Value:</b><pre class="fragment"><div>context.addProperty( std::string(APropertyKey),                 \                         std::string(APropertyValue) )</div></pre>Adds a property to the test suite builder context. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>APropertyKey</em>&nbsp;</td><td>Key of the property to add. </td></tr>    <tr><td></td><td valign=top><em>APropertyValue</em>&nbsp;</td><td>Value for the added property. Example: <pre><div class="fragment"> <a class="code" href="group___writing_test_fixture.html#ga9">CPPUNIT_TEST_SUITE_PROPERTY</a>(<span class="stringliteral">"XmlFileName"</span>, <span class="stringliteral">"paraTest.xml"</span>); </div></pre></td></tr>  </table></dl>    </td>  </tr></table><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 + -