
Richard Dingwall <rdingwall <at> gmail.com> writes:
Can anyone point me in the direction of a Boost.Test example for the following scenario?
1. I have a standard install of boost trunk (svn co boost-trunk, make, make install) 2. For each class in my program, I have a cpp file containing tests for it 3. All the tests should be compiled together into a single executable
I have read all the threads here I could find, and the (beta) documentation site, but I am finding all of the different link/main/initialization options very confusing, and I can't seem to find any complete examples.
Help!
What kind of setup would you prefer: link to the library or not, dynamic or static library? What compiler r u using? Which version of Boost? BTW, what do u find confusing in documentation? Here is one scenario: class_A_test.cpp: ------------- #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE( class_A_test ) BOOST_AUTO_TEST_CASE( test1 ) { // ... } BOOST_AUTO_TEST_SUITE_END() -------------- class_B_test.cpp: ------------- #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE( class_B_test ) BOOST_AUTO_TEST_CASE( test1 ) { // ... } BOOST_AUTO_TEST_CASE( test2 ) { // ... } BOOST_AUTO_TEST_SUITE_END() -------------- main.cpp: #define BOOST_TEST_MODULE My unit test suite #include <boost/test/unit_test.hpp> Link it all together (along with main.cpp) add static UTF library and it should do what you need. HTH, Gennadiy