incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Pevtsov" <>
Subject RE: string exception safety tests
Date Thu, 04 May 2006 14:10:19 GMT
Ok, but I see another issue: the significant part of the test cases
doesn't require memory allocation.
These cases cann't produce bad_alloc and there is no reason to test
exception safety on them. 
Also the assert which verifies that an exception was thrown fails for
such test cases.
I suggest to exercise exception safety for the test cases which requires
memory allocation in any case 
(AFAIK, the size of the buffer allocated by string is
platform-dependent, so the string should be really long to require the

What do you think about this? 

Anton Pevtsov.

-----Original Message-----
From: Martin Sebor [] 
Sent: Wednesday, May 03, 2006 20:08
Subject: Re: string exception safety tests

Anton Pevtsov wrote:
> I am not that I understand your completely. Do you mean that the 
> exception safety should be verified for each test case (say first pass

> with exception and second with expected result) instead of the 
> verification on the special cases only (current state)?


> If yes, I expect that the execution time of each test doubled.

Probably quite a bit more than that, since each call would be executed
repeatedly in loop with an exception thrown in each iteration. That
should be fine except perhaps in the test cases involving very long
strings. We might want to reserve a special value (e.g., -1 :) to
*disable* the exception safety tests in a small number of test cases (as
opposed to enabling then for just a subset of them as we do now).


> With best wishes,
> Anton Pevtsov
> -----Original Message-----
> From: Martin Sebor []
> Sent: Wednesday, May 03, 2006 05:26
> To:
> Subject: string exception safety tests
> Currently there is just one exception safety per member function. But 
> since the exception safety test loops until no exception is thrown and

> the operation succeeds, returning the expected result, is there any 
> reason not to exercise exception safety in each test case 
> unconditionally?
> Martin

View raw message