Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users] [test] Boost.Test Mock
From: Andrey Torba (andreytorba_at_[hidden])
Date: 2010-03-03 04:43:23


Now i can test code for exception safety:

template<class T1, class T2>
void algo(
    boost::shared_ptr<T1> x,
    boost::shared_ptr<T2> y);

typedef mock_object<> Mock;
typedef boost::shared_ptr<Mock> SharedMock;

BOOST_TEST_EXCEPTION_SAFETY( fail_test )
  {
  algo(
    SharedMock( new Mock() ),
    SharedMock( new Mock() ));
  }

BOOST_TEST_EXCEPTION_SAFETY( success_test )
  {
  algo(
      boost::make_shared<Mock>(),
      boost::make_shared<Mock>());
  }

Very useful tool!

-- 
Regards, Andrey


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