????CppUnit??????????

????CppUnit????xUnit?????е?????????C++??????????????????????Micheal Feathers??JUnit??????????GNULGPL?????

????CppUnit??????????????????????TestCase???????????TestCase?????????????????TestFixture????TestFixture?У???????????????????????????дTestCase??????????в???????TestFixture???????TestSuite?????????й????

???????????TestFixture??????????????????????????????Fixture???幫??????setUp()?????????????????tearDown()?????setUp?????????????????????У?CPPUNIT_ASSERT(bool)???ж???????????????????????????????????У????CPPUNIT_TEST?????????????????????CPPUNIT_TEST_SUITE??CPPUNIT_TEST_SUITE_END????????е??????????漲??Щ?????????е????.

????1 CppUnit???????????????

????1.1 ??Linux?°??

????????1??

?????????Ubuntu??????б????????????????????????????????:

????sudo apt-get install libcppunit-dev libcppunit-doc ?ο?[1]

?????ο?[2]?????????????????????build-essential(????libc6.so??libc6-dev.so??gcc???make?????)??????????????????????????????????????./configure????????

????????2-???????????

????CppUnit???????:http://sourceforge.net/projects/cppunit/files/cppunit/

??????????????????????????????????CppUnit??汾??1.12.1(???????????????????汾??2008??2??20???μ??5?????????и??£??????????????CppUnit1.12.1??????????????????:??http://pan.baidu.com/share/link?shareid=1903199222&uk=556148328

tar-xzf cppunit-1.12.1.tar.gz
cd cppunit-1.12.1
./configure
make
make check
sudo make install

?????????????????????????????????????make???????????????£?

/bin/bash ../../libtool --tag=CXX   --mode=link g++  -g -O2 -ldl  -o DllPlugInTester DllPlugInTester.o CommandLineParser.o ../../src/cppunit/libcppunit.la -lm
mkdir .libs
g++ -g -O2 -o .libs/DllPlugInTester DllPlugInTester.o CommandLineParser.o  -ldl ../../src/cppunit/.libs/libcppunit.so -lm
../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlsym'
../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlopen'
../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
make[2]: *** [DllPlugInTester] Error 1
make[2]: Leaving directory `/home/xc-pc/software/cppunit-1.12.1/src/DllPlugInTester'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/xc-pc/software/cppunit-1.12.1/src'
make: *** [all-recursive] Error 1

????????????????????????????????CppUnit??汾??????????????????????????????????????????CppUnit??Makefile?????800???У?????ó????????????

???????????:

????????????????????????????cppunit-1.12.1/src/DllPlugInTester???±??????????????????????μ?Makefile????????cd ??cppunit-1.12.1/src/DllPlugInTester???????vi(?????????????????emacs??gedit)??Makefile.???LIBS= -lm????LIBS= -lm  ???LIBS= -lm -ldl

???????????????????????cppunit-1.12.1/examples/simple???μ?Makefile???.

???????????????make??£??????????б??????????????????????????????????????????????????????????????