Boost logo

Boost Users :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2007-08-14 23:39:15


"Yann Golanski" <yann_at_[hidden]> wrote in message
news:20070814084453.GB60576_at_kierun.org...
> For example:
> http://www.patmedia.net/~rogeeff/html/utf/user-guide/runtime-config/reference.html
> In "report_level", the levels are indicated as no, confirm, short and
> detaled -- the latter should be details.

Actually it's "detailed". Fixed anyway

> I am still unclear about the compile flags. I somehow cannot get ride
> of main in my test code. What would be really useful is an example of
> use with Makefile/bjam file/Studio files. I can help if you wanted on
> the *nix side.
>
> Here is the code, with Makefile following...
>
> ==== c++ code: working ====
>
> #define BOOST_TEST_DYN_LINK
> //#define BOOST_TEST_MAIN
>
> #include <boost/test/unit_test.hpp>
> #include <boost/bind.hpp>
> using namespace boost::unit_test;
>
> //! Test assertion, will always return true.
> void free_test_function( int i, int j )
> {
> BOOST_CHECK( true );
> }
>
> //! Main test case.
> bool init_function( )
> {
> framework::master_test_suite().p_name.value = "unit test";
> framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind>
> (&free_test_function,
> 1, 1 )));
> return true;
> }
>
> // TODO: How do I get ride of main???...
> int main( int argc, char* argv[] )
> {
> return ::boost::unit_test::unit_test_main( &init_function, argc,
> argv );
> }

You can't get rid (;)) of he main function in above setup. If you are desire
to define init function you will have to define main() s well.

The only way to avoid defining main() is to avoid definingthem both. Use
auto registration:

BOOST_AUTO_TEST_CASE( param_test )
{
   free_test_function( 1, 1 );
}

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