?????????????????2???????????????????????????????????????????????????????????????????????д????????????????????????????????????????????????????????????????????е???????2.1.2????????????????????
??????????????/????????????????????
????????????????????????????????д??
???????????????????????????
??????????????
?????????????ò????????????μ?????
?????????????????--??????????????
????????????????????д???·????
?????????????ü???????????????С?
????????????????????????????????
?????μ???????? & ??????
???????γ??????????C++?????д??????????????????????CPPUNIT???????????????÷?????
????????CPPUNIT????е???????????????????????????а??CPPUNIT????????Ubuntu Linux?????£????????????????
????sudo apt-get install libcppunit-dev
???????CPPUNIT?????????????????Linux???????У????????????????????????include????????????????CPPUNIT???????
??????????ú??????????????????????CPPUNIT??????????????????б????????????·?????????????????????á?
??????????????????1????????????????CPPUNIT???????
//mytest.cpp
#include <iostream>
#include <cppunit/TestCase.h>
class MyTest:public CppUnit::TestCase
{
public:
MyTest(std::string name): CppUnit::TestCase(name){}
void runTest()
{
CPPUNIT_ASSERT(1 == 1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(2.11?? 2.13?? 0.01);
}
};
int main()
{
MyTest test1("Test1_Name");
std::cout << "This is the test: " << test1.getName() << std::endl;
std::cout << "The test has number:" << test1.countTestCases() << std::endl;
test1.runTest();
return 0;
}
??????Ubuntu????????????б???ó???
????g++ -o mytest mytest.cpp -I/opt/local/include -L/opt/locallib -lcppunit -ldl
????????????????иó??????????????£?

???????????????????mytest.cpp????????漲?????????????????MyTest???????CPPUNIT??TestCase??????runTest?ж??????????????
????CPPUNIT_ASSERT(1 == 1);
????CPPUNIT_ASSERT_DOUBLES_EQUAL(2.11?? 2.13?? 0.01);
??????????????CPPUNIT_ASSERT??condition?????ж?condition?????檔
??????????????CPPUNIT_ASSERT_DOUBLES_EQUAL(expected?? actual?? delta)???ж???????????expected??actual???????????delta??