|
Boost Users : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-09-04 21:40:40
"Jason House" <jasonhouse_at_[hidden]> wrote in message
news:edhfuf$dth$1_at_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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net