Boost logo

Boost Users :

Subject: Re: [Boost-users] Unit test framework and environment initialization/finalization
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-02-12 12:04:19


Vinokurov, Aleksandr <Aleksandr.Vinokurov <at> billing.ru> writes:

> I mean some kind of solid calling my finalization function to properly stop
the environment, like a try {}
> final {} in Java -- even if the test fails by BOOST_REQUIRE or BOOST_FAIL.
>
> Any suggestions or recommendations from gurus?

You should use Fixtures.
 
> Oh, just remembered: I use 1.33 version of Boost.

This release did not have internal support for fixtures, but you can do regular
C++ RAII based solution. Implement fixture class (init in contructor, teardown
in destructor) and instantiate it on a first line of test method.

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