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: Re: svn commit: r405254 - /incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp
Date Wed, 10 May 2006 14:48:13 GMT
Martin Sebor wrote:

> <>> Whoops, I just realized that I introduced these off-by-one errors

> <>during the replacement of LLEN with the directive.
> [...]

> <>> Anton, could you please modify the rest of the tests to use these new

> <>directives and the rw_expand() function instead of LSTR and rw_widen()?


Unfortunately, with your changes the replace test just fails on Windows.

The attached diff files contains my attempt to fix the problem.

The change log:

2006-05-10 Anton Pevtsov <antonp@moscow.vdiweb.com>
    * char.cpp (rw_match): Fixed the bug with the expanded string
    length.
    * 21.string.replace.cpp (test_replace_range): Added res_len
    paramter, fixed bug with incorrect expected result string
    length.
    (test_replace): Updated cal to test_replace_range, fixed bug
    with agruments for the rw_match call.

I updated rw_match functions and the call to them in the replace test.
Now it works on Linux and works better on Windows.
But on Windows I still have problems with the end of a string (somewhere 
in the test driver): it looks like there is no '\0' symbol there, but it 
is expected.
I saw the same problem with empty strings for other tests, so I'll 
investigate it.

It would be great if you take a look on the replace test on Windows.
What do you think about this?

I'll update the rest of the tests immediately after the fix of these 
problems, ok?
<>
Martin Sebor wrote:

> <>> PS FWIW, I've also fixed STDCXX-170 in my local tree but I'm not quite

> <>ready to commit the (extensive) changes.


Great!

Thanks,
Anton Pevtsov


> <>-----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com]
> Sent: Tuesday, May 09, 2006 05:28
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: svn commit: r405254 -
> /incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp
>
>
> sebor@apache.org wrote:

>> Author: sebor
>> Date: Mon May  8 18:08:00 2006
>> New Revision: 405254
>> 
>> URL: http://svn.apache.org/viewcvs?rev=405254&view=rev
>> Log:
>> 2006-05-08  Martin Sebor  <sebor@roguewave.com>
>> 
>> 	* replace.cpp: Replaced LSTR, LLEN, and LPAR in test cases with
>> 	strings containing the '<char>@<count>' directive(s). Corrected
>> 	errors in expected results involving said strings revealed by
>> 	the use of the more flexible/reliable directives.
>  
>

Whoops, I just realized that I introduced these off-by-one errors during
the replacement of LLEN with the directive.

Anyway, the directive is much more flexible than working with the
hardcoded long string in that it allows us to encode an arbitrarily long
string consisting of arbitrary characters for each test case.

For example, we can easily express long complex strings such as:
   { "abc", 'd' repeats 1234 times, "efg", 'h' repeats 5678 times } by
encoding them as follows:
   "abcd@1234efgh@5678".

Anton, could you please modify the rest of the tests to use these new
directives and the rw_expand() function instead of LSTR and rw_widen()?
Once we've converted them I would like to get rid of the long strings
and either remove rw_widen() or change it to behave like rw_expand().


>>       Added more
>> 	test cases exercising self-referential modification.
>> 	(test_replace_range): Added arguments, simplified, documented.
>> 	(test_replace): Used the new rw_expand() instead of rw_widen(),
>> 	added (and disabled for now) checking for memory leaks.
>  
>

Once I get memory leak detection working in the replace test we will
also need to change the rest of the tests to exercise the same.

Thanks!
Martin

PS FWIW, I've also fixed STDCXX-170 in my local tree but I'm not quite
ready to commit the (extensive) changes.

http://issues.apache.org/jira/browse/STDCXX-170


Mime
View raw message