________________________________________ From: boost-users-bounces@lists.boost.org [boost-users-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental [rogeeff@gmail.com] Sent: Monday, May 18, 2009 6:21 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Boost] [Test] [1.38] "can't use testing tools before framework is initialized"
2. You may not need main. You can do your initialization either in global fixture or in test suite initialization function (like in example above)
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).
Cast to what? init function has right signature.
I did that and I got pretty far but there is a strange runtime error that happens here:
test_unit& 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" );
return *res; }
What the error message?
The test case I added was simpler and had no parameters to pass:
framework::master_test_suite().add( BOOST_TEST_CASE(TestMain) );
Please post simple example. I do not follow what is your problem. Greg>Here is sample code that reproduces the problem: Greg> http://pastebin.com/f58f7694e Thanks, Greg