incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Pevtsov" <Ant...@moscow.vdiweb.com>
Subject RE: svn commit: r407684 - /incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp
Date Fri, 19 May 2006 15:13:06 GMT
Martin Sebor wrote:
> Anton, the most important bit here enables the exception safety tests
for all test cases (except those that test other exceptions such as >
out_of_range). I'd like to do the same in the rest of     > the tests as
well.

I see, thanks.  I made few changes to force it working on Windows
without asserts. 
Also I suggest to add new helper functions

template <class charT>
bool isUserAlloc (charT, UserAlloc<charT>*) {
    return true;
}

template <class charT>
bool isUserAlloc (charT, std::allocator<charT>*) {
    return false;
}

to the rw_allocator.h.
The diff files are here:
http://people.apache.org/~antonp/stdcxx05192006/

Also I updated several tests using the replace test as the example, they
are there too.

Martin Sebor wrote:
> I'm also thinking about exercising length_error in a similar way as
bad_alloc with UserAlloc, i.e., inducing the error by setting
> max_size() to a value less than the expected size of the result string
and then setting it to a greater value and letting the function succeed.

Sounds good. This allows us to avoid the tricky code, but how about the
exercising of the length_error for std::string and std::wstring ?


Thanks,
Anton Pevtsov


-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Friday, May 19, 2006 06:02
To: stdcxx-dev@incubator.apache.org
Subject: Re: svn commit: r407684 -
/incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp


sebor@apache.org wrote:
> Author: sebor
> Date: Thu May 18 18:41:46 2006
> New Revision: 407684

Anton, the most important bit here enables the exception safety tests
for all test cases (except those that test other exceptions such as
out_of_range). I'd like to do the same in the rest of the tests as well.

The SharedAlloc bits don't do anything yet, but they're a start.

I'm also thinking about exercising length_error in a similar way as
bad_alloc with UserAlloc, i.e., inducing the error by setting
max_size() to a value less than the expected size of the result string
and then setting it to a greater value and letting the function succeed.

Let me know your thoughts!

Martin

> 
> URL: http://svn.apache.org/viewvc?rev=407684&view=rev
> Log:
> 2006-05-18  Martin Sebor  <sebor@roguewave.com>
> 
> 	* 21.string.replace.cpp (test cases): Changed the meaning of
> 	(tcase.bthrow == 0) to enable the testing of exception safety,
> 	and used -1 to disable.
> 	(Test, MemFun): Removed unused typedefs.
> 	(test_replace): Renamed throw_after to throw_count to better
> 	reflect the purpose of the variable.
> 	Simplified the conditional computing the expected exception.
> 	Set UserAlloc::allocate() to throw bad_alloc analogously to
> 	operator new.
> 	Exercised exception safety in each test case by default (i.e.,
> 	when tcase.bthrow == 0).

Mime
View raw message