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

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

?? money.dox

?? 這是國外的resip協議棧
?? DOX
字號:
/*! \page money_example Money, a step by step example\section Table of contents  - \ref sec_setting_vc  - \ref sec_setting_unix  - \ref sec_running_test  - \ref sec_adding_testfixture  - \ref sec_first_tests  - \ref sec_more_tests  - \ref sec_credits  The example explored in this article can be found in \c examples/Money/.\section sec_setting_vc Setting up your project (VC++)\subsection sec_install Compiling and installing CppUnit libariesIn the following document, $CPPUNIT is the directory where you unpacked %CppUnit:$CPPUNIT/:	include/	lib/	src/		cppunit/First, you need to compile %CppUnit libraries:- Open the $CPPUNIT/src/CppUnitLibraries.dsw workspace in VC++.- In the 'Build' menu, select 'Batch Build...'- In the batch build dialog, select all projects and press the build button.- The resulting libraries can be found in the $CPPUNIT/lib/ directory.Once it is done, you need to tell VC++ where are the includes and librariesto use them in other projects. Open the 'Tools/Options...' dialog, and in the'Directories' tab, select 'include files' in the combo. Add a new entry thatpoints to $CPPUNIT/include/. Change to 'libraries files' in the combo and add a new entry for $CPPUNIT/lib/. Repeat the process with 'source files' and add $CPPUNIT/src/cppunit/.\subsection sec_getting_started Getting startedCreates a new console application ('a simple application' template will do).Let's link %CppUnit library to our project. In the project settings:- In tab 'C++', combo 'Code generation', set the combo to 'Multithreaded DLL'for the release configuration, and 'Debug Multithreaded DLL' for the debugconfigure,- In tab 'C++', combo 'C++ langage', for All Configurations, check 'enable Run-Time Type Information (RTTI)',- In tab 'Link', in the 'Object/library modules' field, add cppunitd.lib forthe debug configuration, and cppunit.lib for the release configuration.We're done !                              \section sec_setting_unix Setting up your project (Unix)We'll use \c autoconf and \c automake to make it simple to create our build environment. Create a directory somewhere to hold the code we're going to build. Create \c configure.in and \c Makefile.am in that directory to get started.<tt>configure.in</tt>\verbatimdnl Process this file with autoconf to produce a configure script.AC_INIT(Makefile.am)AM_INIT_AUTOMAKE(money,0.1)AM_PATH_CPPUNIT(1.9.6)AC_PROG_CXXAC_PROG_CCAC_PROG_INSTALLAC_OUTPUT(Makefile)\endverbatim<tt>Makefile.am</tt>\verbatim# Rules for the test code (use `make check` to execute)TESTS = MoneyAppcheck_PROGRAMS = $(TESTS)MoneyApp_SOURCES = Money.h MoneyTest.h MoneyTest.cpp MoneyApp.cppMoneyApp_CXXFLAGS = $(CPPUNIT_CFLAGS)MoneyApp_LDFLAGS = $(CPPUNIT_LIBS) -ldl\endverbatim                                          \section sec_running_test Running our testsWe have a main that doesn't do anything. Let's start by adding the mechanicsto run our tests (remember, test before you code ;-) ). For this example, we will use a TextTestRunner with the CompilerOutputter for post-build testing:<tt>MoneyApp.cpp</tt>\code#include "stdafx.h"#include <cppunit/CompilerOutputter.h>#include <cppunit/extensions/TestFactoryRegistry.h>#include <cppunit/ui/text/TestRunner.h>int main(int argc, char* argv[]){  // Get the top level suite from the registry  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();  // Adds the test to the list of test to run  CppUnit::TextUi::TestRunner runner;  runner.addTest( suite );  // Change the default outputter to a compiler error format outputter  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),                                                       std::cerr ) );  // Run the tests.  bool wasSucessful = runner.run();  // Return error code 1 if the one of test failed.  return wasSucessful ? 0 : 1;}\endcode  VC++: Compile and run (Ctrl+F5).  Unix: First build. Since we don't have all the file yet, let's create them  and build our application for the first time:\verbatimtouch Money.h MoneyTest.h MoneyTest.cppaclocal -I /usr/local/share/aclocalautoconfautomake -atouch NEWS README AUTHORS ChangeLog # To make automake happy./configuremake check\endverbatim  Our application will report that everythingis fine and no test were run. So let's add some tests...\subsection sec_post_build Setting up automated post-build testing (VC++)What does post-build testing means? It means that each time you compile,the test are automatically run when the build finish. This is veryuseful, if you compile often you can know that you just 'broke' something,or that everything is still working fine.Let's adds that to our project, In the project settings, in the 'post-build step' tab:- Select 'All configurations' (upper left combo)- In the 'Post-build description', enter 'Unit testing...'- In 'post-build command(s)', add a new line: <tt>\$(TargetPath)</tt><tt>\$(TargetPath)</tt> expands into the name of your application:Debug\\MoneyApp.exe in debug configuration and Release\\MoneyApp.exe in releaseconfiguration.What we are doing is say to VC++ to run our application for each build. Notices the last line of \c main(), it returns a different error code, depending on weither or not a test failed. If the code returned byan application is not 0 in post-build step, it tell VC++ that the buildstep failed.Compile. Notice that the application's output is now in the build window.How convenient!  (Unix: tips to integrate make check into various IDE?)                              \section sec_adding_testfixture Adding the TestFixtureFor this example, we are going to write a simple money class. Moneyhas an amount and a currency. Let's begin by creating a fixture wherewe can put our tests, and add single test to test Money constructor:<tt>MoneyTest.h:</tt>\code#ifndef MONEYTEST_H#define MONEYTEST_H#include <cppunit/extensions/HelperMacros.h>class MoneyTest : public CppUnit::TestFixture{  CPPUNIT_TEST_SUITE( MoneyTest );  CPPUNIT_TEST( testConstructor );  CPPUNIT_TEST_SUITE_END();public:  void setUp();  void tearDown();  void testConstructor();};#endif  // MONEYTEST_H\endcode- CPPUNIT_TEST_SUITE declares that our Fixture's test suite.- CPPUNIT_TEST adds a test to our test suite. The test is implemented by a method named testConstructor().- setUp() and tearDown() are use to setUp/tearDown some fixtures. We arenot using any for now.<tt>MoneyTest.cpp</tt>\code#include "stdafx.h"#include "MoneyTest.h"// Registers the fixture into the 'registry'CPPUNIT_TEST_SUITE_REGISTRATION( MoneyTest );void MoneyTest::setUp(){}void MoneyTest::tearDown(){}void MoneyTest::testConstructor(){  CPPUNIT_FAIL( "not implemented" );}\endcodeCompile. As expected, it reports that a test failed. Press the \c F4 key(Go to next Error). VC++ jump right to our failed assertion CPPUNIT_FAIL.We can not ask better in term of integration!\verbatimCompiling...MoneyTest.cppLinking...Unit testing....FG:\prg\vc\Lib\cppunit\examples\money\MoneyTest.cpp(26):AssertionTest name: MoneyTest.testConstructornot implementedFailures !!!Run: 1   Failure total: 1   Failures: 1   Errors: 0Error executing d:\winnt\system32\cmd.exe.moneyappd.exe - 1 error(s), 0 warning(s)\endverbatimWell, we have everything set up, let's start doing some real testing.              \section sec_first_tests Our first testsLet's write our first real test. A test is usually decomposed in three parts:- setting up datas used by the test- doing some processing based on those datas- checking the result of the processing\codevoid MoneyTest::testConstructor(){  // Set up  const std::string currencyFF( "FF" );  const double longNumber = 12345678.90123;  // Process  Money money( longNumber, currencyFF );  // Check  CPPUNIT_ASSERT_EQUAL( longNumber, money.getAmount() );  CPPUNIT_ASSERT_EQUAL( currencyFF, money.getCurrency() );}\endcodeWell, we finally have a good start of what our Money class willlook like. Let's start implementing...<tt>Money.h</tt>\code#ifndef MONEY_H#define MONEY_H#include <string>class Money{public:  Money( double amount, std::string currency )    : m_amount( amount )    , m_currency( currency )  {  }  double getAmount() const  {    return m_amount;  }  std::string getCurrency() const  {    return m_currency;  }private:  double m_amount;  std::string m_currency;};#endif\endcodeInclude <tt>Money.h</tt> in MoneyTest.cpp and compile.Hum, an assertion failed! Press F4, and we jump to the assertionthat checks the currency of the constructed money object. The reportindicates that string is not equal to expected value. There is onlytwo ways for this to happen: the member was badly initialized or wereturned the wrong value. After a quick check, we find out it is the former.Let's fix that:<tt>Money.h</tt>\code  Money( double amount, std::string currency )    : m_amount( amount )    , m_currency( currency )  {  }\endcodeCompile. Our test finally pass!Let's add some functionnality to our Money class.                                          \section sec_more_tests Adding more tests\subsection sec_equal Testing for equality  We want to check if to Money object are equal. Let's start by addinga new test to the suite, then add our method:<tt>MoneyTest.h</tt>\code  CPPUNIT_TEST_SUITE( MoneyTest );  CPPUNIT_TEST( testConstructor );  CPPUNIT_TEST( testEqual );  CPPUNIT_TEST_SUITE_END();public:  ...  void testEqual();\endcode<tt>MoneyTest.cpp</tt>\codevoidMoneyTest::testEqual(){  // Set up  const Money money123FF( 123, "FF" );  const Money money123USD( 123, "USD" );  const Money money12FF( 12, "FF" );  const Money money12USD( 12, "USD" );  // Process & Check  CPPUNIT_ASSERT( money123FF == money123FF );     // ==  CPPUNIT_ASSERT( money12FF != money123FF );      // != amount  CPPUNIT_ASSERT( money123USD != money123FF );    // != currency  CPPUNIT_ASSERT( money12USD != money123FF );     // != currency and != amount}\endcode  Let's implements \c operator \c == and \c operator \c != in Money.h:<tt>Money.h</tt>\codeclass Money{public:...  bool operator ==( const Money &other ) const  {    return m_amount == other.m_amount  &&             m_currency == other.m_currency;  }  bool operator !=( const Money &other ) const  {    return (*this == other);  }};\endcode  Compile, run... Ooops... Press F4, it seems we're having trouble with \c operator \c !=. Let's fix that:\code  bool operator !=( const Money &other ) const  {    return !(*this == other);  }\endcodeCompile, run. Finally got it working!\subsection sec_opadd Adding moneys  Let's add our test 'testAdd' to MoneyTest. You know the routine...<tt>MoneyTest.cpp</tt>\codevoid MoneyTest::testAdd(){  // Set up  const Money money12FF( 12, "FF" );  const Money expectedMoney( 135, "FF" );  // Process  Money money( 123, "FF" );  money += money12FF;  // Check  CPPUNIT_ASSERT( expectedMoney == money );           // add works  CPPUNIT_ASSERT( &money == &(money += money12FF) );  // add returns ref. on 'this'.}\endcode  While writing that test case, you ask yourself, what is the result ofadding money of currencies. Obviously this is an error and it should bereported, say let throw an exception, say \c IncompatibleMoneyError, when the currencies are not equal. We will write another test casefor this later. For now let get our testAdd() case working:<tt>Money.h</tt>\codeclass Money{public:...  Money &operator +=( const Money &other )  {    m_amount += other.m_amount;    return *this;  }}; \endcodeCompile, run. Miracle, everything is fine! Just to be sure the test is indeedworking, in the above code, change \c m_amount \c += to \c -=. Build and check that it fails (always be suspicious of test that work the first time: you may have forgotten to add it to the suite for example)! Change the code back so that all the tests are working.    Let's the incompatible money test case before we forget about it...That test case expect an \c IncompatibleMoneyError exception to be thrown. %CppUnit can test that for us, you need to specify that the test caseexpect an exception when you add it to the suite:  <tt>MoneyTest.h</tt>\codeclass MoneyTest : public CppUnit::TestFixture{  CPPUNIT_TEST_SUITE( MoneyTest );  CPPUNIT_TEST( testConstructor );  CPPUNIT_TEST( testEqual );  CPPUNIT_TEST( testAdd );  CPPUNIT_TEST_EXCEPTION( testAddThrow, IncompatibleMoneyError );  CPPUNIT_TEST_SUITE_END();public:  ...  void testAddThrow();};\endcodeBy convention, you end the name of such tests with \c 'Throw', that way, youknow that the test expect an exception to be thrown. Let's write our test case:<tt>MoneyTest.cpp</tt>\codevoid MoneyTest::testAddThrow(){  // Set up  const Money money123FF( 123, "FF" );  // Process  Money money( 123, "USD" );  money += money123FF;        // should throw an exception}\endcode  Compile... Ooops, forgot to declare the exception class. Let's do that:<tt>Money.h</tt>\code#include <string>#include <stdexcept>class IncompatibleMoneyError : public std::runtime_error{public:  IncompatibleMoneyError() : runtime_error( "Incompatible moneys" )  {  }};\endcode  Compile. As expected testAddThrow() fail... Let's fix that:  <tt>Money.h</tt>\code  Money &operator +=( const Money &other )  {    if ( m_currency != other.m_currency )      throw IncompatibleMoneyError();    m_amount += other.m_amount;    return *this;  }\endcode  Compile. Our test finaly passes!  TODO:- How to use CPPUNIT_ASSERT_EQUALS with Money- Copy constructor/Assignment operator- Introducing fixtures- ?                    \section sec_credits CreditsThis article was written by Baptiste Lepilleur. Unix configuration & set up by Phil Verghese. Inspired from many others (JUnit, Phil's cookbook...), and all the newbies around that keep asking me for the 'Hello world' example ;-)*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合丝袜美腿| 国产欧美在线观看一区| 亚洲成在人线在线播放| 91久久精品一区二区三区| 一区二区在线观看视频在线观看| 99视频精品免费视频| 亚洲精品日韩综合观看成人91| 91久久精品网| 日韩在线一二三区| 欧美精品一区视频| 东方欧美亚洲色图在线| 亚洲视频免费在线观看| 欧美性大战久久久久久久蜜臀| 亚洲成人高清在线| 日韩一级高清毛片| 国产精品影视在线观看| 国产精品麻豆欧美日韩ww| 一本久道久久综合中文字幕| 亚洲bt欧美bt精品777| 欧美tickle裸体挠脚心vk| 国产高清亚洲一区| 亚洲综合久久av| 日韩欧美美女一区二区三区| 国产馆精品极品| 亚洲国产一区二区视频| 日韩午夜精品视频| av电影在线观看完整版一区二区| 亚洲激情中文1区| 久久综合狠狠综合| 欧美最猛黑人xxxxx猛交| 老司机一区二区| 日韩美女精品在线| 欧美大胆人体bbbb| 成人一区二区三区| 日本午夜一区二区| 综合精品久久久| 日韩一区二区不卡| 日本精品免费观看高清观看| 久久精品国产99国产| 亚洲色图欧美在线| 欧美精品一区二区三| 在线观看日韩国产| 风间由美一区二区av101| 亚洲成人免费看| 亚洲图片欧美激情| 久久综合国产精品| 欧美喷水一区二区| 99re热这里只有精品视频| 麻豆91免费看| 亚洲成人av一区二区| 综合激情网...| 国产视频一区不卡| 日韩午夜在线影院| 欧美日韩精品二区第二页| 99久久99久久精品国产片果冻| 久久99最新地址| 婷婷国产在线综合| 一区二区三区.www| 国产精品嫩草99a| 久久综合色8888| 日韩三级在线观看| 欧美日免费三级在线| 97se亚洲国产综合在线| 丁香啪啪综合成人亚洲小说| 久久99久久99| 热久久久久久久| 亚洲 欧美综合在线网络| 自拍偷拍亚洲激情| 中文字幕制服丝袜成人av| 国产欧美日韩一区二区三区在线观看| 日韩一区二区免费电影| 91精品国模一区二区三区| 欧美日本韩国一区| 在线不卡免费欧美| 欧美高清性hdvideosex| 欧美日韩午夜在线| 欧美美女视频在线观看| 欧美浪妇xxxx高跟鞋交| 欧美乱妇20p| 91麻豆精品国产91久久久| 欧美日韩不卡一区| 欧美精品日韩精品| 91精品国产综合久久久久久久| 欧美视频在线观看一区二区| 欧美在线一区二区三区| 欧美色老头old∨ideo| 91福利小视频| 欧美日韩国产首页| 日韩欧美在线123| 精品国产乱码久久久久久久| 久久久国产精品午夜一区ai换脸| 国产日韩欧美a| 亚洲婷婷国产精品电影人久久| 中文字幕欧美一区| 一区二区三区四区国产精品| 香蕉乱码成人久久天堂爱免费| 婷婷久久综合九色综合伊人色| 石原莉奈一区二区三区在线观看 | 久久国产精品99精品国产| 日本网站在线观看一区二区三区| 蜜桃av一区二区在线观看| 国产精品中文有码| 91麻豆文化传媒在线观看| 欧美日精品一区视频| 日韩亚洲欧美一区| 欧美韩日一区二区三区四区| 伊人色综合久久天天| 久久精品国产一区二区三区免费看| 国产精品综合久久| 不卡的av电影| 91精品国产综合久久小美女| 国产日韩成人精品| 一区二区三区精品在线| 久久99日本精品| 91在线观看高清| 日韩一级片网站| 综合久久一区二区三区| 蜜臀av一区二区三区| eeuss鲁一区二区三区| 91麻豆精品国产自产在线| 国产日韩欧美精品在线| 亚洲国产成人av好男人在线观看| 九色综合狠狠综合久久| 色综合久久66| 精品国产免费人成在线观看| 亚洲四区在线观看| 精品一区二区三区香蕉蜜桃| 91久色porny | 91香蕉视频污| 欧美电影免费观看高清完整版在| 成人欧美一区二区三区小说| 美国毛片一区二区三区| 色美美综合视频| 久久婷婷久久一区二区三区| 夜夜嗨av一区二区三区| 国产高清不卡一区| 欧美一区二区网站| 一区二区三区精品视频在线| 国产成人免费av在线| 日韩欧美中文字幕一区| 亚洲国产日韩综合久久精品| av激情综合网| 国产欧美一区二区精品秋霞影院| 无码av中文一区二区三区桃花岛| 99精品欧美一区| 国产网红主播福利一区二区| 婷婷六月综合网| 欧美性色黄大片手机版| 亚洲欧美自拍偷拍色图| 国产激情一区二区三区四区| 日韩欧美一级片| 日韩精品国产精品| 欧洲精品一区二区三区在线观看| 国产精品伦理一区二区| 国产成人综合在线观看| 久久综合视频网| 国产综合一区二区| 精品国产伦理网| 久久精品国产澳门| 日韩精品中午字幕| 日韩成人精品在线观看| 欧美丝袜丝nylons| 亚洲综合成人网| 欧美在线短视频| 一区二区三区欧美亚洲| 91麻豆高清视频| 亚洲色图都市小说| 91香蕉视频在线| 亚洲精品视频在线| 日本黄色一区二区| 亚洲尤物在线视频观看| 91豆麻精品91久久久久久| 一个色综合av| 欧美日韩国产综合一区二区 | 国产精品成人一区二区三区夜夜夜| 国产在线播放一区三区四| 精品国产麻豆免费人成网站| 国产一区二三区| 中文字幕欧美国产| av亚洲精华国产精华| 亚洲裸体在线观看| 色婷婷激情综合| 亚洲一区二区三区影院| 91精品国产综合久久婷婷香蕉| 美女在线视频一区| 国产亚洲短视频| av激情成人网| 日韩精品每日更新| 精品国产露脸精彩对白| 成人h精品动漫一区二区三区| 国产精品国产a| 欧美日韩国产综合视频在线观看 | 日韩美女久久久| 精品污污网站免费看| 蜜乳av一区二区三区| 国产欧美视频一区二区| 在线观看视频一区二区欧美日韩| 日日骚欧美日韩| 国产欧美日韩另类一区| 色综合久久综合网欧美综合网 |