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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cookbook.dox

?? 開發源代碼的CPU卡的COS源程序。
?? 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精品国产高清一区二区三区蜜臀| 欧洲一区在线观看| 久久免费精品国产久精品久久久久| 亚洲精品一线二线三线无人区| 精品国产网站在线观看| 一区二区三区在线播放| 国产黄人亚洲片| 欧美一级一区二区| 一区二区久久久久| 99riav久久精品riav| 26uuu国产在线精品一区二区| 日韩三级视频在线看| 亚洲成av人片| 日本精品视频一区二区三区| 91亚洲精华国产精华精华液| 在线观看视频一区| 国产精品传媒视频| 国产资源精品在线观看| 欧美电视剧在线看免费| 日韩不卡一二三区| 欧美一区二区精品在线| 五月婷婷另类国产| 欧美日韩国产电影| 午夜视黄欧洲亚洲| 在线免费观看日韩欧美| 精品国产精品网麻豆系列| 婷婷综合另类小说色区| 欧美久久高跟鞋激| 久久久国产精品午夜一区ai换脸| 亚洲色图都市小说| 色婷婷av一区二区三区大白胸 | 欧美日韩精品欧美日韩精品一综合| 欧美男男青年gay1069videost| 久久久久免费观看| 粉嫩av一区二区三区粉嫩| 国产午夜精品福利| 成人高清视频在线观看| 在线电影国产精品| 久久精品国产一区二区三| 欧美电视剧免费全集观看| 亚洲视频一二区| 一本到三区不卡视频| 亚洲高清一区二区三区| 欧美女孩性生活视频| 国产精品久久久久久亚洲伦| 99国产一区二区三精品乱码| 亚洲综合精品久久| 91麻豆精品国产91久久久久久| 国产精品久久久久一区| 色婷婷亚洲综合| 日本一区二区成人| 在线观看免费一区| 国产精品久线在线观看| 欧美性受xxxx黑人xyx| 蜜臀久久99精品久久久久久9| 91福利精品第一导航| 日韩综合小视频| 在线观看欧美黄色| 精品一区二区三区日韩| 亚洲三级视频在线观看| 制服丝袜国产精品| 国产盗摄女厕一区二区三区| 一区二区三区精品在线观看| 91精品国产丝袜白色高跟鞋| 成人av在线资源网| 丝袜亚洲另类丝袜在线| 国产精品情趣视频| 成人一区二区三区视频在线观看 | 一本色道久久综合亚洲精品按摩| 精品国产成人系列| 91蜜桃传媒精品久久久一区二区| 国产精品二区一区二区aⅴ污介绍| 国产一区二区美女诱惑| 一区二区三区丝袜| 99久久精品国产一区二区三区| 国产亚洲短视频| 成人午夜激情在线| 日韩精品五月天| 中文字幕人成不卡一区| 欧美成人a∨高清免费观看| 在线亚洲一区二区| 国产 欧美在线| 麻豆国产欧美一区二区三区| 一区二区三区高清| 欧美三片在线视频观看| 成人精品gif动图一区| 美女久久久精品| 亚洲bt欧美bt精品777| 亚洲人成精品久久久久久| 久久久不卡影院| 99re这里只有精品6| 国产成人精品影视| 国产中文字幕一区| 久久精品国产精品亚洲精品| 精品美女一区二区| 欧美一区二区三区影视| 欧美在线影院一区二区| 91小视频在线| 99在线精品观看| 亚洲欧美韩国综合色| 国产精品毛片久久久久久久| 久久久精品国产免费观看同学| www.亚洲在线| 99热精品国产| 成人自拍视频在线观看| 岛国精品在线观看| 成人永久免费视频| 亚洲成人免费看| 亚洲制服丝袜一区| 亚洲资源中文字幕| 香蕉乱码成人久久天堂爱免费| 精品久久久久久久一区二区蜜臀| 成人黄色电影在线 | 精品一区二区免费| 麻豆91免费看| 麻豆91免费观看| 国产制服丝袜一区| 亚洲国产日产av| 26uuu精品一区二区三区四区在线| 91伊人久久大香线蕉| 成人18视频日本| 99国产精品视频免费观看| 色综合久久久网| 欧美日韩午夜精品| 日韩免费看网站| xfplay精品久久| 色94色欧美sute亚洲线路一久| 国产美女在线精品| 99精品热视频| 欧美日韩视频在线第一区| 成人精品小蝌蚪| 精品在线免费观看| 国产成人综合视频| 97精品久久久久中文字幕| 欧美性xxxxxx少妇| 精品国产乱码91久久久久久网站| 精品视频1区2区| 久久伊99综合婷婷久久伊| 最好看的中文字幕久久| 亚洲成av人片观看| 国产91综合一区在线观看| 色悠悠久久综合| 欧美电影精品一区二区| 中文字幕中文字幕中文字幕亚洲无线| 亚洲精品在线观看网站| 欧美一区二区三区的| 欧美性生活久久| 久久久精品综合| 久久综合国产精品| 亚洲线精品一区二区三区八戒| 国产精品毛片大码女人| 午夜精品免费在线| 成人h动漫精品| 欧美一区二区三区免费| 亚洲欧美另类图片小说| 精品一区二区三区在线播放视频| 日韩av不卡在线观看| 青青草国产精品亚洲专区无| 懂色一区二区三区免费观看| 欧美色涩在线第一页| 国产欧美一区二区精品仙草咪| 久久欧美中文字幕| 久久蜜桃香蕉精品一区二区三区| 精品国产青草久久久久福利| 亚洲激情av在线| 国产精品系列在线观看| 成人在线综合网站| 欧美不卡一二三| 亚洲国产裸拍裸体视频在线观看乱了| 亚洲综合男人的天堂| 国产成人在线视频免费播放| 欧美日韩国产在线播放网站| 欧美一二三区在线| 一区二区三区在线看| 日日噜噜夜夜狠狠视频欧美人 | 国产精品久久免费看| 综合久久综合久久| 国产激情视频一区二区在线观看 | 欧美丰满高潮xxxx喷水动漫| 亚洲欧美怡红院| 成人免费视频一区| 欧美优质美女网站| 欧美一区二区精品在线| 亚洲一区二区三区四区在线观看 | 日韩精品一区二区三区中文不卡 | 国产69精品久久久久毛片| 日韩视频在线观看一区二区| 亚洲国产你懂的| 欧美性受xxxx| www激情久久| 国产精品毛片大码女人| 成人免费黄色在线| 最新国产成人在线观看| 91污在线观看| 一区二区三区四区激情| 九九热在线视频观看这里只有精品|