Boost logo

Boost :

From: Gennadiy E. Rozental (rogeeff_at_[hidden])
Date: 2001-12-02 23:23:40


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
>
> ----- Original Message -----
> From: "Gennadiy E. Rozental" <rogeeff_at_m...>
>
> >
> > > =========
> > > BOOST_CHECKPOINT( message ) - to be used to mark a test flow
with a
> > check
> > > points. The checkpoint can help to locate a source of a runtime
> > exception.
> > > Example: test.cpp
> > > int test_main( int, char* [] )
> > > {
> > > BOOST_CHECKPOINT( "Going to throw an exception" );
> > > throw "some error";
> > > return 0;
> > > }
> > > Output:
> > > Exception in test_main : C string:some_error
> > > test.cpp(3) : last checkpoint: Going to throw an
exception
> > >
> > >
> > > Have you considered supplying BOOST_THROW(...) instead?
> >
> > What exectly do you mean?
> > I have BOOST_CHECK_THROW to check whether or not exception was
> > thrown.
>
> Sorry, I should have spelled it out:
>
> #define BOOST_THROW(expression)\
> do \
> { \
> BOOST_CHECKPOINT("throw " #expression); \
> throw expression; \
> } \
> while (0)

I still do not understand. What would be a purpuse of such tool?
Intended usage of BOOST_CHECLPOINT is like this:

void test_case() {
... some code
BOOST_CHECKPOINT( "Some test 1" );
... some code
BOOST_CHECKPOINT( "Some test 2" );
... some code
}

Now if any kind of runtime exceptions/signals occures (like SIGFPE)
you may try to locate where it happends.

Regatds,

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk