Boost Users :
Subject: Re: [Boost-users] [Boost] [Test] [1.38] "can't use testing tools before framework is initialized"
From: Greg Christopher (gchristopher_at_[hidden])
Date: 2009-05-18 18:42:55
> > My desired control flow is to have this test program in control
> and to use the BOOST logging tools. I am trying to slip in boost.test
> with a minimum of changes to this program. I have hooked its logging
> function to call boost logging facilities instead; just can't get past
> this problem.
> 1. Here is an example that defines main: http://tinyurl.com/qmve47.
> example does not use automated tools, but it might as well.
> 2. You may not need main. You can do your initialization either in
> global fixture in in test suite initialization function (like in
Thanks for the great tip-
I have organized the program to work this way. The sample code doesn't quite work, I had to cast the initialization function that is passed into unit_test_main (boost::unit_test::init_unit_test_func) .. I did that and I got pretty far but there is a strange runtime error that happens here:
get( test_unit_id id, test_unit_type t )
test_unit* res = s_frk_impl().m_test_units[id];
if( (res->p_type & t) == 0 )
throw internal_error( "Invalid test unit type" );
The test case I added was simpler and had no parameters to pass:
framework::master_test_suite().add( BOOST_TEST_CASE(TestMain) );
That happens successfully but the main test program never gets called and execution stops at the location above.
I saw this link:
Looks like I do need to autoregister a test suite first? I tried registering one with no luck.
Thanks for all your help!
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