Boost Users :
Subject: Re: [Boost-users] boost test with assert()
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-11-21 14:20:07
Hicham Mouline wrote:
> I use this test class:
What is your environment?
> class SimulationIdTest
> static void TestDestructorAfterAddRemoveSimulation();
> static void TestDestructorAfterAddRemoveContractSimulation();
> static void AddTests(boost::unit_test::test_suite* suite);
> TestDestructorxxx() are written so that the code inside,
> indirectly, throws an assert(false) (not my code)
Catching an assert is tricky business, rarely successful.
> I would like to test that indeed, it does throw the assert(false).
> void SimulationIdTest::AddTests(boost::unit_test::test_suite* suite)
> suite->add(BOOST_TEST_CASE(TestDestructorAfterAddRemoveSimulation), 1);
> I tried the above by saying there would be 1 failure, however the test suite
> on that failure ( the assert(false) ), even the second argument of
> suite->add is 1.
Assert is fatal error. Even if I am able to catch it I'll stop test
execution immediately after.
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