stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Pevtsov <>
Subject Re: Re: svn commit: r395448 - in /incubator/stdcxx/trunk/tests: include/21.strings.h src/21.strings.cpp
Date Fri, 21 Apr 2006 15:09:44 GMT
<>Martin Sebor wrote:
 > I added these to the 21.strings.h header and modified the append and
 > assign tests but I didn't have time to see if the changes are enough
 > to accommodate the replace test.

Thanks. These changes are enough. The patch to the replace test is
attached. Also there are changes I made to 21.strings.h and .cpp. 
I just added new format function which accepts additional parameter -
the method name.

I have a question: could you explain why you have moved "which" member
to the TestCase structure, please?
It looks like it is impossible to have one test cases array for two
replace overloads now.

And I' suspect a problem with 

	int StringMembers::
	opt_memfun_disabled [StringMembers::member_functions];

the StringMembers::member_functions is equal to 10, but the replace_...
enumeration members have values starting from 8. Is it correct?
I implemented the workaround in the replace test, but it is an ugly

But I think that there is no need to have separate enum members for each
Instead we may have enumeration elements describing method signature
(there are about 20 different signatures), i.e:

method_ptr - means call to string::method (const charT* s),
method_off_size_ptr - means call to string::method (size_type pos,
size_type n, const charT* s),
method_off_size_str_off_size - means call to string::method (size_type
pos1, size_type n1, const string& s, size_type pos2, size_type n2),
method_it_ptr - means call to string::method (Iterator first, Iterator
last, const charT* s),

The format function will contain string for each enumeration member (the
format doesn't depend on method, only on parameters). 
I think there is no need in special formatting directive at this time -
the format and format_hdr (the same to format but only parameters
declaration) functions will do all work.

Of course, in this case it will be impossible to test several methods in
one test function. But I think this doesn't make sense.

What do you think about this?

Also I suggest to move the MemFun structure to the 21.strings.h header.
This allow us to move run_test and top-level test functions to
21.strings.cpp and make them common for all tests.
Is there any constraint that I missed and which doesn't allow us do

Anton Pevtsov

-----Original Message-----
From: Martin Sebor [] 
Sent: Friday, April 21, 2006 05:16
Subject: Re: svn commit: r395448 - in /incubator/stdcxx/trunk/tests:
include/21.strings.h src/21.strings.cpp

Martin Sebor wrote:

>> Anton Pevtsov wrote:

>>>> And I have several questions:
>>>> 1) Does the TestCase structure contain enough members to test all 
>>>> methods? For some of them off1, size1, off2 and size2 are required 
>>>> simultaneously. Also the result may be an integer.
>> No, it doesn't, not yet. It will need to be augmented to take this 
>> into account.

I added these to the 21.strings.h header and modified the append and
assign tests but I didn't have time to see if the changes are enough to
accommodate the replace test.

>>>> 2) May be it would be useful to include the "const char* method_name"

>>>> member into Test structure to eliminate additional code from the 
>>>> format method? For example, each test may declare its name as a 
>>>> static characters array in the beginning and initialize the 
>>>> method_name structure with pointer to it. Or even add const char* 
>>>> method_name directly into the StringMembers structure.
>> Yes, I have been thinking about what else should go in there. Probably

>> not the method_name (to avoid data bloat) but something like it might 
>> be a good idea (e.g., the MemberFunction enum that the formatter would

>> map into the function name and signature).

I haven't done this yet but currently I'm thinking about replacing the
whole format() function with a general formatting directive that will
take the same arguments (i.e., the charT, Traits, and Allocator enums
and a pointer to the TestCase structure) and do the formatting directly.
In addition, I'm thinking about adding another directive (or enhancing
the same one) to format just the name of the member function (e.g.,
"assign") and another to format its signature (e.g., "assign(const
value_type*, size_type)"), and another still to format the name the of
the container (e.g., "std::string", or "std::basic_string<...>", etc.)

This is just so you know what's coming. Let me know what you think about
it and/or if you have any questions or suggestions.


View raw message