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: r412249 - in /incubator/stdcxx/trunk/tests: include/21.strings.h src/21.strings.cpp
Date Tue, 13 Jun 2006 16:33:48 GMT
Martin, I updated the replace test to exercise the reverse_iterator.
It is here:
http://people.apache.org/~antonp/stdcxx06132006/

I think that if it is ok we might want to make some changes to
StringTestCase and StringTestCaseData (copy constructable?) structures
to create new structure more easily.
Also the code which reverses the substring may be moved to the test
driver.

What do you think about this?

Thanks,
Anton Pevtsov


-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Friday, June 09, 2006 22:12
To: stdcxx-dev@incubator.apache.org
Subject: Re: svn commit: r412249 - in /incubator/stdcxx/trunk/tests:
include/21.strings.h src/21.strings.cpp


Anton Pevtsov wrote:
[...]
> Yes it is possible to reverse the expanded substring in known range, 
> but we check results in other way:
> 
> 	std::size_t match = rw_match (tcase.res, str.data (),
tcase.nres);
> 
> Here the rw_match calls rw_expand. These functions know nothing about 
> the iterators and range bounds and this seems to be a problem.

I'm not sure I understand why that would be a problem. If the driver
replaced the whole tcase structure with one created to match the
expected result when reverse_iterator is used why would rw_match() or
rw_expand() care? (The driver would have to expand the hardcoded source
string and argument in order to figure out the new expected result).

Suppose the test case is:

   string ("abcdef").insert (begin() + 2, first, last);

with the range denoted by the offset into the string and the number of
characters, extent, like so: (offset == 1) and (extent == 3). The test
invokes insert with (first == begin() + offset) and (last == begin() +
offset + extent). The test invokes insert with (first == begin() +
offset) and (last == first + extent) and expects the result to be the
hardcoded "abbcdcdef".

When the driver gets around to exercising reverse_iterators it changes
the offset so that (new_offset == str_size - offset -
extent) and the expected result to "abdbccdef". The test invokes the
function with (first = rbegin() + new_offset) and (last == first +
extent).

Martin

Mime
View raw message