|
Boost Users : |
From: Jason House (jasonhouse_at_[hidden])
Date: 2006-09-05 18:07:33
Which version of boost test does this apply to? I downloaded the latest
stable boost version of 1.33.1 and grep -r gives no matches for
BOOST_TEST_NO_MAIN or BOOST_TEST_DYN_LINK. I also see no definitions
for a function named unit_test_main. There's a header file with that
name, but it defines a normal main regardless of what is #define'd.
I suspect that maybe this is a feature with the CVS version?
Gennadiy Rozental wrote:
> "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