亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cookbook.dox

?? 一個免費的SMART CARD OS系統(tǒng)。
?? DOX
字號:
/*! \page cppunit_cookbook CppUnit CookbookHere is a short cookbook to help you get started.\section simple_test_case Simple Test CaseYou want to know whether your code is working. How do you do it? There are many ways. Stepping through a debugger or littering your code with stream output calls are two of the simpler ways, but they both have drawbacks.Stepping through your code is a good idea, but it is not automatic. You have to do it every time youmake changes. Streaming out text is also fine, but it makes code ugly and it generates far more information than you need most of the time.Tests in %CppUnit can be run automatically. They are easy to set up and once you have written them, they are always there to help you keep confidence in the quality of your code.To make a simple test, here is what you do:Subclass the \link CppUnit::TestCase TestCase \endlink class. Override the method \link CppUnit::TestCase::runTest() runTest()\endlink. When you want to check a value, call \link CPPUNIT_ASSERT() CPPUNIT_ASSERT(bool) \endlinkand pass in an expression that is true if the test succeeds. For example, to test the equality comparison for a Complex number class, write:\codeclass ComplexNumberTest : public CppUnit::TestCase { public:   ComplexNumberTest( std::string name ) : CppUnit::TestCase( name ) {}    void runTest() {    CPPUNIT_ASSERT( Complex (10, 1) == Complex (10, 1) );    CPPUNIT_ASSERT( !(Complex (1, 1) == Complex (2, 2)) );  }};\endcodeThat was a very simple test. Ordinarily, you'll have many little test cases that you'll want to run on the same set of objects. To do this, use a fixture.\section fixture FixtureA fixture is a known set of objects that serves as a base for a set of test cases. Fixtures come in very handy when you are testing as you develop. Let's try out this style of development and learn about fixtures along the away. Suppose that we are really developing a complex number class. Let's start by defining a empty class named Complex.\codeclass Complex {};\endcodeNow create an instance of ComplexNumberTest above, compile the code and see what happens. The first thing we notice is a few compiler errors. The test uses <tt>operator ==</tt>, but it is not defined. Let's fix that.\codebool operator==( const Complex &a, const Complex &b) {   return true; }\endcodeNow compile the test, and run it. This time it compiles but the test fails. We need a bit more to get an <tt>operator ==</tt>working correctly, so we revisit the code.\codeclass Complex {   friend bool operator ==(const Complex& a, const Complex& b);  double real, imaginary;public:  Complex( double r, double i = 0 )     : real(r)	, imaginary(i)   {  }};bool operator ==( const Complex &a, const Complex &b ){   return eq( a.real, b.real )  &&  eq( a.imaginary, b.imaginary ); }\endcodeIf we compile now and run our test it will pass. Now we are ready to add new operations and new tests. At this point a fixture would be handy. We would probably be better off when doing our tests if we decided to instantiate three or four complex numbers and reuse them across our tests. Here is how we do it:- Add member variables for each part of the   \link CppUnit::TestFixture fixture \endlink- Override \link CppUnit::TestFixture::setUp() setUp() \endlink  to initialize the variables- Override \link CppUnit::TestFixture::tearDown() tearDown() \endlink  to release any permanent resources you allocated in   \link CppUnit::TestFixture::setUp() setUp() \endlink\codeclass ComplexNumberTest : public CppUnit::TestFixture {private:  Complex *m_10_1, *m_1_1, *m_11_2;protected:  void setUp()  {    m_10_1 = new Complex( 10, 1 );    m_1_1 = new Complex( 1, 1 );    m_11_2 = new Complex( 11, 2 );    }  void tearDown()   {    delete m_10_1;    delete m_1_1;    delete m_11_2;  }};\endcodeOnce we have this fixture, we can add the complex addition test case any any others that we need over the course of our development.\section test_case Test CaseHow do you write and invoke individual tests using a fixture? There are two steps to this process:- Write the test case as a method in the fixture class- Create a TestCaller which runs that particular methodHere is our test case class with a few extra case methods:\codeclass ComplexNumberTest : public CppUnit::TestFixture  {private:  Complex *m_10_1, *m_1_1, *m_11_2;protected:  void setUp()  {    m_10_1 = new Complex( 10, 1 );    m_1_1 = new Complex( 1, 1 );    m_11_2 = new Complex( 11, 2 );    }  void tearDown()   {    delete m_10_1;    delete m_1_1;    delete m_11_2;  }  void testEquality()  {    CPPUNIT_ASSERT( *m_10_1 == *m_10_1 );    CPPUNIT_ASSERT( !(*m_10_1 == *m_11_2) );  }  void testAddition()  {    CPPUNIT_ASSERT( *m_10_1 + *m_1_1 == *m_11_2 );  }};\endcodeOne may create and run instances for each test case like this:\codeCppUnit::TestCaller<ComplexNumberTest> test( "testEquality",                                              &ComplexNumberTest::testEquality );CppUnit::TestResult result;test.run( &result );\endcodeThe second argument to the test caller constructor is the address of a method on ComplexNumberTest. When the test caller is run, that specific method will be run.  This is not a useful thing to do, however, as no diagnostics will be displayed.  One will normally use a \link ExecutingTest TestRunner \endlink (see below) to display the results.Once you have several tests, organize them into a suite.\section suite SuiteHow do you set up your tests so that you can run them all at once?%CppUnit provides a \link CppUnit::TestSuite TestSuite \endlink class that runs any number of TestCases together. We saw, above, how to run a single test case.To create a suite of two or more tests, you do the following:\codeCppUnit::TestSuite suite;CppUnit::TestResult result;suite.addTest( new CppUnit::TestCaller<ComplexNumberTest>(                       "testEquality",                        &ComplexNumberTest::testEquality ) );suite.addTest( new CppUnit::TestCaller<ComplexNumberTest>(                       "testAddition",                        &ComplexNumberTest::testAddition ) );suite.run( &result );\endcode         \link CppUnit::TestSuite TestSuites \endlink don't only have to contain callers for TestCases.  They can contain any object that implements the \link CppUnit::Test Test \endlink interface.For example, you can create a \link CppUnit::TestSuite TestSuite \endlink in your code andI can create one in mine, and we can run them together by creating a \link CppUnit::TestSuite TestSuite \endlink that contains both:\codeCppUnit::TestSuite suite;CppUnit::TestResult result;suite.addTest( ComplexNumberTest::suite() );suite.addTest( SurrealNumberTest::suite() );suite.run( &result );\endcode\section test_runner TestRunnerHow do you run your tests and collect their results?Once you have a test suite, you'll want to run it. %CppUnit provides tools to define the suite to be run and to display its results. You make your suite accessible to a \link ExecutingTest TestRunner \endlinkprogram with a static method <I>suite</I> that returns a test suite.For example, to make a ComplexNumberTest suite available to a \link ExecutingTest TestRunner \endlink, add the following code to ComplexNumberTest:\codepublic:   static CppUnit::Test *suite()  {    CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "ComplexNumberTest" );    suiteOfTests->addTest( new CppUnit::TestCaller<ComplexNumberTest>(                                    "testEquality",                                    &ComplexNumberTest::testEquality ) );    suiteOfTests->addTest( new CppUnit::TestCaller<ComplexNumberTest>(                                   "testAddition",                                   &ComplexNumberTest::testAddition ) );    return suiteOfTests;  }\endcode\anchor test_runner_codeTo use the text version, include the header files for the tests in Main.cpp:\code#include <cppunit/ui/text/TestRunner.h>#include "ExampleTestCase.h"#include "ComplexNumberTest.h"\endcodeAnd add a call to \link ::CppUnit::TextUi::TestRunner::addTest addTest(CppUnit::Test *) \endlink in the <tt>main()</tt> function:\codeint main( int argc, char **argv){  CppUnit::TextUi::TestRunner runner;  runner.addTest( ExampleTestCase::suite() );  runner.addTest( ComplexNumberTest::suite() );  runner.run();  return 0;}\endcodeThe \link ExecutingTest TestRunner \endlink will run the tests. If all the tests pass, you'll get an informative message. If any fail, you'll get the following information:- The name of the test case that failed- The name of the source file that contains the test- The line number where the failure occurred- All of the text inside the call to CPPUNIT_ASSERT() which detected the failure%CppUnit distinguishes between <I>failures</I> and <I>errors</I>. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like division by zero and other exceptions thrown by the C++ runtime or your code.\section helper_macros Helper MacrosAs you might have noticed, implementing the fixture static <tt>suite()</tt> method is a repetitive and error prone task. A \ref WritingTestFixture set of macros have been created to automatically implements the static <tt>suite()</tt> method.The following code is a rewrite of ComplexNumberTest using those macros:\code#include <cppunit/extensions/HelperMacros.h>class ComplexNumberTest : public CppUnit::TestFixture  {\endcodeFirst, we declare the suite, passing the class name to the macro:\codeCPPUNIT_TEST_SUITE( ComplexNumberTest );\endcodeThe suite created by the static <tt>suite()</tt> method is named after the class name.Then, we declare each test case of the fixture:\codeCPPUNIT_TEST( testEquality );CPPUNIT_TEST( testAddition );\endcodeFinally, we end the suite declaration:\codeCPPUNIT_TEST_SUITE_END();\endcodeAt this point, a method with the following signature has been implemented:\codestatic CppUnit::TestSuite *suite();\endcodeThe rest of the fixture is left unchanged:\codeprivate:  Complex *m_10_1, *m_1_1, *m_11_2;protected:  void setUp()  {    m_10_1 = new Complex( 10, 1 );    m_1_1 = new Complex( 1, 1 );    m_11_2 = new Complex( 11, 2 );    }  void tearDown()   {    delete m_10_1;    delete m_1_1;    delete m_11_2;  }  void testEquality()  {    CPPUNIT_ASSERT( *m_10_1 == *m_10_1 );    CPPUNIT_ASSERT( !(*m_10_1 == *m_11_2) );  }  void testAddition()  {    CPPUNIT_ASSERT( *m_10_1 + *m_1_1 == *m_11_2 );  }};\endcodeThe name of the \link CppUnit::TestCaller TestCaller \endlink added to thesuite are a composition of the fixture name and the method name. In the present case, the names would be:"ComplexNumberTest.testEquality" and "ComplexNumberTest.testAddition".The \link WritingTestFixture helper macros \endlink help you write comon assertion.For example, to check that ComplexNumber throws a MathException when dividinga number by 0:- add the test to the suite using CPPUNIT_TEST_EXCEPTION, specifying the expected  exception type.- write the test case method\codeCPPUNIT_TEST_SUITE( ComplexNumberTest );// [...]CPPUNIT_TEST_EXCEPTION( testDivideByZeroThrows, MathException );CPPUNIT_TEST_SUITE_END();// [...]  void testDivideByZeroThrows()  {    // The following line should throw a MathException.    *m_10_1 / ComplexNumber(0);  }\endcodeIf the expected exception is not thrown, then a assertion failure is reported.\section test_factory_registry TestFactoryRegistryThe TestFactoryRegistry was created to solve two pitfalls:- forgetting to add your fixture suite to the test runner (since it is in   another file, it is easy to forget)- compilation bottleneck caused by the inclusion of all test case headers   (see \ref test_runner_code "previous example")The TestFactoryRegistry is a place where suites can be registered at initializationtime.To register the ComplexNumber suite, in the .cpp file, you add:\code#include <cppunit/extensions/HelperMacros.h>CPPUNIT_TEST_SUITE_REGISTRATION( ComplexNumber );\endcodeBehind the scene, a static variable type of \link CppUnit::AutoRegisterSuite AutoRegisterSuite \endlink is declared.On construction, it will \link CppUnit::TestFactoryRegistry::registerFactory(TestFactory*) register \endlink a \link CppUnit::TestSuiteFactory TestSuiteFactory \endlink into the \link CppUnit::TestFactoryRegistry TestFactoryRegistry \endlink. The \link CppUnit::TestSuiteFactory TestSuiteFactory \endlink returnsthe \link CppUnit::TestSuite TestSuite \endlink returned by ComplexNumber::suite().To run the tests, using the text test runner, we don't need to include the fixtureanymore:\code#include <cppunit/extensions/TestFactoryRegistry.h>#include <cppunit/ui/text/TestRunner.h>int main( int argc, char **argv){  CppUnit::TextUi::TestRunner runner;\endcodeFirst, we retreive the instance of the \link CppUnit::TestFactoryRegistry TestFactoryRegistry \endlink:\code  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();\endcodeThen, we obtain and add a new \link CppUnit::TestSuite TestSuite \endlink created by the  \link CppUnit::TestFactoryRegistry TestFactoryRegistry \endlink that contains all the test suite registered using CPPUNIT_TEST_SUITE_REGISTRATION().\code  runner.addTest( registry.makeTest() );  runner.run();  return 0;}\endcode\section post_build_check Post-build checkWell, now that we have our unit tests running, how about integrating unit testing to our build process ?To do that, the application must returns a value different than 0 to indicate thatthere was an error.\link CppUnit::TextUi::TestRunner::run() TestRunner::run() \endlink returns a boolean indicating if the run was successful.Updating our main programm, we obtains:\code#include <cppunit/extensions/TestFactoryRegistry.h>#include <cppunit/ui/text/TestRunner.h>int main( int argc, char **argv){  CppUnit::TextUi::TestRunner runner;  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();  runner.addTest( registry.makeTest() );  bool wasSucessful = runner.run( "", false );  return wasSucessful;}\endcodeNow, you need to run your application after compilation.With Visual C++, this is done in <em>Project Settings/Post-Build step</em>, by adding the following command: <tt>$(TargetPath)</tt>. It is expanded to the application executable path. Look up the project <tt>examples/cppunittest/CppUnitTestMain.dsp</tt> whichuse that technic.Original version by Michael Feathers.Doxygen conversion and update by Baptiste Lepilleur.*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91福利小视频| 99re热这里只有精品免费视频| 欧美亚洲高清一区二区三区不卡| 国产精品动漫网站| 91麻豆成人久久精品二区三区| 亚洲久草在线视频| 欧美日韩国产在线观看| 日本va欧美va精品发布| 久久久三级国产网站| 成人激情小说乱人伦| 一二三四社区欧美黄| 欧美一区二区三区色| 国产在线乱码一区二区三区| 国产亚洲精品免费| 色综合久久综合网97色综合 | 欧美大白屁股肥臀xxxxxx| 免费不卡在线视频| 国产亚洲成年网址在线观看| 成人午夜私人影院| 亚洲在线视频网站| 精品国产乱码久久久久久牛牛| voyeur盗摄精品| 亚洲国产精品一区二区尤物区| 日韩一区二区在线观看| 成人99免费视频| 午夜伊人狠狠久久| 国产精品私人影院| 欧美二区乱c少妇| 国产精品亚洲视频| 亚洲国产精品久久久久秋霞影院| 久久综合一区二区| 欧美伊人久久久久久久久影院 | 亚洲国产岛国毛片在线| 欧美色爱综合网| 国产91精品一区二区麻豆网站| 亚洲精品国产视频| 精品日韩一区二区三区免费视频| 97aⅴ精品视频一二三区| 日本不卡高清视频| 亚洲免费在线播放| 国产日本一区二区| 欧美一区二区三区在线看| av一区二区不卡| 九九久久精品视频| 亚洲国产色一区| 国产精品视频yy9299一区| 欧美一区二区三区思思人| 97久久人人超碰| 国产剧情在线观看一区二区 | 日韩精品欧美精品| 成人免费一区二区三区视频| 日韩天堂在线观看| 欧美挠脚心视频网站| 99精品在线免费| 国产精品综合二区| 老司机一区二区| 亚洲成人免费电影| 亚洲精品成人a在线观看| 国产精品网站在线播放| 日韩免费视频线观看| 4438x亚洲最大成人网| 一本一本久久a久久精品综合麻豆| 国产高清无密码一区二区三区| 免费成人美女在线观看| 日韩在线a电影| 亚洲国产成人av网| 亚洲资源中文字幕| 亚洲视频免费在线观看| 国产精品乱人伦| 日本一区二区成人| 中文字幕高清不卡| 国产精品人人做人人爽人人添| xfplay精品久久| 久久青草国产手机看片福利盒子| 日韩一级成人av| 欧美一区二区三区在线电影| 欧美喷潮久久久xxxxx| 欧美日韩成人高清| 欧美精三区欧美精三区| 欧美精品777| 91精品国产91久久久久久一区二区 | 亚洲少妇30p| 亚洲黄网站在线观看| 亚洲最色的网站| 亚洲夂夂婷婷色拍ww47| 五月天精品一区二区三区| 亚洲自拍偷拍麻豆| 天堂在线亚洲视频| 男男gaygay亚洲| 国内外成人在线| 国产老女人精品毛片久久| 国产91精品一区二区麻豆亚洲| av资源网一区| 91精彩视频在线观看| 欧美日韩日日夜夜| 精品国产免费一区二区三区四区| 久久综合九色综合欧美就去吻| 久久久一区二区三区捆绑**| 国产清纯美女被跳蛋高潮一区二区久久w| 久久久国产精华| 国产精品美女久久久久aⅴ国产馆| 日本一区二区成人在线| 一区二区三区四区中文字幕| 2024国产精品视频| 国产精品护士白丝一区av| 亚洲一二三四久久| 蜜臀久久99精品久久久久宅男| 久久国产三级精品| 成人av小说网| 欧美一区二区三区影视| 国产精品污www在线观看| 亚洲一二三专区| 国产一区二区精品久久| 91丝袜高跟美女视频| 91精选在线观看| 国产精品美女一区二区| 五月天激情综合网| zzijzzij亚洲日本少妇熟睡| 欧美日韩视频在线观看一区二区三区| 精品国产精品网麻豆系列| 亚洲日本丝袜连裤袜办公室| 日本视频免费一区| 成人性生交大片免费看中文网站| 欧美三区在线观看| 中文字幕高清不卡| 免费欧美在线视频| 色综合 综合色| 久久久久国产精品人| 亚洲国产美国国产综合一区二区| 国产一区二区三区日韩| 欧美日韩免费电影| 国产精品理伦片| 久久99精品久久久久婷婷| 在线观看一区二区精品视频| 久久久国产精华| 喷水一区二区三区| 欧美性受xxxx| 中文字幕欧美区| 老汉av免费一区二区三区 | 亚洲成人激情社区| 成人永久免费视频| 精品女同一区二区| 视频一区二区三区入口| 欧美亚洲高清一区| 亚洲欧美日韩在线播放| 丁香六月综合激情| 日韩欧美成人午夜| 午夜欧美一区二区三区在线播放| 99国产一区二区三精品乱码| 久久精品人人做| 九九视频精品免费| 日韩欧美国产一区二区三区| 亚洲va国产va欧美va观看| 欧洲国产伦久久久久久久| 亚洲国产高清不卡| 成人深夜福利app| 中文一区在线播放| 成人丝袜视频网| 国产精品狼人久久影院观看方式| 国产综合色视频| 精品国产伦一区二区三区观看体验 | 国产福利一区二区三区在线视频| 欧美一区二区在线免费观看| 三级一区在线视频先锋| 欧美区视频在线观看| 亚洲成a人片综合在线| 欧美视频在线一区| 五月婷婷另类国产| 3atv在线一区二区三区| 青青青伊人色综合久久| 日韩精品一区在线| 精品一区二区影视| 2021中文字幕一区亚洲| 国产精品一二三在| 亚洲国产成人一区二区三区| av高清久久久| 亚洲欧洲综合另类在线| 欧美伊人久久久久久久久影院| 亚洲国产wwwccc36天堂| 9191精品国产综合久久久久久 | 狠狠色丁香婷婷综合久久片| 久久―日本道色综合久久| 成人手机电影网| 亚洲精品高清视频在线观看| 欧美日韩aaaaaa| 精一区二区三区| 国产精品水嫩水嫩| 91美女在线看| 亚洲国产裸拍裸体视频在线观看乱了 | 精品国产一二三| 国产成人在线视频网址| 成人欧美一区二区三区黑人麻豆| 色婷婷综合五月| 日韩国产欧美在线视频| 久久看人人爽人人| 日本精品一级二级| 日韩精品国产精品| 国产无遮挡一区二区三区毛片日本| a在线欧美一区| 亚洲成人免费在线观看|