??????????????????4
???????????? ???????[ 2013/8/7 13:26:40 ] ????????
????1.2 ??VC 6.0/window?°??(?ο?6)
????a) ?????????????CppUnit??tar?????????????????????D:CppUnit1.12.1
????b) ???????CppUnit????VC?д?D:CppUnit1.12.1srcCppUnitLibraries.dsw?????“Build | BatchBuild...”????????е?????????build???????D:CppUnit1.12.1lib????????????????п??????
????c)??Visual C++?н??????á?????VC???????????CppUnit?е?????????????????“Tools | Options...”???л???'Directories'?????????'include files'?????D:CppUnit1.12.1include???л???'libraries files'?????????CPPUNITHOME/lib/???л???'source files'?????????D:CppUnit1.12.1srccppunit?????檔
????d) ?????????н??????á???VC?д???д???????????Project Settings??????л???'C++'?????????'Code generation'??????release?棬???'Multithreaded DLL'??????Debug?棬???'Debug Multithreaded DLL'?????????????????????'C++ langage'?????All Configurations?????'enable Run-Time Type Information (RTTI)'???л???'Link'????????'Object/library modules'???????????lib???cppunitX.lib ??debug???cppunitd.lib?? release ???cppunit.lib ????testrunnerX.lib??debug???testrunnerd.lib?? release ??testrunner.lib??debug Unicode???testrunnerud.lib?? release Unicode???testrunneru.lib??
????e).?????·?????????????????????????CppUnit????dll????????????????????CppUnit????dll??·?????????????У??????????????????????е?path???????????????CPPUNITHOMElib???????????????????????Ч??
????1.3. ??Eclipse?°??CppUnit
????CppUnit?????Eclipse??????????????м??????????????CppUnit ???????????????????????????????.
????1.4.??MinGW/Eclipse/window ?°??
?????????????????window??????????gcc??????CppUnit??????????????????????MinGW.
????1.4.1MinGW???
?????????????ú??????????Windows????????????GNU??????????????????????windows???????????????????????????MinGW(MiniamalistGNU for Windows)???Щ???????????????ü??????????????е??????????????????????GCC??????Win32??????????????MinGW?????????????????書??????????????????????MS???C???????(MSVCTR.dll)????????????????gcc??д?????ANSI???????????????????C???п??????MinGW?????????????W32API—???????????win32API??????????????
??????MinGW???????Cygwin:Cygnus Solutions????????????????????????????????С?Cygwin?????gcc??gdb??gas?????????????????win32??????????????????Щ?????????window?У??????(????win32API??д?????Unix?????????)??Unix??????????????????????????
??????????????°??????Linux?????????
????????????е?????????????????????????????????????????
????2 CppUnit???--????ο?[3]
/*Program:testcppunit.cpp -- a simple hellow example which use the cppunit tool*/
#include <iostream>
#include <cppunit/TestRunner.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
class Test : public CPPUNIT_NS::TestCase
{
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testHelloWorld);
CPPUNIT_TEST_SUITE_END();
public:
void setUp(void) {}
void tearDown(void) {}
protected:
void testHelloWorld(void) { std::cout << "Hello?? world!" << std::endl; }
};
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
int main( int argc?? char **argv )
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
return result.wasSuccessful() ? 0 : 1;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11