??????????
?????????? ???????[ 2010/2/20 15:40:48 ] ????????
????????????????????????飬???????????????????????е?????????????????????????????????е?????????? ?????????????????????? ????????????? ??????????????????????
????2. ???÷?Χ
??????????C??C++?????в????
????3. ????????
????3.1 C++???
????3.1.1??????????Visual C++??Windows??????ó???
????3.1.1.1??????CppUnit1.6.2?棬?????·???x:cppunit-1.6.2??
?????????????????ò??????????????????????????·??x:cppunit-1.6.2include??????????????·??x:cppunit-1.6.2lib??
????????DEBUG????????滷????
??????????????????????????testrunnercd.lib?????в??????????????????cppunitcd.lib???????????
???????????Add-ins???????x:cppunit-1.6.2libTestRunnerDSPlugInD.dll??
??????Project Settings/C++/C++ Language??????RTTI??
????3.1.1.2??????????????
????1?????????????Test??????????????????????硰CMabString?????????????MabString.cpp?????????????????TestMabString.cpp??
????2??????????????????????????????????TestMabString?????
??????????testmabstring.h
#ifndef CPP_UNIT_TestNode_H
#define CPP_UNIT_TestNode_H
//???????????????
#include <cppunit/TestCase.h>
#include <cppunit/extensions/HelperMacros.h>
//??????????????????
#include "mabstring.h"
//????????????????????
class TestMabString : public CppUnit::TestCase
{
??//????????????б?????б???????????в??????????????????
??CPPUNIT_TEST_SUITE( TestMabString );
??CPPUNIT_TEST( FindByName );
??CPPUNIT_TEST_SUITE_END();
??protected:
??//
??CMabString m_MabStr;
??public:
????//?????????????????????
????void setUp ();
????//????????
????void tearDown();
??protected:
????//????????
????void FindByName (void);
};
#endif
???????testmabstring.cpp
#include "TestMabString.h"
#include "iostream.h"
#include "strstrea.h"
//?????????
CPPUNIT_TEST_SUITE_REGISTRATION( TestMabString );
//???????????
void TestMabString::FindByName ()
{
??//?????????????в???
??//normal test
??//?????????????????в???
??//extra test??
??//???????????в???
??//exception test??
??bool bRet=false;
??try{
????//put the exception code here...
??}
??//catch(CXXX& e)
??catch(...)
??{
????bRet=true;
??}
??CPPUNIT_ASSERT(bRet);
??//????????????????е???????????е?·????????CMabString???CString
??//?????????????????????CMabString?е?Find?????????CString?е?Find??????//???????????????
??//??????????в??ò????·????
??//other test?? see the ...
}
void TestMabString::setUp ()
{
??//????????????????
??m_pNode=new Node();
}
void TestMabString::tearDown()
{
??//???????????
??if(m_pNode)
????delete m_pNode;
}
??????
???·???
??????????????????
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