Boost logo

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-19 14:29:36


________________________________________
From: boost-users-bounces_at_[hidden] [boost-users-bounces_at_[hidden]] On Behalf Of Gennadiy Rozental [rogeeff_at_[hidden]]
Sent: Monday, May 18, 2009 6:21 PM
To: boost-users_at_[hidden]
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


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