stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r412249 - in /incubator/stdcxx/trunk/tests: include/21.strings.h src/21.strings.cpp
Date Fri, 09 Jun 2006 18:12:20 GMT
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