
"Jason House" <jasonhouse@comcast.net> wrote in message news:edhfuf$dth$1@sea.gmane.org...
As I currently understand boost.test, it provides its own main function. If I want to make a separate executable to run the tests, that seems straight forward. But how would I embed the testing inside a normal program with a simple command-line switch for running them?
Depends how you build UTF: 1. Static library/"included" version 1.a. define BOOST_TEST_NO_MAIN during library/executable build 1.b. in your main file call unit_test_main(): if( /* call unit test */ ) return boost::unit_test::unit_test_main( argc, argv ); 2. Dynamic library 2.a. define BOOST_TEST_NO_MAIN during library build 2.b. define BOOST_TEST_DYN_LINK during both library and executable build 2.c. In the file containing function main() include <boost/test/unit_test.hpp> and define BOOST_TEST_MAIN 2.d. in your main file call unit_test_main(): if( /* call unit test */ ) return boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); Gennadiy