|
Boost : |
From: Kevin Wheatley (hxpro_at_[hidden])
Date: 2005-09-22 11:11:24
Reece Dunn wrote:
> You need to be very careful here. If you have asserts in a destructor, they
> could throw and terminate your tests without any diagnostics! ATL has
> asserts in several destructors.
>
> Ideally, you would want the asserts to become test cases, i.e.
> CPPUNIT_ASSERT or BOOST_ASSERT but unfortunately, CPPUNIT_ASSERT throws an
> exception :(.
Indeed,
but doing that sort of thing in a destructor is real bad anyway, so
just ensure the class is always in a good state preserving the
invariants as much as poossible and not bother testing destructors
directly but observe their effects using suitable mock style objects.
Kevin
-- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk