OSDN Git Service

2003-03-18 Paolo Carlini <pcarlini@unitus.it>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Mar 2003 05:04:14 +0000 (05:04 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Mar 2003 05:04:14 +0000 (05:04 +0000)
Reshuffle 21_strings testsuite.
* testsuite/21_strings/append.cc, c_strings.cc, invariants.cc,
assign.cc, ctor_copy_dtor.cc, nonmember.cc, capacity.cc,
element_access.cc, operations.cc, char_traits_requirements.cc,
find.cc, replace.cc, char_traits_typedefs.cc, insert.cc, rfind.cc,
compare.cc, inserters_extractors.cc, substr.cc: Split up, add
wchar_t tests as follows.
* 21_strings/basic_string/append/char/1.cc: New.
* 21_strings/basic_string/append/wchar_t/1.cc: New.
* 21_strings/basic_string/assign/char/1.cc: New.
* 21_strings/basic_string/assign/char/2.cc: New.
* 21_strings/basic_string/assign/char/3.cc: New.
* 21_strings/basic_string/assign/wchar_t/1.cc: New.
* 21_strings/basic_string/assign/wchar_t/2.cc: New.
* 21_strings/basic_string/assign/wchar_t/3.cc: New.
* 21_strings/basic_string/capacity/1.cc: New.
* 21_strings/basic_string/capacity/char/1.cc: New.
* 21_strings/basic_string/capacity/char/2.cc: New.
* 21_strings/basic_string/capacity/wchar_t/1.cc: New.
* 21_strings/basic_string/capacity/wchar_t/2.cc: New.
* 21_strings/basic_string/compare/char/1.cc: New.
* 21_strings/basic_string/compare/wchar_t/1.cc: New.
* 21_strings/basic_string/cons/char/1.cc: New.
* 21_strings/basic_string/cons/char/2.cc: New.
* 21_strings/basic_string/cons/char/3.cc: New.
* 21_strings/basic_string/cons/char/4.cc: New.
* 21_strings/basic_string/cons/char/5.cc: New.
* 21_strings/basic_string/cons/wchar_t/1.cc: New.
* 21_strings/basic_string/cons/wchar_t/2.cc: New.
* 21_strings/basic_string/cons/wchar_t/3.cc: New.
* 21_strings/basic_string/cons/wchar_t/4.cc: New.
* 21_strings/basic_string/cons/wchar_t/5.cc: New.
* 21_strings/basic_string/element_access/char/1.cc: New.
* 21_strings/basic_string/element_access/char/2.cc: New.
* 21_strings/basic_string/element_access/char/3.cc: New.
* 21_strings/basic_string/element_access/wchar_t/1.cc: New.
* 21_strings/basic_string/element_access/wchar_t/2.cc: New.
* 21_strings/basic_string/element_access/wchar_t/3.cc: New.
* 21_strings/basic_string/find/char/1.cc: New.
* 21_strings/basic_string/find/wchar_t/1.cc: New.
* 21_strings/basic_string/insert/char/1.cc: New.
* 21_strings/basic_string/insert/char/2.cc: New.
* 21_strings/basic_string/insert/wchar_t/1.cc: New.
* 21_strings/basic_string/insert/wchar_t/2.cc: New.
* 21_strings/basic_string/inserters_extractors/char/1.cc: New.
* 21_strings/basic_string/inserters_extractors/char/4.cc: New.
* 21_strings/basic_string/inserters_extractors/char/5.cc: New.
* 21_strings/basic_string/inserters_extractors/char/6.cc: New.
* 21_strings/basic_string/inserters_extractors/char/7.cc: New.
* 21_strings/basic_string/inserters_extractors/char/8.cc: New.
* 21_strings/basic_string/inserters_extractors/char/9.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/1.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/4.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/5.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/6.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/7.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/8.cc: New.
* 21_strings/basic_string/inserters_extractors/wchar_t/9.cc: New.
* 21_strings/basic_string/operators/char/1.cc: New.
* 21_strings/basic_string/operators/char/2.cc: New.
* 21_strings/basic_string/operators/wchar_t/1.cc: New.
* 21_strings/basic_string/operators/wchar_t/2.cc: New.
* 21_strings/basic_string/replace/char/1.cc: New.
* 21_strings/basic_string/replace/char/2.cc: New.
* 21_strings/basic_string/replace/char/3.cc: New.
* 21_strings/basic_string/replace/char/4.cc: New.
* 21_strings/basic_string/replace/char/5.cc: New.
* 21_strings/basic_string/replace/wchar_t/1.cc: New.
* 21_strings/basic_string/replace/wchar_t/2.cc: New.
* 21_strings/basic_string/replace/wchar_t/3.cc: New.
* 21_strings/basic_string/replace/wchar_t/4.cc: New.
* 21_strings/basic_string/replace/wchar_t/5.cc: New.
* 21_strings/basic_string/rfind/char/1.cc: New.
* 21_strings/basic_string/rfind/char/2.cc: New.
* 21_strings/basic_string/rfind/char/3.cc: New.
* 21_strings/basic_string/rfind/wchar_t/1.cc: New.
* 21_strings/basic_string/rfind/wchar_t/2.cc: New.
* 21_strings/basic_string/rfind/wchar_t/3.cc: New.
* 21_strings/basic_string/substr/char/1.cc: New.
* 21_strings/basic_string/substr/wchar_t/1.cc: New.
* 21_strings/c_strings/char/1.cc: New.
* 21_strings/c_strings/char/2.cc: New.
* 21_strings/c_strings/wchar_t/1.cc: New.
* 21_strings/c_strings/wchar_t/2.cc: New.
* 21_strings/char_traits/requirements/char/1.cc: New.
* 21_strings/char_traits/requirements/wchar_t/1.cc: New.
* 21_strings/char_traits/typedefs/char/1.cc: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64524 138bc75d-0d04-0410-961f-82ee72b054a4

83 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/21_strings/basic_string/append/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/append.cc with 98% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/append/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/assign/char/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/assign/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/assign/char/3.cc [moved from libstdc++-v3/testsuite/21_strings/assign.cc with 58% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/capacity/1.cc [moved from libstdc++-v3/testsuite/21_strings/capacity.cc with 69% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/compare/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/compare.cc with 98% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc with 71% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/cons/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/char/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/char/4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/element_access.cc with 97% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc [moved from libstdc++-v3/testsuite/21_strings/invariants.cc with 65% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/find/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/find.cc with 98% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/insert/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/insert.cc with 72% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/insert/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/inserters_extractors.cc with 53% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/operations.cc with 95% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc [moved from libstdc++-v3/testsuite/21_strings/nonmember.cc with 99% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/char/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/char/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/char/4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/char/5.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/5.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/rfind.cc with 87% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/substr/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/substr.cc with 97% similarity]
libstdc++-v3/testsuite/21_strings/basic_string/substr/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/c_strings/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/c_strings.cc with 81% similarity]
libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/char_traits_requirements.cc with 56% similarity]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/typedefs/char/1.cc [moved from libstdc++-v3/testsuite/21_strings/char_traits_typedefs.cc with 94% similarity]
libstdc++-v3/testsuite/21_strings/replace.cc [deleted file]
libstdc++-v3/testsuite/testsuite_hooks.cc

index 1209342..728cf5e 100644 (file)
@@ -1,3 +1,93 @@
+2003-03-18  Paolo Carlini  <pcarlini@unitus.it>
+
+       Reshuffle 21_strings testsuite.
+       * testsuite/21_strings/append.cc, c_strings.cc, invariants.cc,
+       assign.cc, ctor_copy_dtor.cc, nonmember.cc, capacity.cc,
+       element_access.cc, operations.cc, char_traits_requirements.cc,
+       find.cc, replace.cc, char_traits_typedefs.cc, insert.cc, rfind.cc,
+       compare.cc, inserters_extractors.cc, substr.cc: Split up, add
+       wchar_t tests as follows.       
+       * 21_strings/basic_string/append/char/1.cc: New.
+       * 21_strings/basic_string/append/wchar_t/1.cc: New.
+       * 21_strings/basic_string/assign/char/1.cc: New.
+       * 21_strings/basic_string/assign/char/2.cc: New.
+       * 21_strings/basic_string/assign/char/3.cc: New.
+       * 21_strings/basic_string/assign/wchar_t/1.cc: New.
+       * 21_strings/basic_string/assign/wchar_t/2.cc: New.
+       * 21_strings/basic_string/assign/wchar_t/3.cc: New.
+       * 21_strings/basic_string/capacity/1.cc: New.
+       * 21_strings/basic_string/capacity/char/1.cc: New.
+       * 21_strings/basic_string/capacity/char/2.cc: New.
+       * 21_strings/basic_string/capacity/wchar_t/1.cc: New.
+       * 21_strings/basic_string/capacity/wchar_t/2.cc: New.
+       * 21_strings/basic_string/compare/char/1.cc: New.
+       * 21_strings/basic_string/compare/wchar_t/1.cc: New.
+       * 21_strings/basic_string/cons/char/1.cc: New.
+       * 21_strings/basic_string/cons/char/2.cc: New.
+       * 21_strings/basic_string/cons/char/3.cc: New.
+       * 21_strings/basic_string/cons/char/4.cc: New.
+       * 21_strings/basic_string/cons/char/5.cc: New.
+       * 21_strings/basic_string/cons/wchar_t/1.cc: New.
+       * 21_strings/basic_string/cons/wchar_t/2.cc: New.
+       * 21_strings/basic_string/cons/wchar_t/3.cc: New.
+       * 21_strings/basic_string/cons/wchar_t/4.cc: New.
+       * 21_strings/basic_string/cons/wchar_t/5.cc: New.
+       * 21_strings/basic_string/element_access/char/1.cc: New.
+       * 21_strings/basic_string/element_access/char/2.cc: New.
+       * 21_strings/basic_string/element_access/char/3.cc: New.
+       * 21_strings/basic_string/element_access/wchar_t/1.cc: New.
+       * 21_strings/basic_string/element_access/wchar_t/2.cc: New.
+       * 21_strings/basic_string/element_access/wchar_t/3.cc: New.
+       * 21_strings/basic_string/find/char/1.cc: New.
+       * 21_strings/basic_string/find/wchar_t/1.cc: New.
+       * 21_strings/basic_string/insert/char/1.cc: New.
+       * 21_strings/basic_string/insert/char/2.cc: New.
+       * 21_strings/basic_string/insert/wchar_t/1.cc: New.
+       * 21_strings/basic_string/insert/wchar_t/2.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/1.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/4.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/5.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/6.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/7.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/8.cc: New.
+       * 21_strings/basic_string/inserters_extractors/char/9.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/1.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/4.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/5.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/6.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/7.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/8.cc: New.
+       * 21_strings/basic_string/inserters_extractors/wchar_t/9.cc: New.
+       * 21_strings/basic_string/operators/char/1.cc: New.
+       * 21_strings/basic_string/operators/char/2.cc: New.
+       * 21_strings/basic_string/operators/wchar_t/1.cc: New.
+       * 21_strings/basic_string/operators/wchar_t/2.cc: New.
+       * 21_strings/basic_string/replace/char/1.cc: New.
+       * 21_strings/basic_string/replace/char/2.cc: New.
+       * 21_strings/basic_string/replace/char/3.cc: New.
+       * 21_strings/basic_string/replace/char/4.cc: New.
+       * 21_strings/basic_string/replace/char/5.cc: New.
+       * 21_strings/basic_string/replace/wchar_t/1.cc: New.
+       * 21_strings/basic_string/replace/wchar_t/2.cc: New.
+       * 21_strings/basic_string/replace/wchar_t/3.cc: New.
+       * 21_strings/basic_string/replace/wchar_t/4.cc: New.
+       * 21_strings/basic_string/replace/wchar_t/5.cc: New.
+       * 21_strings/basic_string/rfind/char/1.cc: New.
+       * 21_strings/basic_string/rfind/char/2.cc: New.
+       * 21_strings/basic_string/rfind/char/3.cc: New.
+       * 21_strings/basic_string/rfind/wchar_t/1.cc: New.
+       * 21_strings/basic_string/rfind/wchar_t/2.cc: New.
+       * 21_strings/basic_string/rfind/wchar_t/3.cc: New.
+       * 21_strings/basic_string/substr/char/1.cc: New.
+       * 21_strings/basic_string/substr/wchar_t/1.cc: New.
+       * 21_strings/c_strings/char/1.cc: New.
+       * 21_strings/c_strings/char/2.cc: New.
+       * 21_strings/c_strings/wchar_t/1.cc: New.
+       * 21_strings/c_strings/wchar_t/2.cc: New.
+       * 21_strings/char_traits/requirements/char/1.cc: New.
+       * 21_strings/char_traits/requirements/wchar_t/1.cc: New.
+       * 21_strings/char_traits/typedefs/char/1.cc: New.
+       
 2003-03-17  Paolo Carlini  <pcarlini@unitus.it>
             Petur Runolfsson  <peturr02@ru.is>
 
        global_templates.cc time_get_members_wchar_t.cc, members.cc,
        time_put.cc, messages_byname.cc, time_put_members_char.cc,
        messages.cc, time_put_members_wchar_t.cc, messages_members_char.cc): 
-       Splint up into individual test cases... 
+       Split up into individual test cases...  
        * 22_locale/codecvt/1.cc: New.
        * 22_locale/codecvt/2.cc: New.
        * 22_locale/codecvt/always_noconv/char/1.cc: New.
@@ -1,6 +1,6 @@
 // 1999-07-08 bkoz
 
-// Copyright (C) 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/append/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/append/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..ea8cd17
--- /dev/null
@@ -0,0 +1,164 @@
+// 1999-07-08 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.3 basic_string::assign
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const wchar_t str_lit01[] = L"point bolivar, texas";
+  const std::wstring str01(str_lit01);
+  const std::wstring str02(L"corpus, ");
+  const std::wstring str03;
+  std::wstring str05;
+
+
+  // wstring& append(const wstring&)
+  str05 = str02;
+  str05.append(str05); 
+  VERIFY( str05 == L"corpus, corpus, " );
+  str05.append(str01);
+  VERIFY( str05 == L"corpus, corpus, point bolivar, texas" );
+  str05.append(str03);
+  VERIFY( str05 == L"corpus, corpus, point bolivar, texas" );
+  std::wstring str06;
+  str06.append(str05);
+  VERIFY( str06 == str05 );
+
+
+  // wstring& append(const wstring&, size_type pos, size_type n)
+  str05.erase();
+  str06.erase();
+  csz01 = str03.size();
+  try {
+    str06.append(str03, csz01 + 1, 0);
+    VERIFY( false ); 
+  }
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  csz01 = str01.size();
+  try {
+    str06.append(str01, csz01 + 1, 0);
+    VERIFY( false ); 
+  }
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  str05 = str02;
+  str05.append(str01, 0, std::wstring::npos);
+  VERIFY( str05 == L"corpus, point bolivar, texas" );
+  VERIFY( str05 != str02 );
+
+  str06 = str02;
+  str06.append(str01, 15, std::wstring::npos);
+  VERIFY( str06 == L"corpus, texas" );
+  VERIFY( str02 != str06 );
+
+
+  // wstring& append(const wchar_t* s)
+  str05.erase();
+  str06.erase();
+  str05.append(L"");
+  VERIFY( str05 == str03 );
+
+  str05.append(str_lit01);
+  VERIFY( str05 == str01 );
+
+  str06 = str02;
+  str06.append(L"corpus, ");
+  VERIFY( str06 == L"corpus, corpus, " );
+
+
+  // wstring& append(const wchar_t* s, size_type n)
+  str05.erase();
+  str06.erase();
+  str05.append(L"", 0);
+  VERIFY( str05.size() == 0 );
+  VERIFY( str05 == str03 );
+  
+  str05.append(str_lit01, sizeof(str_lit01) - 1);
+  VERIFY( str05 == str01 );
+
+  str06 = str02;
+  str06.append(L"corpus, ", 6);
+  VERIFY( str06 == L"corpus, corpus" );
+
+  str06 = str02;
+  str06.append(L"corpus, ", 12);
+  VERIFY( str06 != L"corpus, corpus, " );
+
+
+  // wstring& append(size_type n, char c)
+  str05.erase();
+  str06.erase();
+  str05.append(0, L'a');
+  VERIFY( str05 == str03 );
+  str06.append(8, L'.');
+  VERIFY( str06 == L"........" );
+
+
+  // template<typename InputIter>
+  //  wstring& append(InputIter first, InputIter last)
+  str05.erase();
+  str06.erase();
+  str05.append(str03.begin(), str03.end());
+  VERIFY( str05 == str03 );
+
+  str06 = str02;
+  str06.append(str01.begin(), str01.begin() + str01.find(L'r')); 
+  VERIFY( str06 == L"corpus, point boliva" );
+  VERIFY( str06 != str01 );
+  VERIFY( str06 != str02 );
+
+  str05 = str01;
+  str05.append(str05.begin(), str05.begin() + str05.find(L'r')); 
+  VERIFY( str05 ==  L"point bolivar, texaspoint boliva" );
+  VERIFY( str05 != str01 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/1.cc
new file mode 100644 (file)
index 0000000..735c61c
--- /dev/null
@@ -0,0 +1,53 @@
+// 2001-10-30 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5 string modifiers
+
+#include <string>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+  bool test = true;
+
+  using namespace std;
+
+  const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii";
+  string aux = strlit;
+  string::size_type i = aux.rfind("/");
+  if (i != string::npos)
+    aux.assign(aux, i + 1, string::npos);
+  VERIFY(aux == "Hawaii");
+
+  aux = strlit;
+  i = aux.rfind("r/");
+  if (i != string::npos)
+    aux.assign(aux, i + 1, string::npos);
+  VERIFY(aux.c_str()[9] == 'B');
+  VERIFY(aux == "/Hanalei Bay/Kauai/Hawaii");
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/char/2.cc
new file mode 100644 (file)
index 0000000..9783c45
--- /dev/null
@@ -0,0 +1,59 @@
+// 2001-10-30 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5 string modifiers
+
+#include <string>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+// assign(const basic_string& __str, size_type __pos, size_type __n)
+void
+test02()
+{
+  bool test = true;
+
+  using namespace std;
+  
+  string one = "Selling England by the pound";
+  string two = one;
+  string three = "Brilliant trees";
+
+  one.assign(one, 8, 100);
+  VERIFY( one == "England by the pound" );
+
+  one.assign(one, 8, 0);
+  VERIFY( one == "" );
+  one.assign(two, 8, 7);
+  VERIFY( one == "England" );
+
+  one.assign(three, 10, 100);
+  VERIFY( one == "trees" );
+
+  three.assign(one, 0, 3);
+  VERIFY( three == "tre" );
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 2001-10-30 Benjamin Kosnik  <bkoz@redhat.com>
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 #include <cstdio>
 #include <testsuite_hooks.h>
 
-void
-test01()
-{
-  bool test = true;
-
-  using namespace std;
-
-  const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii";
-  string aux = strlit;
-  string::size_type i = aux.rfind("/");
-  if (i != string::npos)
-    aux.assign(aux, i + 1, string::npos);
-  VERIFY(aux == "Hawaii");
-
-  aux = strlit;
-  i = aux.rfind("r/");
-  if (i != string::npos)
-    aux.assign(aux, i + 1, string::npos);
-  VERIFY(aux.c_str()[9] == 'B');
-  VERIFY(aux == "/Hanalei Bay/Kauai/Hawaii");
-}
-
-// assign(const basic_string& __str, size_type __pos, size_type __n)
-void
-test02()
-{
-  bool test = true;
-
-  using namespace std;
-  
-  string one = "Selling England by the pound";
-  string two = one;
-  string three = "Brilliant trees";
-
-  one.assign(one, 8, 100);
-  VERIFY( one == "England by the pound" );
-
-  one.assign(one, 8, 0);
-  VERIFY( one == "" );
-  one.assign(two, 8, 7);
-  VERIFY( one == "England" );
-
-  one.assign(three, 10, 100);
-  VERIFY( one == "trees" );
-
-  three.assign(one, 0, 3);
-  VERIFY( three == "tre" );
-}
-
 // assign(const _CharT* __s, size_type __n)
 // assign(const _CharT* __s)
 void
@@ -104,13 +54,8 @@ test03()
   VERIFY( one == "by the" );
 }
 
-
-
 int main()
 { 
-  test01();
-  test02();
   test03();
-
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..5f11059
--- /dev/null
@@ -0,0 +1,53 @@
+// 2001-10-30 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5 string modifiers
+
+#include <string>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+  bool test = true;
+
+  using namespace std;
+
+  const wchar_t* strlit = L"../the long pier/Hanalei Bay/Kauai/Hawaii";
+  wstring aux = strlit;
+  wstring::size_type i = aux.rfind(L"/");
+  if (i != wstring::npos)
+    aux.assign(aux, i + 1, wstring::npos);
+  VERIFY(aux == L"Hawaii");
+
+  aux = strlit;
+  i = aux.rfind(L"r/");
+  if (i != wstring::npos)
+    aux.assign(aux, i + 1, wstring::npos);
+  VERIFY(aux.c_str()[9] == L'B');
+  VERIFY(aux == L"/Hanalei Bay/Kauai/Hawaii");
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..458204c
--- /dev/null
@@ -0,0 +1,59 @@
+// 2001-10-30 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5 string modifiers
+
+#include <string>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+// assign(const basic_string& __str, size_type __pos, size_type __n)
+void
+test02()
+{
+  bool test = true;
+
+  using namespace std;
+  
+  wstring one = L"Selling England by the pound";
+  wstring two = one;
+  wstring three = L"Brilliant trees";
+
+  one.assign(one, 8, 100);
+  VERIFY( one == L"England by the pound" );
+
+  one.assign(one, 8, 0);
+  VERIFY( one == L"" );
+  one.assign(two, 8, 7);
+  VERIFY( one == L"England" );
+
+  one.assign(three, 10, 100);
+  VERIFY( one == L"trees" );
+
+  three.assign(one, 0, 3);
+  VERIFY( three == L"tre" );
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/assign/wchar_t/3.cc
new file mode 100644 (file)
index 0000000..fc9b5a2
--- /dev/null
@@ -0,0 +1,61 @@
+// 2001-10-30 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5 string modifiers
+
+#include <string>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+// assign(const _CharT* __s, size_type __n)
+// assign(const _CharT* __s)
+void
+test03()
+{
+  bool test = true;
+
+  using namespace std;
+  wstring one; 
+  wstring two;
+  wstring three = two;
+  const wchar_t* source = L"Selling England by the pound";
+
+  one.assign(source);
+  VERIFY( one == L"Selling England by the pound" );
+
+  one.assign(source, 28);
+  VERIFY( one == L"Selling England by the pound" );
+
+  two.assign(source, 7);
+  VERIFY( two == L"Selling" );
+  
+  one.assign(one.c_str() + 8, 20);
+  VERIFY( one == L"England by the pound" );
+
+  one.assign(one.c_str() + 8, 6);
+  VERIFY( one == L"by the" );
+}
+
+int main()
+{ 
+  test03();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-05-11 bkoz
 
-// Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -125,37 +125,9 @@ namespace std
 
 void test01()
 {
-  // 1 POD types : resize, capacity, reserve
   bool test = true;
-  std::string str01;
-  typedef std::string::size_type size_type_s;
-
-  size_type_s sz01 = str01.capacity();
-  str01.reserve(100);
-  size_type_s sz02 = str01.capacity();
-  VERIFY( sz02 >= sz01 );
-  VERIFY( sz02 >= 100 );
-  str01.reserve();
-  sz01 = str01.capacity();
-  VERIFY( sz01 >= 0 );
-
-  sz01 = str01.size() + 5;
-  str01.resize(sz01);
-  sz02 = str01.size();
-  VERIFY( sz01 == sz02 );
-
-  sz01 = str01.size() - 5;
-  str01.resize(sz01);
-  sz02 = str01.size();
-  VERIFY( sz01 == sz02 );
-
-  std::string str05(30, 'q');
-  std::string str06 = str05;
-  str05 = str06 + str05;
-  VERIFY( str05.capacity() >= str05.size() );
-  VERIFY( str06.capacity() >= str06.size() );
-
-  // 2 non POD types : resize, capacity, reserve
+
+  // non POD types : resize, capacity, reserve
   std::basic_string< A<B> > str02;
   typedef std::basic_string< A<B> >::size_type size_type_o;
   size_type_o sz03;
@@ -187,48 +159,8 @@ void test01()
   VERIFY( str07.capacity() >= str07.size() );
   VERIFY( str08.capacity() >= str08.size() );
 
-  // 3 POD types: size, length, max_size, clear(), empty()
-  bool b01;
-  std::string str011;
-  b01 = str01.empty();  
-  VERIFY( b01 == true );
-  sz01 = str01.size();
-  sz02 = str01.length();
-  VERIFY( sz01 == sz02 );
-  str01.c_str();
-  sz01 = str01.size();
-  sz02 = str01.length();
-  VERIFY( sz01 == sz02 );
-
-  sz01 = str01.length();
-  str01.c_str();
-  str011 = str01 +  "_addendum_";
-  str01.c_str();
-  sz02 = str01.length();    
-  VERIFY( sz01 == sz02 );
-  sz02 = str011.length();
-  VERIFY( sz02 > sz01 );
-    
-  // trickster allocator issues involved with these:
-  std::string str3 = "8-chars_8-chars_";
-  const char* p3 = str3.c_str();
-  std::string str4 = str3 + "7-chars";
-  const char* p4 = str3.c_str();
-  
-  sz01 = str01.size();
-  sz02 = str01.max_size();  
-  VERIFY( sz02 >= sz01 );
-
-  sz01 = str01.size();
-  str01.clear();  
-  b01 = str01.empty(); 
-  VERIFY( b01 == true );
-  sz02 = str01.size();  
-  VERIFY( sz01 >= sz02 );
-
-
-  // 4 non-POD types: size, length, max_size, clear(), empty()
-  b01 = str02.empty();  
+  // non-POD types: size, length, max_size, clear(), empty()
+  bool b01 = str02.empty();  
   VERIFY( b01 == true );
   sz03 = str02.size();
   sz04 = str02.length();
@@ -249,19 +181,6 @@ void test01()
   VERIFY( sz03 >= sz04 );
 }
 
-// libstdc++/4548
-// http://gcc.gnu.org/ml/libstdc++/2001-11/msg00150.html
-void test02()
-{
-  bool test = true;
-
-  std::string str01 = "twelve chars";
-  // str01 becomes shared
-  std::string str02 = str01;
-  str01.reserve(1);
-  VERIFY( str01.capacity() == 12 );
-}
-
 #if !__GXX_WEAK__
 // Explicitly instantiate for systems with no COMDAT or weak support.
 template 
@@ -276,7 +195,5 @@ template
 int main()
 {
   test01();
-  test02();
-
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc
new file mode 100644 (file)
index 0000000..6072898
--- /dev/null
@@ -0,0 +1,102 @@
+// 1999-05-11 bkoz
+
+// Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.3 string capacity
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  // POD types : resize, capacity, reserve
+  bool test = true;
+  std::string str01;
+  typedef std::string::size_type size_type_s;
+
+  size_type_s sz01 = str01.capacity();
+  str01.reserve(100);
+  size_type_s sz02 = str01.capacity();
+  VERIFY( sz02 >= sz01 );
+  VERIFY( sz02 >= 100 );
+  str01.reserve();
+  sz01 = str01.capacity();
+  VERIFY( sz01 >= 0 );
+
+  sz01 = str01.size() + 5;
+  str01.resize(sz01);
+  sz02 = str01.size();
+  VERIFY( sz01 == sz02 );
+
+  sz01 = str01.size() - 5;
+  str01.resize(sz01);
+  sz02 = str01.size();
+  VERIFY( sz01 == sz02 );
+
+  std::string str05(30, 'q');
+  std::string str06 = str05;
+  str05 = str06 + str05;
+  VERIFY( str05.capacity() >= str05.size() );
+  VERIFY( str06.capacity() >= str06.size() );
+
+  // POD types: size, length, max_size, clear(), empty()
+  bool b01;
+  std::string str011;
+  b01 = str01.empty();  
+  VERIFY( b01 == true );
+  sz01 = str01.size();
+  sz02 = str01.length();
+  VERIFY( sz01 == sz02 );
+  str01.c_str();
+  sz01 = str01.size();
+  sz02 = str01.length();
+  VERIFY( sz01 == sz02 );
+
+  sz01 = str01.length();
+  str01.c_str();
+  str011 = str01 +  "_addendum_";
+  str01.c_str();
+  sz02 = str01.length();    
+  VERIFY( sz01 == sz02 );
+  sz02 = str011.length();
+  VERIFY( sz02 > sz01 );
+    
+  // trickster allocator issues involved with these:
+  std::string str3 = "8-chars_8-chars_";
+  const char* p3 = str3.c_str();
+  std::string str4 = str3 + "7-chars";
+  const char* p4 = str3.c_str();
+  
+  sz01 = str01.size();
+  sz02 = str01.max_size();  
+  VERIFY( sz02 >= sz01 );
+
+  sz01 = str01.size();
+  str01.clear();  
+  b01 = str01.empty(); 
+  VERIFY( b01 == true );
+  sz02 = str01.size();  
+  VERIFY( sz01 >= sz02 );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/2.cc
new file mode 100644 (file)
index 0000000..731a918
--- /dev/null
@@ -0,0 +1,43 @@
+// 1999-05-11 bkoz
+
+// Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.3 string capacity
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/4548
+// http://gcc.gnu.org/ml/libstdc++/2001-11/msg00150.html
+void test02()
+{
+  bool test = true;
+
+  std::string str01 = "twelve chars";
+  // str01 becomes shared
+  std::string str02 = str01;
+  str01.reserve(1);
+  VERIFY( str01.capacity() == 12 );
+}
+
+int main()
+{
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..18af608
--- /dev/null
@@ -0,0 +1,102 @@
+// 1999-05-11 bkoz
+
+// Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.3 string capacity
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+  // POD types : resize, capacity, reserve
+  bool test = true;
+  std::wstring str01;
+  typedef std::wstring::size_type size_type_s;
+
+  size_type_s sz01 = str01.capacity();
+  str01.reserve(100);
+  size_type_s sz02 = str01.capacity();
+  VERIFY( sz02 >= sz01 );
+  VERIFY( sz02 >= 100 );
+  str01.reserve();
+  sz01 = str01.capacity();
+  VERIFY( sz01 >= 0 );
+
+  sz01 = str01.size() + 5;
+  str01.resize(sz01);
+  sz02 = str01.size();
+  VERIFY( sz01 == sz02 );
+
+  sz01 = str01.size() - 5;
+  str01.resize(sz01);
+  sz02 = str01.size();
+  VERIFY( sz01 == sz02 );
+
+  std::wstring str05(30, L'q');
+  std::wstring str06 = str05;
+  str05 = str06 + str05;
+  VERIFY( str05.capacity() >= str05.size() );
+  VERIFY( str06.capacity() >= str06.size() );
+
+  // POD types: size, length, max_size, clear(), empty()
+  bool b01;
+  std::wstring str011;
+  b01 = str01.empty();  
+  VERIFY( b01 == true );
+  sz01 = str01.size();
+  sz02 = str01.length();
+  VERIFY( sz01 == sz02 );
+  str01.c_str();
+  sz01 = str01.size();
+  sz02 = str01.length();
+  VERIFY( sz01 == sz02 );
+
+  sz01 = str01.length();
+  str01.c_str();
+  str011 = str01 +  L"_addendum_";
+  str01.c_str();
+  sz02 = str01.length();    
+  VERIFY( sz01 == sz02 );
+  sz02 = str011.length();
+  VERIFY( sz02 > sz01 );
+    
+  // trickster allocator issues involved with these:
+  std::wstring str3 = L"8-chars_8-chars_";
+  const wchar_t* p3 = str3.c_str();
+  std::wstring str4 = str3 + L"7-chars";
+  const wchar_t* p4 = str3.c_str();
+  
+  sz01 = str01.size();
+  sz02 = str01.max_size();  
+  VERIFY( sz02 >= sz01 );
+
+  sz01 = str01.size();
+  str01.clear();  
+  b01 = str01.empty(); 
+  VERIFY( b01 == true );
+  sz02 = str01.size();  
+  VERIFY( sz01 >= sz02 );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..08aa229
--- /dev/null
@@ -0,0 +1,43 @@
+// 1999-05-11 bkoz
+
+// Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.3 string capacity
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/4548
+// http://gcc.gnu.org/ml/libstdc++/2001-11/msg00150.html
+void test02()
+{
+  bool test = true;
+
+  std::wstring str01 = L"twelve chars";
+  // str01 becomes shared
+  std::wstring str02 = str01;
+  str01.reserve(1);
+  VERIFY( str01.capacity() == 12 );
+}
+
+int main()
+{
+  test02();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 980930 bkoz work with libstdc++v3
 
-// Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+// Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -132,6 +132,5 @@ int
 main() 
 {
   test01();
-  
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/compare/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..25f8abd
--- /dev/null
@@ -0,0 +1,136 @@
+// 980930 bkoz work with libstdc++v3
+
+// Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.8 basic_string::compare
+// int compare(const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str,
+//             size_type pos2, size_type n2) const;
+// int compare(const charT* s) const;
+// int compare(size_type pos1, size_type n1,
+//             const charT* s, size_type n2 = npos) const;
+
+// NB compare should be thought of as a lexographical compare, ie how
+// things would be sorted in a dictionary.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+enum want_value {lt=0, z=1, gt=2};
+
+int
+test_value(int result, want_value expected);
+
+int
+test_value(int result, want_value expected)
+{
+  bool pass = false;
+
+  switch (expected) {
+  case lt:
+    if (result < 0)
+      pass = true;
+    break;
+  case z:
+    if (!result)
+      pass = true;
+    break;
+  case gt:
+    if (result > 0)
+      pass = true;
+    break;
+  default:
+    pass = false; //should not get here
+  }
+
+#ifdef DEBUG_ASSERT
+  assert(pass);
+#endif
+  
+  return 0;
+}
+
+int 
+test01()
+{
+  using namespace std;
+
+  wstring      str_0(L"costa rica");
+  wstring      str_1(L"costa marbella");
+  wstring      str_2;
+
+  //sanity check
+  test_value(wcscmp(L"costa marbella", L"costa rica"), lt); 
+  test_value(wcscmp(L"costa rica", L"costa rica"), z);
+  test_value(wcscmp(str_1.data(), str_0.data()), lt);
+  test_value(wcscmp(str_0.data(), str_1.data()), gt);
+  test_value(wcsncmp(str_1.data(), str_0.data(), 6), z);
+  test_value(wcsncmp(str_1.data(), str_0.data(), 14), lt);
+  test_value(wmemcmp(str_1.data(), str_0.data(), 6), z);
+  test_value(wmemcmp(str_1.data(), str_0.data(), 14), lt);
+  test_value(wmemcmp(L"costa marbella", L"costa rica", 14), lt);
+
+  // int compare(const basic_string& str) const;
+  test_value(str_0.compare(str_1), gt); //because r>m
+  test_value(str_1.compare(str_0), lt); //because m<r
+  str_2 = str_0;
+  test_value(str_2.compare(str_0), z);
+  str_2 = L"cost";
+  test_value(str_2.compare(str_0), lt);
+  str_2 = L"costa ricans";
+  test_value(str_2.compare(str_0), gt);
+
+  // int compare(size_type pos1, size_type n1, const basic_string& str) const;
+  test_value(str_1.compare(0, 6, str_0), lt);
+  str_2 = L"cost";
+  test_value(str_1.compare(0, 4, str_2), z);
+  test_value(str_1.compare(0, 5, str_2), gt);
+
+  // int compare(size_type pos1, size_type n1, const basic_string& str, 
+  //            size_type pos2, size_type n2) const;   
+  test_value(str_1.compare(0, 6, str_0, 0, 6), z);
+  test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
+  test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
+
+  // int compare(const charT* s) const;
+  test_value(str_0.compare(L"costa marbella"), gt);
+  test_value(str_1.compare(L"costa rica"), lt);
+  str_2 = str_0;
+  test_value(str_2.compare(L"costa rica"), z);
+  test_value(str_2.compare(L"cost"), gt);                      
+  test_value(str_2.compare(L"costa ricans"), lt);         
+
+  // int compare(size_type pos, size_type n1, const charT* str,
+  //             size_type n2 = npos) const;
+  test_value(str_1.compare(0, 6, L"costa rica", 0, 6), z); 
+  test_value(str_1.compare(0, 7, L"costa rica", 0, 7), lt); 
+  test_value(str_0.compare(0, 7, L"costa marbella", 0, 7), gt); 
+
+  return 0;
+}
+
+
+int 
+main() 
+{
+  test01();
+  return 0;
+}
@@ -22,7 +22,6 @@
 
 #include <new>
 #include <string>
-#include <vector>
 #include <stdexcept>
 #include <testsuite_hooks.h>
 
@@ -154,87 +153,9 @@ void test01(void)
   VERIFY( str06 == str01 );
 }
 
-void test02()
-{
-  bool test = true;
-
-  // template<typename _InputIter>
-  //   basic_string(_InputIter begin, _InputIter end, const allocator& a)
-  // where _InputIter is integral [21.3.1 para 15]
-  std::string s(10,0);
-  VERIFY( s.size() == 10 );
-}
-
-void test03()
-{
-  bool test = true;
-  const char* with_nulls = "This contains \0 a zero byte.";
-
-  // These are tests to see how basic_string handles data with NUL
-  // bytes.  Obviously basic_string(char*) will halt at the first one, but
-  // nothing else should.
-  std::string s1 (with_nulls, 28);
-  VERIFY( s1.size() == 28 );
-  std::string s2 (s1);
-  VERIFY( s2.size() == 28 );
-
-  // Not defined, but libstdc++ throws an exception.
-  const char* bogus = 0;
-  try 
-    {
-      std::string str1(bogus);
-      VERIFY( false );
-    }           
-  catch(std::exception& fail) 
-    {
-      VERIFY( true );
-    }
-
-  // Not defined, but libstdc++ throws an exception.
-  try 
-    {
-      std::string str2(bogus, 5);
-      VERIFY( false );
-    }           
-  catch(std::exception& fail) 
-    {
-      VERIFY( true );
-    }
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2002-06/msg00025.html
-void test04()
-{
-  bool test = true;
-
-  std::string str01("portofino");
-
-  std::string::reverse_iterator i1 = str01.rbegin();
-  std::string::reverse_iterator i2 = str01.rend();
-  std::string str02(i1, i2);
-  VERIFY( str02 == "onifotrop" );
-}
-
-// libstdc++/8347
-void test05()
-{
-  bool test = true;
-
-  std::vector<char> empty;
-  std::string empty2(empty.begin(), empty.end());
-
-  // libstdc++/8716 (same underlying situation, same fix)
-  char const * s = NULL;
-  std::string zero_length_built_with_NULL(s,0);
-}
-
 int main()
 { 
   __gnu_cxx_test::set_memory_limits();
   test01();
-  test02();
-  test03();
-  test04();
-  test05();
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/2.cc
new file mode 100644 (file)
index 0000000..d6458a9
--- /dev/null
@@ -0,0 +1,41 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+  bool test = true;
+
+  // template<typename _InputIter>
+  //   basic_string(_InputIter begin, _InputIter end, const allocator& a)
+  // where _InputIter is integral [21.3.1 para 15]
+  std::string s(10,0);
+  VERIFY( s.size() == 10 );
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/3.cc
new file mode 100644 (file)
index 0000000..6f40dda
--- /dev/null
@@ -0,0 +1,69 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <new>
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+  bool test = true;
+  const char* with_nulls = "This contains \0 a zero byte.";
+
+  // These are tests to see how basic_string handles data with NUL
+  // bytes.  Obviously basic_string(char*) will halt at the first one, but
+  // nothing else should.
+  std::string s1 (with_nulls, 28);
+  VERIFY( s1.size() == 28 );
+  std::string s2 (s1);
+  VERIFY( s2.size() == 28 );
+
+  // Not defined, but libstdc++ throws an exception.
+  const char* bogus = 0;
+  try 
+    {
+      std::string str1(bogus);
+      VERIFY( false );
+    }           
+  catch(std::exception& fail) 
+    {
+      VERIFY( true );
+    }
+
+  // Not defined, but libstdc++ throws an exception.
+  try 
+    {
+      std::string str2(bogus, 5);
+      VERIFY( false );
+    }           
+  catch(std::exception& fail) 
+    {
+      VERIFY( true );
+    }
+}
+
+int main()
+{ 
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/4.cc
new file mode 100644 (file)
index 0000000..fe2f321
--- /dev/null
@@ -0,0 +1,43 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/libstdc++/2002-06/msg00025.html
+void test04()
+{
+  bool test = true;
+
+  std::string str01("portofino");
+
+  std::string::reverse_iterator i1 = str01.rbegin();
+  std::string::reverse_iterator i2 = str01.rend();
+  std::string str02(i1, i2);
+  VERIFY( str02 == "onifotrop" );
+}
+
+int main()
+{ 
+  test04();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/5.cc
new file mode 100644 (file)
index 0000000..4b2f401
--- /dev/null
@@ -0,0 +1,44 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <string>
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/8347
+void test05()
+{
+  bool test = true;
+
+  std::vector<char> empty;
+  std::string empty2(empty.begin(), empty.end());
+
+  // libstdc++/8716 (same underlying situation, same fix)
+  char const * s = NULL;
+  std::string zero_length_built_with_NULL(s,0);
+}
+
+int main()
+{ 
+  test05();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..eeb3516
--- /dev/null
@@ -0,0 +1,161 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <new>
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::iterator citerator;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const wchar_t str_lit01[] = L"rodeo beach, marin";
+  const std::wstring str01(str_lit01);
+  const std::wstring str02(L"baker beach, san francisco");
+
+  // basic_string(const wstring&, size_type pos = 0, siz_type n = npos, alloc)
+  csz01 = str01.size();
+  try {
+    std::wstring str03(str01, csz01 + 1);
+    VERIFY( false );
+  }             
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  try {
+    std::wstring str03(str01, csz01);
+    VERIFY( str03.size() == 0 );
+    VERIFY( str03.size() <= str03.capacity() );
+  }             
+  catch(...) {
+    VERIFY( false );
+  }
+
+  // basic_string(const wchar_t* s, size_type n, alloc)
+  csz01 = str01.max_size();
+  // NB: As strlen(str_lit01) != csz01, this test is undefined. It
+  // should not crash, but what gets constructed is a bit arbitrary.
+  try {
+    std::wstring str03(str_lit01, csz01 + 1);
+    VERIFY( true );
+  }             
+  catch(std::length_error& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  // NB: As strlen(str_lit01) != csz01, this test is undefined. It
+  // should not crash, but what gets constructed is a bit arbitrary.
+  // The "maverick's" of all string objects.
+  try {
+    std::wstring str04(str_lit01, npos); 
+    VERIFY( true );
+  }             
+  catch(std::length_error& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  // Build a maxsize - 1 lengthed string consisting of all A's
+  try {
+    std::wstring str03(csz01 - 1, 'A');
+    VERIFY( str03.size() == csz01 - 1 );
+    VERIFY( str03.size() <= str03.capacity() );
+  }             
+  // NB: bad_alloc is regrettable but entirely kosher for
+  // out-of-memory situations.
+  catch(std::bad_alloc& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  // basic_string(const wchar_t* s, const allocator& a = allocator())
+  std::wstring str04(str_lit01);
+  VERIFY( str01 == str04 );
+
+
+  // basic_string(size_type n, char c, const allocator& a = allocator())
+  csz01 = str01.max_size();
+  try {
+    std::wstring str03(csz01 + 1, L'z');
+    VERIFY( false );
+  }             
+  catch(std::length_error& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  try {
+    std::wstring str04(npos, L'b'); // the "maverick's" of all string objects.
+    VERIFY( false );
+  }             
+  catch(std::length_error& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  try {
+    std::wstring str03(csz01 - 1, L'z');
+    VERIFY( str03.size() != 0 );
+    VERIFY( str03.size() <= str03.capacity() );
+  }             
+  // NB: bad_alloc is regrettable but entirely kosher for
+  // out-of-memory situations.
+  catch(std::bad_alloc& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+
+  // template<typename _InputIter>
+  //   basic_string(_InputIter begin, _InputIter end, const allocator& a)
+  std::wstring str06(str01.begin(), str01.end());
+  VERIFY( str06 == str01 );
+}
+
+int main()
+{ 
+  __gnu_cxx_test::set_memory_limits();
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..9eaf4ce
--- /dev/null
@@ -0,0 +1,41 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+  bool test = true;
+
+  // template<typename _InputIter>
+  //   basic_string(_InputIter begin, _InputIter end, const allocator& a)
+  // where _InputIter is integral [21.3.1 para 15]
+  std::wstring s(10, 0);
+  VERIFY( s.size() == 10 );
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/3.cc
new file mode 100644 (file)
index 0000000..46b7287
--- /dev/null
@@ -0,0 +1,69 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <new>
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+  bool test = true;
+  const wchar_t* with_nulls = L"This contains \0 a zero byte.";
+
+  // These are tests to see how basic_string handles data with NUL
+  // bytes.  Obviously basic_string(char*) will halt at the first one, but
+  // nothing else should.
+  std::wstring s1 (with_nulls, 28);
+  VERIFY( s1.size() == 28 );
+  std::wstring s2 (s1);
+  VERIFY( s2.size() == 28 );
+
+  // Not defined, but libstdc++ throws an exception.
+  const wchar_t* bogus = 0;
+  try 
+    {
+      std::wstring str1(bogus);
+      VERIFY( false );
+    }           
+  catch(std::exception& fail) 
+    {
+      VERIFY( true );
+    }
+
+  // Not defined, but libstdc++ throws an exception.
+  try 
+    {
+      std::wstring str2(bogus, 5);
+      VERIFY( false );
+    }           
+  catch(std::exception& fail) 
+    {
+      VERIFY( true );
+    }
+}
+
+int main()
+{ 
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/4.cc
new file mode 100644 (file)
index 0000000..87dab12
--- /dev/null
@@ -0,0 +1,43 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/libstdc++/2002-06/msg00025.html
+void test04()
+{
+  bool test = true;
+
+  std::wstring str01(L"portofino");
+
+  std::wstring::reverse_iterator i1 = str01.rbegin();
+  std::wstring::reverse_iterator i2 = str01.rend();
+  std::wstring str02(i1, i2);
+  VERIFY( str02 == L"onifotrop" );
+}
+
+int main()
+{ 
+  test04();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/5.cc
new file mode 100644 (file)
index 0000000..d02dc9c
--- /dev/null
@@ -0,0 +1,44 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <string>
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/8347
+void test05()
+{
+  bool test = true;
+
+  std::vector<wchar_t> empty;
+  std::wstring empty2(empty.begin(), empty.end());
+
+  // libstdc++/8716 (same underlying situation, same fix)
+  wchar_t const * s = NULL;
+  std::wstring zero_length_built_with_NULL(s,0);
+}
+
+int main()
+{ 
+  test05();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-06-08 bkoz
 
-// Copyright (C) 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -1,6 +1,6 @@
 // 1999-06-08 bkoz
 
-// Copyright (C) 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -108,68 +108,8 @@ bool test01(void)
   return test;
 }
 
-// Do another sanity check, this time for member functions that return
-// iterators, namely insert and erase.
-bool test02(void)
-{
-  bool test = true;
-  typedef std::string::size_type csize_type;
-  typedef std::string::iterator siterator;
-  typedef std::string::reverse_iterator sriterator;
-  csize_type npos = std::string::npos;
-  csize_type csz01, csz02;
-  siterator it1;
-  sriterator rit1;  
-
-  const std::string str01("its beach, santa cruz");
-
-  std::string str02 = str01;
-  std::string str05 = str02; // optional, so that begin below causes a mutate
-  std::string::iterator p = str02.insert(str02.begin(), ' ');
-  std::string str03 = str02;
-  VERIFY( str03 == str02 );
-  *p = '!';
-  VERIFY( *str03.c_str() == ' ' );
-  str03[0] = '@';
-  VERIFY( str02[0] == '!' );
-  VERIFY( *p == '!' );
-  VERIFY( str02 != str05 );
-  VERIFY( str02 != str03 );
-
-  std::string str10 = str01;
-  std::string::iterator p2 = str10.insert(str10.begin(), 'a');
-  std::string str11 = str10;
-  *p2 = 'e';
-  VERIFY( str11 != str10 );
-
-  std::string str06 = str01;
-  std::string str07 = str06; // optional, so that begin below causes a mutate
-  p = str06.erase(str06.begin());
-  std::string str08 = str06;
-  VERIFY( str08 == str06 );
-  *p = '!';
-  VERIFY( *str08.c_str() == 't' );
-  str08[0] = '@';
-  VERIFY( str06[0] == '!' );
-  VERIFY( *p == '!' );
-  VERIFY( str06 != str07 );
-  VERIFY( str06 != str08 );
-
-  std::string str12 = str01;
-  p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
-  std::string str13 = str12;
-  *p2 = 'e';
-  VERIFY( str12 != str13 );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-  return test;
-}
-
 int main()
 { 
   test01();
-  test02();
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc
new file mode 100644 (file)
index 0000000..426d0e3
--- /dev/null
@@ -0,0 +1,90 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3 template class basic_string
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// Do another sanity check, this time for member functions that return
+// iterators, namely insert and erase.
+bool test02(void)
+{
+  bool test = true;
+  typedef std::string::size_type csize_type;
+  typedef std::string::iterator siterator;
+  typedef std::string::reverse_iterator sriterator;
+  csize_type npos = std::string::npos;
+  csize_type csz01, csz02;
+  siterator it1;
+  sriterator rit1;  
+
+  const std::string str01("its beach, santa cruz");
+
+  std::string str02 = str01;
+  std::string str05 = str02; // optional, so that begin below causes a mutate
+  std::string::iterator p = str02.insert(str02.begin(), ' ');
+  std::string str03 = str02;
+  VERIFY( str03 == str02 );
+  *p = '!';
+  VERIFY( *str03.c_str() == ' ' );
+  str03[0] = '@';
+  VERIFY( str02[0] == '!' );
+  VERIFY( *p == '!' );
+  VERIFY( str02 != str05 );
+  VERIFY( str02 != str03 );
+
+  std::string str10 = str01;
+  std::string::iterator p2 = str10.insert(str10.begin(), 'a');
+  std::string str11 = str10;
+  *p2 = 'e';
+  VERIFY( str11 != str10 );
+
+  std::string str06 = str01;
+  std::string str07 = str06; // optional, so that begin below causes a mutate
+  p = str06.erase(str06.begin());
+  std::string str08 = str06;
+  VERIFY( str08 == str06 );
+  *p = '!';
+  VERIFY( *str08.c_str() == 't' );
+  str08[0] = '@';
+  VERIFY( str06[0] == '!' );
+  VERIFY( *p == '!' );
+  VERIFY( str06 != str07 );
+  VERIFY( str06 != str08 );
+
+  std::string str12 = str01;
+  p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
+  std::string str13 = str12;
+  *p2 = 'e';
+  VERIFY( str12 != str13 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..00394cf
--- /dev/null
@@ -0,0 +1,94 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.4 basic_string element access
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const std::wstring str01(L"tamarindo, costa rica");
+  std::wstring str02(L"41st street beach, capitola, california");
+  std::wstring str03;
+
+  // const_reference operator[] (size_type pos) const;
+  csz01 = str01.size();
+  cref cref1 = str01[csz01 - 1];
+  VERIFY( cref1 == L'a' );
+  cref cref2 = str01[csz01];
+  VERIFY( cref2 == wchar_t() );
+
+  // reference operator[] (size_type pos);
+  csz02 = str02.size();
+  ref ref1 = str02[csz02 - 1];
+  VERIFY( ref1 == L'a' );
+  ref ref2 = str02[1];
+  VERIFY( ref2 == L'1' );
+
+  // const_reference at(size_type pos) const;
+  csz01 = str01.size();
+  cref cref3 = str01.at(csz01 - 1);
+  VERIFY( cref3 == L'a' );
+  try {
+    cref cref4 = str01.at(csz01);
+    VERIFY( false ); // Should not get here, as exception thrown.
+  }
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  // reference at(size_type pos);
+  csz01 = str02.size();
+  ref ref3 = str02.at(csz02 - 1);
+  VERIFY( ref3 == L'a' );
+  try {
+    ref ref4 = str02.at(csz02);
+    VERIFY( false ); // Should not get here, as exception thrown.
+  }
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..37aec1c
--- /dev/null
@@ -0,0 +1,115 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3 template class basic_string
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// Do a quick sanity check on known problems with element access and
+// ref-counted strings. These should all pass, regardless of the
+// underlying string implementation, of course.
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::iterator siterator;
+  typedef std::wstring::reverse_iterator sriterator;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+  siterator it1;
+  sriterator rit1;  
+
+  std::wstring str01(L"montara beach, half moon bay");
+  const std::wstring str02(L"ocean beach, san francisco");
+  std::wstring str03;
+
+  // 21.3 p 5
+
+  // References, pointers, and iterators referring to the elements of
+  // a basic_string may be invalidated by the following uses of that
+  // basic_string object:
+
+  // ...
+
+  // Susequent to any of the above uses except the forms of insert()
+  // and erase() which return iterators, the first call to non-const
+  // member functions operator[](), at(), begin(), rbegin(), end(), or
+  // rend()
+
+  str03 = str01;
+  it1 = str01.begin();
+  *it1 = L'x';
+  VERIFY( str01[0] == L'x' );
+  VERIFY( str03[0] == L'm' );
+
+  str03 = str01; 
+  csz01 = str01.size();
+  rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ...
+  *rit1 = L'z';         // ... but it's taken care of here 
+  VERIFY( str01[csz01 - 1] == L'z' );
+  VERIFY( str03[csz01 - 1] == L'y' );
+
+  str03 = str01;
+  csz01 = str01.size();
+  std::wstring::reference r1 = str01.at(csz01 - 2);
+  VERIFY( str03 == str01 );
+  r1 = L'd';
+  VERIFY( str01[csz01 - 2] == L'd' );
+  VERIFY( str03[csz01 - 2] == L'a' );
+
+  str03 = str01; 
+  csz01 = str01.size();
+  std::wstring::reference r2 = str01[csz01 - 3];
+  VERIFY( str03 == str01 );
+  r2 = L'w'; 
+  VERIFY( str01[csz01 - 3] == L'w' );
+  VERIFY( str03[csz01 - 3] == L'b' );
+
+  str03 = str01;
+  csz02 = str01.size();
+  it1 = str01.end();
+  VERIFY( str03 == str01 );
+  --it1;
+  *it1 = L'q'; 
+  VERIFY( str01[csz02 - 1] == L'q' );
+  VERIFY( str03[csz02 - 1] == L'z' );
+
+  str03 = str01;
+  rit1 = str01.rend();
+  VERIFY( str03 == str01 );
+  --rit1;      
+  *rit1 = L'p'; 
+  VERIFY( str01[0] == L'p' );
+  VERIFY( str03[0] == L'x' );
+
+  // need to also test for const begin/const end
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc
new file mode 100644 (file)
index 0000000..b771038
--- /dev/null
@@ -0,0 +1,90 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3 template class basic_string
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// Do another sanity check, this time for member functions that return
+// iterators, namely insert and erase.
+bool test02(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::iterator siterator;
+  typedef std::wstring::reverse_iterator sriterator;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+  siterator it1;
+  sriterator rit1;  
+
+  const std::wstring str01(L"its beach, santa cruz");
+
+  std::wstring str02 = str01;
+  std::wstring str05 = str02; // optional, so that begin below causes a mutate
+  std::wstring::iterator p = str02.insert(str02.begin(), L' ');
+  std::wstring str03 = str02;
+  VERIFY( str03 == str02 );
+  *p = L'!';
+  VERIFY( *str03.c_str() == L' ' );
+  str03[0] = L'@';
+  VERIFY( str02[0] == L'!' );
+  VERIFY( *p == L'!' );
+  VERIFY( str02 != str05 );
+  VERIFY( str02 != str03 );
+
+  std::wstring str10 = str01;
+  std::wstring::iterator p2 = str10.insert(str10.begin(), L'a');
+  std::wstring str11 = str10;
+  *p2 = L'e';
+  VERIFY( str11 != str10 );
+
+  std::wstring str06 = str01;
+  std::wstring str07 = str06; // optional, so that begin below causes a mutate
+  p = str06.erase(str06.begin());
+  std::wstring str08 = str06;
+  VERIFY( str08 == str06 );
+  *p = L'!';
+  VERIFY( *str08.c_str() == L't' );
+  str08[0] = L'@';
+  VERIFY( str06[0] == L'!' );
+  VERIFY( *p == L'!' );
+  VERIFY( str06 != str07 );
+  VERIFY( str06 != str08 );
+
+  std::wstring str12 = str01;
+  p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
+  std::wstring str13 = str12;
+  *p2 = L'e';
+  VERIFY( str12 != str13 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-06-09 bkoz
 
-// Copyright (C) 1994, 1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1994, 1999, 2000, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..4cd643e
--- /dev/null
@@ -0,0 +1,198 @@
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994, 1999, 2000, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const wchar_t str_lit01[] = L"mave";
+  const std::wstring str01(L"mavericks, santa cruz");
+  std::wstring str02(str_lit01);
+  std::wstring str03(L"s, s");
+  std::wstring str04;
+
+  // size_type find(const wstring&, size_type pos = 0) const;
+  csz01 = str01.find(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str01, 4);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str02, 3);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find(str03, 3);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find(str03, 12);
+  VERIFY( csz01 == npos );
+
+  // An empty string consists of no characters
+  // therefore it should be found at every point in a string,
+  // except beyond the end
+  csz01 = str01.find(str04, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str04, 5);
+  VERIFY( csz01 == 5 );
+  csz01 = str01.find(str04, str01.size());
+  VERIFY( csz01 == str01.size() ); 
+  csz01 = str01.find(str04, str01.size()+1);
+  VERIFY( csz01 == npos ); 
+  
+  // size_type find(const wchar_t* s, size_type pos, size_type n) const;
+  csz01 = str01.find(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str_lit01, 3, 0);
+  VERIFY( csz01 == 3 );
+
+  // size_type find(const wchar_t* s, size_type pos = 0) const;
+  csz01 = str01.find(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str_lit01, 3);
+  VERIFY( csz01 == npos );
+
+  // size_type find(wchar_t c, size_type pos = 0) const;
+  csz01 = str01.find(L'z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+  csz01 = str01.find(L'/');
+  VERIFY( csz01 == npos );
+   
+  // size_type find_first_of(const wstring&, size_type pos = 0) const;
+  std::wstring str05(L"xena rulez");
+  csz01 = str01.find_first_of(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str01, 4);
+  VERIFY( csz01 == 4 );
+  csz01 = str01.find_first_of(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str02, 3);
+  VERIFY( csz01 == 3 );
+  csz01 = str01.find_first_of(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_of(str03, 3);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_of(str03, 12);
+  VERIFY( csz01 == 16 );
+  csz01 = str01.find_first_of(str05, 0);
+  VERIFY( csz01 == 1 );
+  csz01 = str01.find_first_of(str05, 4);
+  VERIFY( csz01 == 4 );
+
+  // An empty string consists of no characters
+  // therefore it should be found at every point in a string,
+  // except beyond the end
+  // However, str1.find_first_of(str2,pos) finds the first character in 
+  // str1 (starting at pos) that exists in str2, which is none for empty str2
+  csz01 = str01.find_first_of(str04, 0);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_of(str04, 5);
+  VERIFY( csz01 == npos );
+  
+  // size_type find_first_of(const wchar_t* s, size_type pos, size_type n) const;
+  csz01 = str01.find_first_of(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str_lit01, 3, 0);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_of(const char* s, size_type pos = 0) const;
+  csz01 = str01.find_first_of(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str_lit01, 3);
+  VERIFY( csz01 == 3 );
+
+  // size_type find_first_of(wchar_t c, size_type pos = 0) const;
+  csz01 = str01.find_first_of(L'z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+
+  // size_type find_last_of(const wstring& str, size_type pos = 0) const;
+  // size_type find_last_of(const wchar_t* s, size_type pos, size_type n) const;
+  // size_type find_last_of(const wchar_t* s, size_type pos = 0) const;
+  // size_type find_last_of(wchar_t c, size_type pos = 0) const;
+
+#if 1
+// from tstring.cc, from jason merrill, et. al.
+  std::wstring x;
+  std::wstring::size_type pos;
+  pos = x.find_last_not_of(L'X');
+  VERIFY( pos == npos );
+  pos = x.find_last_not_of(L"XYZ");
+  VERIFY( pos == npos );
+
+  std::wstring y(L"a");
+  pos = y.find_last_not_of(L'X');
+  VERIFY( pos == 0 );
+  pos = y.find_last_not_of(L'a');
+  VERIFY( pos == npos );
+  pos = y.find_last_not_of(L"XYZ");
+  VERIFY( pos == 0 );
+  pos = y.find_last_not_of(L"a");
+  VERIFY( pos == npos );
+
+  std::wstring z(L"ab");
+  pos = z.find_last_not_of(L'X');
+  VERIFY( pos == 1 );
+  pos = z.find_last_not_of(L"XYZ");
+  VERIFY( pos == 1 );
+  pos = z.find_last_not_of(L'b');
+  VERIFY( pos == 0 );
+  pos = z.find_last_not_of(L"Xb");
+  VERIFY( pos == 0 );
+  pos = z.find_last_not_of(L"Xa");
+  VERIFY( pos == 1 );
+  pos = z.find_last_of(L"ab");
+  VERIFY( pos == 1 );
+  pos = z.find_last_of(L"Xa");
+  VERIFY( pos == 0 );
+  pos = z.find_last_of(L"Xb");
+  VERIFY( pos == 1 );
+  pos = z.find_last_of(L"XYZ");
+  VERIFY( pos == std::wstring::npos );
+  pos = z.find_last_of(L'a');
+  VERIFY( pos == 0 );
+  pos = z.find_last_of(L'b');
+  VERIFY( pos == 1 );
+  pos = z.find_last_of(L'X');
+  VERIFY( pos == std::wstring::npos );
+#endif
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
@@ -187,67 +187,9 @@ int test01(void)
   return test;
 }
 
-// Once more
-//   string& insert(size_type __p, const char* s, size_type n);
-//   string& insert(size_type __p, const char* s);
-// but now s points inside the _Rep
-int test02(void)
-{
-  bool test = true;
-
-  std::string str01;
-  const char* title = "Everything was beautiful, and nothing hurt";
-  // Increasing size: str01 is reallocated every time.
-  str01 = title;
-  str01.insert(0, str01.c_str() + str01.size() - 4, 4);
-  VERIFY( str01 == "hurtEverything was beautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(0, str01.c_str(), 5);
-  VERIFY( str01 == "EveryEverything was beautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(10, str01.c_str() + 4, 6);
-  VERIFY( str01 == "Everythingything was beautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(15, str01.c_str(), 10);
-  VERIFY( str01 == "Everything was Everythingbeautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(15, str01.c_str() + 11, 13);
-  VERIFY( str01 == "Everything was was beautifulbeautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(0, str01.c_str());
-  VERIFY( str01 == "Everything was beautiful, and nothing hurt"
-         "Everything was beautiful, and nothing hurt");
-  // Again: no reallocations.
-  str01 = title;
-  str01.insert(0, str01.c_str() + str01.size() - 4, 4);
-  VERIFY( str01 == "hurtEverything was beautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(0, str01.c_str(), 5);
-  VERIFY( str01 == "EveryEverything was beautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(10, str01.c_str() + 4, 6);
-  VERIFY( str01 == "Everythingything was beautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(15, str01.c_str(), 10);
-  VERIFY( str01 == "Everything was Everythingbeautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(15, str01.c_str() + 11, 13);
-  VERIFY( str01 == "Everything was was beautifulbeautiful, and nothing hurt" );
-  str01 = title;
-  str01.insert(0, str01.c_str());
-  VERIFY( str01 == "Everything was beautiful, and nothing hurt"
-         "Everything was beautiful, and nothing hurt");
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-  return test;
-}
-
 int main()
 { 
   __gnu_cxx_test::set_memory_limits();
   test01();
-  test02();
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/char/2.cc
new file mode 100644 (file)
index 0000000..80b0cee
--- /dev/null
@@ -0,0 +1,87 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.4 basic_string::insert
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// More
+//   string& insert(size_type __p, const char* s, size_type n);
+//   string& insert(size_type __p, const char* s);
+// but now s points inside the _Rep
+int test02(void)
+{
+  bool test = true;
+
+  std::string str01;
+  const char* title = "Everything was beautiful, and nothing hurt";
+  // Increasing size: str01 is reallocated every time.
+  str01 = title;
+  str01.insert(0, str01.c_str() + str01.size() - 4, 4);
+  VERIFY( str01 == "hurtEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str(), 5);
+  VERIFY( str01 == "EveryEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(10, str01.c_str() + 4, 6);
+  VERIFY( str01 == "Everythingything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str(), 10);
+  VERIFY( str01 == "Everything was Everythingbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str() + 11, 13);
+  VERIFY( str01 == "Everything was was beautifulbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str());
+  VERIFY( str01 == "Everything was beautiful, and nothing hurt"
+         "Everything was beautiful, and nothing hurt");
+  // Again: no reallocations.
+  str01 = title;
+  str01.insert(0, str01.c_str() + str01.size() - 4, 4);
+  VERIFY( str01 == "hurtEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str(), 5);
+  VERIFY( str01 == "EveryEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(10, str01.c_str() + 4, 6);
+  VERIFY( str01 == "Everythingything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str(), 10);
+  VERIFY( str01 == "Everything was Everythingbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str() + 11, 13);
+  VERIFY( str01 == "Everything was was beautifulbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str());
+  VERIFY( str01 == "Everything was beautiful, and nothing hurt"
+         "Everything was beautiful, and nothing hurt");
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..96f71b0
--- /dev/null
@@ -0,0 +1,195 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.4 basic_string::insert
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::iterator citerator;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const std::wstring str01(L"rodeo beach, marin");
+  const std::wstring str02(L"baker beach, san francisco");
+  std::wstring str03;
+
+  // wstring& insert(size_type p1, const wstring& str, size_type p2, size_type n)
+  // requires:
+  //   1) p1 <= size()
+  //   2) p2 <= str.size()
+  //   3) rlen = min(n, str.size() - p2)
+  // throws:
+  //   1) out_of_range if p1 > size() || p2 > str.size()
+  //   2) length_error if size() >= npos - rlen
+  // effects:
+  // replaces *this with new wstring of length size() + rlen such that
+  // nstr[0]  to nstr[p1] == thisstr[0] to thisstr[p1]
+  // nstr[p1 + 1] to nstr[p1 + rlen] == str[p2] to str[p2 + rlen]
+  // nstr[p1 + 1 + rlen] to nstr[...] == thisstr[p1 + 1] to thisstr[...]  
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  try {
+    str03.insert(csz01 + 1, str02, 0, 5);
+    VERIFY( false );
+  }             
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  try {
+    str03.insert(0, str02, csz02 + 1, 5);
+    VERIFY( false );
+  }             
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+  csz01 = str01.max_size();
+  try {
+    std::wstring str04(csz01, L'b'); 
+    str03 = str04; 
+    csz02 = str02.size();
+    try {
+      str03.insert(0, str02, 0, 5);
+      VERIFY( false );
+    }           
+    catch(std::length_error& fail) {
+      VERIFY( true );
+    }
+    catch(...) {
+      VERIFY( false );
+    }
+  }
+  catch(std::bad_alloc& failure){
+    VERIFY( true ); 
+  }
+  catch(std::exception& failure){
+    VERIFY( false );
+  }
+
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  str03.insert(13, str02, 0, 12); 
+  VERIFY( str03 == L"rodeo beach, baker beach,marin" );
+
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  str03.insert(0, str02, 0, 12); 
+  VERIFY( str03 == L"baker beach,rodeo beach, marin" );
+
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  str03.insert(csz01, str02, 0, csz02); 
+  VERIFY( str03 == L"rodeo beach, marinbaker beach, san francisco" );
+
+  // wstring& insert(size_type __p, const wstring& wstr);
+  // insert(p1, str, 0, npos)
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  str03.insert(csz01, str02); 
+  VERIFY( str03 == L"rodeo beach, marinbaker beach, san francisco" );
+
+  str03 = str01; 
+  csz01 = str03.size();
+  csz02 = str02.size();
+  str03.insert(0, str02); 
+  VERIFY( str03 == L"baker beach, san franciscorodeo beach, marin" );
+
+  // wstring& insert(size_type __p, const wchar_t* s, size_type n);
+  // insert(p1, wstring(s,n))
+  str03 = str02; 
+  csz01 = str03.size();
+  str03.insert(0, L"-break at the bridge", 20); 
+  VERIFY( str03 == L"-break at the bridgebaker beach, san francisco" );
+
+  // wstring& insert(size_type __p, const wchar_t* s);
+  // insert(p1, wstring(s))
+  str03 = str02; 
+  str03.insert(0, L"-break at the bridge"); 
+  VERIFY( str03 == L"-break at the bridgebaker beach, san francisco" );
+
+  // wstring& insert(size_type __p, size_type n, wchar_t c)
+  // insert(p1, wstring(n,c))
+  str03 = str02; 
+  csz01 = str03.size();
+  str03.insert(csz01, 5, L'z'); 
+  VERIFY( str03 == L"baker beach, san franciscozzzzz" );
+
+  // iterator insert(iterator p, wchar_t c)
+  // inserts a copy of c before the character referred to by p
+  str03 = str02; 
+  citerator cit01 = str03.begin();
+  str03.insert(cit01, L'u'); 
+  VERIFY( str03 == L"ubaker beach, san francisco" );
+
+  // iterator insert(iterator p, size_type n,  wchar_t c)
+  // inserts n copies of c before the character referred to by p
+  str03 = str02; 
+  cit01 = str03.begin();
+  str03.insert(cit01, 5, L'u'); 
+  VERIFY( str03 == L"uuuuubaker beach, san francisco" );
+
+  // template<inputit>
+  //   void 
+  //   insert(iterator p, inputit first, inputit, last)
+  // ISO-14882: defect #7 part 1 clarifies this member function to be:
+  // insert(p - begin(), wstring(first,last))
+  str03 = str02; 
+  csz01 = str03.size();
+  str03.insert(str03.begin(), str01.begin(), str01.end()); 
+  VERIFY( str03 == L"rodeo beach, marinbaker beach, san francisco" );
+
+  str03 = str02; 
+  csz01 = str03.size();
+  str03.insert(str03.end(), str01.begin(), str01.end()); 
+  VERIFY( str03 == L"baker beach, san franciscorodeo beach, marin" );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  __gnu_cxx_test::set_memory_limits();
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/insert/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..04cc454
--- /dev/null
@@ -0,0 +1,87 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.4 basic_string::insert
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// More
+//   wstring& insert(size_type __p, const wchar_t* s, size_type n);
+//   wstring& insert(size_type __p, const wchar_t* s);
+// but now s points inside the _Rep
+int test02(void)
+{
+  bool test = true;
+
+  std::wstring str01;
+  const wchar_t* title = L"Everything was beautiful, and nothing hurt";
+  // Increasing size: str01 is reallocated every time.
+  str01 = title;
+  str01.insert(0, str01.c_str() + str01.size() - 4, 4);
+  VERIFY( str01 == L"hurtEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str(), 5);
+  VERIFY( str01 == L"EveryEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(10, str01.c_str() + 4, 6);
+  VERIFY( str01 == L"Everythingything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str(), 10);
+  VERIFY( str01 == L"Everything was Everythingbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str() + 11, 13);
+  VERIFY( str01 == L"Everything was was beautifulbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str());
+  VERIFY( str01 == L"Everything was beautiful, and nothing hurt"
+         L"Everything was beautiful, and nothing hurt");
+  // Again: no reallocations.
+  str01 = title;
+  str01.insert(0, str01.c_str() + str01.size() - 4, 4);
+  VERIFY( str01 == L"hurtEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str(), 5);
+  VERIFY( str01 == L"EveryEverything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(10, str01.c_str() + 4, 6);
+  VERIFY( str01 == L"Everythingything was beautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str(), 10);
+  VERIFY( str01 == L"Everything was Everythingbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(15, str01.c_str() + 11, 13);
+  VERIFY( str01 == L"Everything was was beautifulbeautiful, and nothing hurt" );
+  str01 = title;
+  str01.insert(0, str01.c_str());
+  VERIFY( str01 == L"Everything was beautiful, and nothing hurt"
+         L"Everything was beautiful, and nothing hurt");
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-07-01 bkoz
 
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -29,7 +29,6 @@
 #include <sstream>
 #include <fstream>
 #include <iostream>
-#include <iomanip>
 #include <testsuite_hooks.h>
 
 bool test01(void)
@@ -165,199 +164,8 @@ bool test01(void)
   return test;
 }
 
-
-// testing basic_stringbuf::xsputn via stress testing with large strings
-// based on a bug report libstdc++ 9
-void test04(int size)
-{
-  bool test = true;
-  std::string str(size, 's');
-  int expected_size = 2 * (size + 1);
-  std::ostringstream oss(str);
-  
-  // sanity checks
-  VERIFY( str.size() == size );
-  VERIFY( oss.good() );
-
-  // stress test
-  oss << str << std::endl;
-  if (!oss.good()) 
-    test = false;
-
-  oss << str << std::endl;
-  if (!oss.good()) 
-    test = false;
-
-  VERIFY( str.size() == size );
-  VERIFY( oss.good() );
-  std::string str_tmp = oss.str();
-  VERIFY( str_tmp.size() == expected_size );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-}
-
-
-// testing basic_filebuf::xsputn via stress testing with large strings
-// based on a bug report libstdc++ 9
-// mode == out
-void test05(int size)
-{
-  bool test = true;
-  const char filename[] = "inserters_extractors-1.txt";
-  const char fillc = 'f';
-  std::ofstream ofs(filename);
-  std::string str(size, fillc);
-
-  // sanity checks
-  VERIFY( str.size() == size );
-  VERIFY( ofs.good() );
-
-  // stress test
-  ofs << str << std::endl;
-  if (!ofs.good()) 
-    test = false;
-
-  ofs << str << std::endl;
-  if (!ofs.good()) 
-    test = false;
-
-  VERIFY( str.size() == size );
-  VERIFY( ofs.good() );
-
-  ofs.close();
-
-  // sanity check on the written file
-  std::ifstream ifs(filename);
-  int count = 0;
-  char c;
-  while (count <= (2 * size) + 4)
-    {
-      ifs >> c;
-      if (ifs.good() && c == fillc)
-       {
-         ++count;
-         c = '0';
-       }
-      else 
-       break;
-    }
-
-  VERIFY( count == 2 * size );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-}
-
-
-// istringstream/stringbuf extractor properly size buffer based on
-// actual, not allocated contents (string.size() vs. string.capacity()).
-// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html
-void test06(void)
-{
-  bool test = true;
-
-  typedef std::string::size_type size_type;
-  std::string str01("@silent");
-  size_type i01 = str01.size();
-  size_type i02 = str01.capacity();
-  str01.erase(0, 1);
-  size_type i03 = str01.size();
-  size_type i04 = str01.capacity();
-  VERIFY( i01 - 1 == i03 );
-  VERIFY( i02 >= i04 );
-
-  std::istringstream is(str01);
-  std::string str02;
-  is >> str02 >> std::ws;
-  size_type i05 = str02.size();
-  size_type i06 = str02.capacity();
-  VERIFY( i05 == i03 );
-  VERIFY( i06 <= i04 );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html
-// istream::operator>>(string)
-// sets failbit
-// NB: this is a defect in the standard.
-void test07(void)
-{
-  bool test = true;
-  const std::string name("z6.cc");
-  std::istringstream iss (name);
-  int i = 0;
-  std::string s;
-  while (iss >> s) 
-    ++i;
-
-  VERIFY( i < 3 );
-  VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-}
-
-// libstdc++/1019
-void test08()
-{
-  using namespace std;
-
-  bool                 test = true;
-  istringstream istrm("enero:2001");
-  int          year;
-  char                 sep;
-  string       month;
-  
-  istrm >> setw(5) >> month >> sep >> year;
-  VERIFY( month.size() == 5 );
-  VERIFY( sep == ':' );
-  VERIFY( year == 2001 );
-}
-
-// libstdc++/2830
-void test09()
-{
-  bool test = true;
-  std::string blanks( 3, '\0');
-  std::string foo = "peace";
-  foo += blanks;
-  foo += "& love";
-  
-  std::ostringstream oss1;
-  oss1 << foo;
-  VERIFY( oss1.str() == foo );
-  
-  std::ostringstream oss2;
-  oss2.width(20);
-  oss2 << foo;
-  VERIFY( oss2.str() != foo );
-  VERIFY( oss2.str().size() == 20 );
-}
-
 int main()
 { 
   test01();
-
-  test04(1); // expected_size == 4
-  test04(1000); // expected_size == 2002
-  test04(10000); // expected_size == 20002
-
-  test05(1); 
-  test05(1000); 
-  test05(10000);
-
-  test06();
-  test07();
-
-  test08();
-  
-  test09();
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/4.cc
new file mode 100644 (file)
index 0000000..55eecc1
--- /dev/null
@@ -0,0 +1,69 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// testing basic_stringbuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+void test04(int size)
+{
+  bool test = true;
+  std::string str(size, 's');
+  int expected_size = 2 * (size + 1);
+  std::ostringstream oss(str);
+  
+  // sanity checks
+  VERIFY( str.size() == size );
+  VERIFY( oss.good() );
+
+  // stress test
+  oss << str << std::endl;
+  if (!oss.good()) 
+    test = false;
+
+  oss << str << std::endl;
+  if (!oss.good()) 
+    test = false;
+
+  VERIFY( str.size() == size );
+  VERIFY( oss.good() );
+  std::string str_tmp = oss.str();
+  VERIFY( str_tmp.size() == expected_size );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test04(1); // expected_size == 4
+  test04(1000); // expected_size == 2002
+  test04(10000); // expected_size == 20002
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/5.cc
new file mode 100644 (file)
index 0000000..8e24f5b
--- /dev/null
@@ -0,0 +1,90 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// testing basic_filebuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+// mode == out
+void test05(int size)
+{
+  bool test = true;
+  const char filename[] = "inserters_extractors-1.txt";
+  const char fillc = 'f';
+  std::ofstream ofs(filename);
+  std::string str(size, fillc);
+
+  // sanity checks
+  VERIFY( str.size() == size );
+  VERIFY( ofs.good() );
+
+  // stress test
+  ofs << str << std::endl;
+  if (!ofs.good()) 
+    test = false;
+
+  ofs << str << std::endl;
+  if (!ofs.good()) 
+    test = false;
+
+  VERIFY( str.size() == size );
+  VERIFY( ofs.good() );
+
+  ofs.close();
+
+  // sanity check on the written file
+  std::ifstream ifs(filename);
+  int count = 0;
+  char c;
+  while (count <= (2 * size) + 4)
+    {
+      ifs >> c;
+      if (ifs.good() && c == fillc)
+       {
+         ++count;
+         c = '0';
+       }
+      else 
+       break;
+    }
+
+  VERIFY( count == 2 * size );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test05(1); 
+  test05(1000); 
+  test05(10000);
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/6.cc
new file mode 100644 (file)
index 0000000..5d42625
--- /dev/null
@@ -0,0 +1,65 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// istringstream/stringbuf extractor properly size buffer based on
+// actual, not allocated contents (string.size() vs. string.capacity()).
+// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html
+void test06(void)
+{
+  bool test = true;
+
+  typedef std::string::size_type size_type;
+  std::string str01("@silent");
+  size_type i01 = str01.size();
+  size_type i02 = str01.capacity();
+  str01.erase(0, 1);
+  size_type i03 = str01.size();
+  size_type i04 = str01.capacity();
+  VERIFY( i01 - 1 == i03 );
+  VERIFY( i02 >= i04 );
+
+  std::istringstream is(str01);
+  std::string str02;
+  is >> str02 >> std::ws;
+  size_type i05 = str02.size();
+  size_type i06 = str02.capacity();
+  VERIFY( i05 == i03 );
+  VERIFY( i06 <= i04 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test06();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/7.cc
new file mode 100644 (file)
index 0000000..7e6116e
--- /dev/null
@@ -0,0 +1,57 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html
+// istream::operator>>(string)
+// sets failbit
+// NB: this is a defect in the standard.
+void test07(void)
+{
+  bool test = true;
+  const std::string name("z6.cc");
+  std::istringstream iss (name);
+  int i = 0;
+  std::string s;
+  while (iss >> s) 
+    ++i;
+
+  VERIFY( i < 3 );
+  VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test07();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/8.cc
new file mode 100644 (file)
index 0000000..bdc848e
--- /dev/null
@@ -0,0 +1,53 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <testsuite_hooks.h>
+
+// libstdc++/1019
+void test08()
+{
+  using namespace std;
+
+  bool                 test = true;
+  istringstream istrm("enero:2001");
+  int          year;
+  char                 sep;
+  string       month;
+  
+  istrm >> setw(5) >> month >> sep >> year;
+  VERIFY( month.size() == 5 );
+  VERIFY( sep == ':' );
+  VERIFY( year == 2001 );
+}
+
+int main()
+{ 
+  test08();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/9.cc
new file mode 100644 (file)
index 0000000..fb201c2
--- /dev/null
@@ -0,0 +1,56 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <testsuite_hooks.h>
+
+// libstdc++/2830
+void test09()
+{
+  bool test = true;
+  std::string blanks( 3, '\0');
+  std::string foo = "peace";
+  foo += blanks;
+  foo += "& love";
+  
+  std::ostringstream oss1;
+  oss1 << foo;
+  VERIFY( oss1.str() == foo );
+  
+  std::ostringstream oss2;
+  oss2.width(20);
+  oss2 << foo;
+  VERIFY( oss2.str() != foo );
+  VERIFY( oss2.str().size() == 20 );
+}
+
+int main()
+{ 
+  test09();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..5297958
--- /dev/null
@@ -0,0 +1,171 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <stdexcept>
+#include <sstream>
+#include <fstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const std::wstring str01(L"sailing grand traverse bay\n"
+              L"\t\t\t    from Elk Rapids to the point reminds me of miles");
+  const std::wstring str02(L"sailing");
+  const std::wstring str03(L"grand");
+  const std::wstring str04(L"traverse");
+  const std::wstring str05;
+  std::wstring str10;
+  
+  // istream& operator>>(istream&, string&)
+  std::wistringstream istrs01(str01);
+  istrs01 >> str10;
+  VERIFY( str10 == str02 );
+  try 
+    {
+      std::wistringstream::int_type i01 = istrs01.peek(); //a-boo
+      VERIFY( std::wistringstream::traits_type::to_char_type(i01) == L' ' );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false ); // shouldn't throw
+    }
+
+  istrs01.clear();
+  istrs01 >> str10; 
+  VERIFY( str10 == str03 ); 
+  istrs01.clear();
+  istrs01 >> str10; 
+  VERIFY( str10 == str04 ); // sentry picks out the white spaces. . 
+
+  std::wistringstream istrs02(str05); // empty
+  istrs02 >> str10;
+  VERIFY( str10 == str04 );
+  // istream& getline(istream&, string&, char)
+  // istream& getline(istream&, string&)
+  try 
+    {
+      istrs01.clear();
+      getline(istrs01, str10);
+      VERIFY( !istrs01.fail() );
+      VERIFY( !istrs01.eof() );
+      VERIFY( istrs01.good() );
+      VERIFY( str10 == L" bay" );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false ); // shouldn't throw
+    }
+
+  try 
+    {
+      istrs01.clear();
+      getline(istrs01, str10, L'\t');
+      VERIFY( !istrs01.fail() );
+      VERIFY( !istrs01.eof() );
+      VERIFY( istrs01.good() );
+      VERIFY( str10 == str05 );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false ); // shouldn't throw
+    }
+  
+  try 
+    {
+      istrs01.clear();
+      getline(istrs01, str10, L'\t');
+      VERIFY( !istrs01.fail() );
+      VERIFY( !istrs01.eof() );
+      VERIFY( istrs01.good() );
+      VERIFY( str10 == str05 );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false ); // shouldn't throw
+    }
+  
+  try 
+    {
+      istrs01.clear();
+      getline(istrs01, str10, L'.');
+      VERIFY( !istrs01.fail() );
+      VERIFY( istrs01.eof() );
+      VERIFY( !istrs01.good() );
+      VERIFY( str10 == L"\t    from Elk Rapids to the point reminds me of miles" );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false ); // shouldn't throw
+    }
+
+  try 
+    {
+      getline(istrs02, str10);
+      VERIFY( istrs02.fail() );
+      VERIFY( istrs02.eof() );
+      VERIFY( str10 == L"\t    from Elk Rapids to the point reminds me of miles" );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false ); // shouldn't throw
+    }
+  
+  // ostream& operator<<(ostream&, const basic_string&)
+  std::wostringstream ostrs01;
+  try 
+    {
+      ostrs01 << str01;
+      VERIFY( ostrs01.str() == str01 );
+    }
+  catch(std::exception& fail) 
+    {
+      VERIFY( false );
+    }
+  
+  std::wstring hello_world;
+  std::wcout << hello_world;
+  
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/4.cc
new file mode 100644 (file)
index 0000000..f47d8da
--- /dev/null
@@ -0,0 +1,69 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// testing basic_stringbuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+void test04(int size)
+{
+  bool test = true;
+  std::wstring str(size, L's');
+  int expected_size = 2 * (size + 1);
+  std::wostringstream oss(str);
+  
+  // sanity checks
+  VERIFY( str.size() == size );
+  VERIFY( oss.good() );
+
+  // stress test
+  oss << str << std::endl;
+  if (!oss.good()) 
+    test = false;
+
+  oss << str << std::endl;
+  if (!oss.good()) 
+    test = false;
+
+  VERIFY( str.size() == size );
+  VERIFY( oss.good() );
+  std::wstring str_tmp = oss.str();
+  VERIFY( str_tmp.size() == expected_size );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test04(1); // expected_size == 4
+  test04(1000); // expected_size == 2002
+  test04(10000); // expected_size == 20002
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc
new file mode 100644 (file)
index 0000000..e9a701e
--- /dev/null
@@ -0,0 +1,90 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// testing basic_filebuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+// mode == out
+void test05(int size)
+{
+  bool test = true;
+  const char filename[] = "inserters_extractors-1.txt";
+  const wchar_t fillc = L'f';
+  std::wofstream ofs(filename);
+  std::wstring str(size, fillc);
+
+  // sanity checks
+  VERIFY( str.size() == size );
+  VERIFY( ofs.good() );
+
+  // stress test
+  ofs << str << std::endl;
+  if (!ofs.good()) 
+    test = false;
+
+  ofs << str << std::endl;
+  if (!ofs.good()) 
+    test = false;
+
+  VERIFY( str.size() == size );
+  VERIFY( ofs.good() );
+
+  ofs.close();
+
+  // sanity check on the written file
+  std::wifstream ifs(filename);
+  int count = 0;
+  wchar_t c;
+  while (count <= (2 * size) + 4)
+    {
+      ifs >> c;
+      if (ifs.good() && c == fillc)
+       {
+         ++count;
+         c = '0';
+       }
+      else 
+       break;
+    }
+
+  VERIFY( count == 2 * size );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test05(1); 
+  test05(1000); 
+  test05(10000);
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/6.cc
new file mode 100644 (file)
index 0000000..aedcdb2
--- /dev/null
@@ -0,0 +1,65 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// istringstream/stringbuf extractor properly size buffer based on
+// actual, not allocated contents (string.size() vs. string.capacity()).
+// http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00049.html
+void test06(void)
+{
+  bool test = true;
+
+  typedef std::wstring::size_type size_type;
+  std::wstring str01(L"@silent");
+  size_type i01 = str01.size();
+  size_type i02 = str01.capacity();
+  str01.erase(0, 1);
+  size_type i03 = str01.size();
+  size_type i04 = str01.capacity();
+  VERIFY( i01 - 1 == i03 );
+  VERIFY( i02 >= i04 );
+
+  std::wistringstream is(str01);
+  std::wstring str02;
+  is >> str02 >> std::ws;
+  size_type i05 = str02.size();
+  size_type i06 = str02.capacity();
+  VERIFY( i05 == i03 );
+  VERIFY( i06 <= i04 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test06();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/7.cc
new file mode 100644 (file)
index 0000000..4028924
--- /dev/null
@@ -0,0 +1,57 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html
+// istream::operator>>(string)
+// sets failbit
+// NB: this is a defect in the standard.
+void test07(void)
+{
+  bool test = true;
+  const std::wstring name(L"z6.cc");
+  std::wistringstream iss(name);
+  int i = 0;
+  std::wstring s;
+  while (iss >> s) 
+    ++i;
+
+  VERIFY( i < 3 );
+  VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+}
+
+int main()
+{ 
+  test07();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/8.cc
new file mode 100644 (file)
index 0000000..d43d818
--- /dev/null
@@ -0,0 +1,53 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <testsuite_hooks.h>
+
+// libstdc++/1019
+void test08()
+{
+  using namespace std;
+
+  bool                  test = true;
+  wistringstream istrm(L"enero:2001");
+  int           year;
+  wchar_t       sep;
+  wstring       month;
+  
+  istrm >> setw(5) >> month >> sep >> year;
+  VERIFY( month.size() == 5 );
+  VERIFY( sep == ':' );
+  VERIFY( year == 2001 );
+}
+
+int main()
+{ 
+  test08();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/9.cc
new file mode 100644 (file)
index 0000000..726dacc
--- /dev/null
@@ -0,0 +1,56 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <testsuite_hooks.h>
+
+// libstdc++/2830
+void test09()
+{
+  bool test = true;
+  std::wstring blanks(3, L'\0');
+  std::wstring foo = L"peace";
+  foo += blanks;
+  foo += L"& love";
+  
+  std::wostringstream oss1;
+  oss1 << foo;
+  VERIFY( oss1.str() == foo );
+  
+  std::wostringstream oss2;
+  oss2.width(20);
+  oss2 << foo;
+  VERIFY( oss2.str() != foo );
+  VERIFY( oss2.str().size() == 20 );
+}
+
+int main()
+{ 
+  test09();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-05-07 bkoz
 
-// Copyright (C) 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -1,6 +1,6 @@
 // 1998-10-01, 1999-06-25 bkoz
 
-// Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+// Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..cd8f18b
--- /dev/null
@@ -0,0 +1,56 @@
+// 1999-05-07 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6 string operations
+
+#include <string>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+  bool test = true;
+
+  std::wstring str1;
+  std::wstring str2;
+  
+  // Should get this:
+  // 1:8-chars_8-chars_
+  // 2:8-chars_8-chars_
+  str1 = std::wstring(L"8-chars_") + L"8-chars_";
+  const wchar_t* p1 = str1.c_str();
+  // wprintf("1:%s\n", str1.c_str());
+  str2 = str1 + L"7-chars";
+  // wprintf("2:%s\n", str1.c_str()); //str1 is gone
+  const wchar_t* p2 = str1.c_str();
+  return 0;
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..11e63f7
--- /dev/null
@@ -0,0 +1,300 @@
+// 1998-10-01, 1999-06-25 bkoz
+
+// Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.1 basic_string non-member functions
+
+// 21.3.7.2 operator==
+/*
+template<class charT, class traits, class Allocator>
+  bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator==(const charT* lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+                  const charT* rhs);
+*/
+
+// 21.3.7.3 operator!=
+/*
+template<class charT, class traits, class Allocator>
+  bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator!=(const charT* lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator!=(const basic_string<charT,traits,Allocator>& lhs, 
+                  const charT* rhs);
+*/
+
+// 21.3.7.4 operator<
+/*
+template<class charT, class traits, class Allocator>
+  bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+                  const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator< (const charT* lhs, 
+                  const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+// 21.3.7.5 operator>
+/*
+template<class charT, class traits, class Allocator>
+  bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+                  const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator> (const charT* lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+//21.3.7.6 operator<=
+/*
+template<class charT, class traits, class Allocator>
+  bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+                  const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator<=(const charT* lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+// 21.3.7.7 operator>=
+/*
+template<class charT, class traits, class Allocator>
+  bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+                const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+                  const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+  bool operator>=(const charT* lhs,
+                  const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+#include <string>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+  bool                 test = true;
+  std::wstring         str_0(L"costa rica");
+  std::wstring         str_1(L"costa marbella");
+  std::wstring         str_2(L"cost");
+  std::wstring str_3(L"costa ricans");
+  std::wstring  str_4;
+  
+  str_4 = str_0;
+  //comparisons between string objects
+  VERIFY( !(str_0 == str_1) );
+  VERIFY( !(str_0 == str_2) );
+  VERIFY( !(str_0 == str_3) );
+  VERIFY( !(str_1 == str_0) );
+  VERIFY( !(str_2 == str_0) );
+  VERIFY( !(str_3 == str_0) );
+  VERIFY( str_4 == str_0 );
+  VERIFY( str_0 == str_4 );
+
+  VERIFY( str_0 != str_1 );
+  VERIFY( str_0 != str_2 );
+  VERIFY( str_0 != str_3 );
+  VERIFY( str_1 != str_0 );
+  VERIFY( str_2 != str_0 );
+  VERIFY( str_3 != str_0 );
+  VERIFY( !(str_0 != str_4) );
+  VERIFY( !(str_4 != str_0) );
+   
+  VERIFY( str_0 > str_1 ); //true cuz r>m
+  VERIFY( str_0 > str_2 );
+  VERIFY( !(str_0 > str_3) );
+  VERIFY( !(str_1 > str_0) ); //false cuz m<r
+  VERIFY( !(str_2 > str_0) );
+  VERIFY( str_3 > str_0 );
+  VERIFY( !(str_0 > str_4) );
+  VERIFY( !(str_4 > str_0) );
+
+  VERIFY( !(str_0 < str_1) ); //false cuz r>m
+  VERIFY( !(str_0 < str_2) );
+  VERIFY( str_0 < str_3 );
+  VERIFY( str_1 < str_0 ); //true cuz m<r
+  VERIFY( str_2 < str_0 );
+  VERIFY( !(str_3 < str_0) );
+  VERIFY( !(str_0 < str_4) );
+  VERIFY( !(str_4 < str_0) );
+
+  VERIFY( str_0 >= str_1 ); //true cuz r>m
+  VERIFY( str_0 >= str_2 );
+  VERIFY( !(str_0 >= str_3) );
+  VERIFY( !(str_1 >= str_0) );//false cuz m<r
+  VERIFY( !(str_2 >= str_0) );
+  VERIFY( str_3 >= str_0 );
+  VERIFY( str_0 >= str_4 );
+  VERIFY( str_4 >= str_0 );
+
+  VERIFY( !(str_0 <= str_1) );//false cuz r>m
+  VERIFY( !(str_0 <= str_2) );
+  VERIFY( str_0 <= str_3 );
+  VERIFY( str_1 <= str_0 );//true cuz m<r
+  VERIFY( str_2 <= str_0 );
+  VERIFY( !(str_3 <= str_0) );
+  VERIFY( str_0 <= str_4 );
+  VERIFY( str_4 <= str_0 );
+
+  //comparisons between string object and string literal
+  VERIFY( !(str_0 == L"costa marbella") );
+  VERIFY( !(str_0 == L"cost") );
+  VERIFY( !(str_0 == L"costa ricans") );
+  VERIFY( !(L"costa marbella" == str_0) );
+  VERIFY( !(L"cost" == str_0) );
+  VERIFY( !(L"costa ricans" == str_0) );
+  VERIFY( L"costa rica" == str_0 );
+  VERIFY( str_0 == L"costa rica" );
+
+  VERIFY( str_0 != L"costa marbella" );
+  VERIFY( str_0 != L"cost" );
+  VERIFY( str_0 != L"costa ricans" );
+  VERIFY( L"costa marbella" != str_0 );
+  VERIFY( L"cost" != str_0 );
+  VERIFY( L"costa ricans" != str_0 );
+  VERIFY( !(L"costa rica" != str_0) );
+  VERIFY( !(str_0 != L"costa rica") );
+
+  VERIFY( str_0 > L"costa marbella" ); //true cuz r>m
+  VERIFY( str_0 > L"cost" );
+  VERIFY( !(str_0 > L"costa ricans") );
+  VERIFY( !(L"costa marbella" > str_0) );//false cuz m<r
+  VERIFY( !(L"cost" > str_0) );
+  VERIFY( L"costa ricans" > str_0 );
+  VERIFY( !(L"costa rica" > str_0) );
+  VERIFY( !(str_0 > L"costa rica") );
+
+  VERIFY( !(str_0 < L"costa marbella") );//false cuz r>m
+  VERIFY( !(str_0 < L"cost") );
+  VERIFY( str_0 < L"costa ricans" );
+  VERIFY( L"costa marbella" < str_0 );//true cuz m<r
+  VERIFY( L"cost" < str_0 );
+  VERIFY( !(L"costa ricans" < str_0) );
+  VERIFY( !(L"costa rica" < str_0) );
+  VERIFY( !(str_0 < L"costa rica") );
+
+  VERIFY( str_0 >= L"costa marbella" );//true cuz r>m
+  VERIFY( str_0 >= L"cost" );
+  VERIFY( !(str_0 >= L"costa ricans") );
+  VERIFY( !(L"costa marbella" >= str_0) );//false cuz m<r
+  VERIFY( !(L"cost" >= str_0) );
+  VERIFY( L"costa ricans" >= str_0 );
+  VERIFY( L"costa rica" >= str_0 );
+  VERIFY( str_0 >= L"costa rica" );
+
+  VERIFY( !(str_0 <= L"costa marbella") );//false cuz r>m
+  VERIFY( !(str_0 <= L"cost") );
+  VERIFY( str_0 <= L"costa ricans" );
+  VERIFY( L"costa marbella" <= str_0 );//true cuz m<r
+  VERIFY( L"cost" <= str_0 );
+  VERIFY( !(L"costa ricans" <= str_0) );
+  VERIFY( L"costa rica" <= str_0 );
+  VERIFY( str_0 <= L"costa rica" );
+
+  // 21.3.7.1 operator+
+/*
+template<class charT, class traits, class Allocator>
+  basic_string<charT,traits,Allocator>
+    operator+(const basic_string<charT,traits,Allocator>& lhs,
+              const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  basic_string<charT,traits,Allocator>
+    operator+(const charT* lhs,
+              const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  basic_string<charT,traits,Allocator>
+    operator+(const basic_string<charT,traits,Allocator>& lhs,
+              const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+  basic_string<charT,traits,Allocator>
+    operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+  basic_string<charT,traits,Allocator>
+    operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);
+*/
+
+  str_4 = str_0 + L"ns";
+  VERIFY( str_4 == str_3 );
+
+  const std::wstring str_5(L" marbella");
+  str_4 = L"costa" + str_5;
+  VERIFY( str_4 == str_1 );
+
+  std::wstring str_6(L"ns");
+  str_4 = str_0 + str_6;
+  VERIFY( str_4 == str_3 );
+
+  str_4 = str_0 + L'n';
+  str_4 = str_4 + L's';
+  VERIFY( str_4 == str_3 );
+
+  str_4 = L'a' + str_6;
+  str_4 = L'c' + str_4;
+  str_4 = L'i' + str_4;
+  str_4 = L'r' + str_4;
+  str_4 = L' ' + str_4;
+  str_4 = L'a' + str_4;
+  str_4 = L't' + str_4;
+  str_4 = L's' + str_4;
+  str_4 = L'o' + str_4;
+  str_4 = L'c' + str_4;
+  VERIFY( str_4 == str_3 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+
+  return 0;
+}
+
+int main() 
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/1.cc
new file mode 100644 (file)
index 0000000..7145d4c
--- /dev/null
@@ -0,0 +1,87 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::string::size_type csize_type;
+  typedef std::string::const_reference cref;
+  typedef std::string::reference ref;
+  csize_type npos = std::string::npos;
+  csize_type csz01, csz02;
+
+  const char str_lit01[] = "ventura, california";
+  const std::string str01(str_lit01);
+  std::string str02("del mar, california");
+  std::string str03(" and ");
+  std::string str05;
+
+  // string& replace(size_type pos, size_type n, const string& string)
+  // string& replace(size_type pos1, size_type n1, const string& string,
+  //                 size_type pos2, size_type n2)
+  // string& replace(size_type pos, size_type n1, const char* s, size_type n2)
+  // string& replace(size_type pos, size_type n1, const char* s)
+  // string& replace(size_type pos, size_type n1, size_type n2, char c)
+  // string& replace(iterator it1, iterator it2, const string& str)
+  // string& replace(iterator it1, iterator it2, const chat* s, size_type n)
+  // string& replace(iterator it1, iterator it2, const chat* s)
+  // string& replace(iterator it1, iterator it2, size_type n, char c)
+  // template<typename InputIter>
+  //   string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
+
+  // with mods, from tstring.cc, from jason merrill, et. al.
+  std::string X = "Hello";
+  std::string x = X;
+
+  char ch = x[0];
+  VERIFY( ch == 'H' );
+
+  std::string z = x.substr(2, 3);
+  VERIFY( z == "llo" );
+
+  x.replace(2, 2, "r");
+  VERIFY( x == "Hero" );
+
+  x = X;
+  x.replace(0, 1, "j");
+  VERIFY( x == "jello" );
+
+  int ar[] = { 'H', 'e', 'l', 'l', 'o' };
+  x.replace(std::find(x.begin(), x.end(), 'l'), 
+           std::find(x.rbegin(), x.rend(), 'l').base(), ar, 
+           ar + sizeof(ar) / sizeof(ar[0]));
+  VERIFY( x == "jeHelloo" );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/2.cc
new file mode 100644 (file)
index 0000000..7731edd
--- /dev/null
@@ -0,0 +1,46 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test02()
+{
+  bool test = true;
+  const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii";
+  std::string aux = strlit;
+  aux.replace(aux.begin()+5, aux.begin()+20,
+             aux.begin()+10, aux.begin()+15);
+  VERIFY(aux == "../thg piealei Bay/Kauai/Hawaii");
+  
+  aux = strlit;
+  aux.replace(aux.begin() + 10, aux.begin() + 15,
+             aux.begin() + 5, aux.begin() + 20);
+  VERIFY(aux == "../the lone long pier/Hanr/Hanalei Bay/Kauai/Hawaii");
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/3.cc
new file mode 100644 (file)
index 0000000..a04d13d
--- /dev/null
@@ -0,0 +1,74 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// Some more miscellaneous tests
+void
+test03()
+{
+  bool test = true;
+  const char* title01 = "nine types of ambiguity";
+  const char* title02 = "ultra";
+  std::string str01 = title01;
+  std::string str02 = title02;
+
+  str01.replace(0, 4, str02);
+  VERIFY(str01 == "ultra types of ambiguity");
+
+  str01.replace(15, 9, str02, 2, 2);
+  VERIFY(str01 == "ultra types of tr");
+
+  str01 = title01;
+  str02.replace(0, 0, str01, 0, std::string::npos);
+  VERIFY(str02 == "nine types of ambiguityultra");
+
+  str02.replace(11, 2, title02, 5);
+  VERIFY(str02 == "nine types ultra ambiguityultra");
+
+  str02.replace(11, 5, title01, 2);
+  VERIFY(str02 == "nine types ni ambiguityultra");
+
+  str01.replace(str01.size(), 0, title02);
+  VERIFY(str01 == "nine types of ambiguityultra");
+  
+  str01 = title01;
+  str02 = title02;
+  str01.replace(str01.begin(), str01.end(), str02);
+  VERIFY(str01 == "ultra");
+
+  str01.replace(str01.begin(), str01.begin(), title01, 4);
+  VERIFY(str01 == "nineultra");
+
+  str01.replace(str01.end(), str01.end(), title01 + 5, 5);
+  VERIFY(str01 == "nineultratypes");
+  
+  str01.replace(str01.begin(), str01.end(), title02);
+  VERIFY(str01 == "ultra");
+}
+
+int main()
+{ 
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/4.cc
new file mode 100644 (file)
index 0000000..47cf335
--- /dev/null
@@ -0,0 +1,67 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// Some more tests for 
+// template<typename InputIter>
+//   string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
+void
+test04()
+{
+  bool test = true;
+  std::string str01 = "geogaddi";
+  std::string str02;
+
+  typedef std::string::iterator iterator;
+  typedef std::string::const_iterator const_iterator;
+  
+  iterator it1 = str01.begin();
+  iterator it2 = str01.end();
+  str02.replace(str02.begin(), str02.end(), it1, it2);
+  VERIFY(str02 == "geogaddi");
+
+  str02 = "boards";
+  const_iterator c_it1 = str01.begin();
+  const_iterator c_it2 = str01.end();
+  str02.replace(str02.begin(), str02.end(), c_it1, c_it2);
+  VERIFY(str02 == "geogaddi");
+
+  str02 = "boards";
+  const char* c_ptr1 = str01.c_str();
+  const char* c_ptr2 = str01.c_str() + 8;
+  str02.replace(str02.begin(), str02.end(), c_ptr1, c_ptr2);
+  VERIFY(str02 == "geogaddi");
+
+  str02 = "boards";
+  char* ptr1 = &*str01.begin();
+  char* ptr2 = &*str01.end();
+  str02.replace(str02.begin(), str02.end(), ptr1, ptr2);
+  VERIFY(str02 == "geogaddi");
+}
+
+int main()
+{ 
+  test04();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/char/5.cc
new file mode 100644 (file)
index 0000000..8c112c5
--- /dev/null
@@ -0,0 +1,43 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// We wrongly used __n1 instead of __foldn1 in the length_error
+// check at the beginning of replace(__pos, __n1, __s, __n2)
+void
+test05()
+{
+  bool test = true;
+  std::string str01 = "londinium";
+  std::string str02 = "cydonia";
+
+  str01.replace(0, 20, str02.c_str(), 3);
+  VERIFY(str01 == "cyd");
+}
+
+int main()
+{ 
+  test05();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..fd0967a
--- /dev/null
@@ -0,0 +1,87 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const wchar_t str_lit01[] = L"ventura, california";
+  const std::wstring str01(str_lit01);
+  std::wstring str02(L"del mar, california");
+  std::wstring str03(L" and ");
+  std::wstring str05;
+
+  // wstring& replace(size_type pos, size_type n, const wstring& string)
+  // wstring& replace(size_type pos1, size_type n1, const wstring& string,
+  //                 size_type pos2, size_type n2)
+  // wstring& replace(size_type pos, size_type n1, const wchar_t* s, size_type n2)
+  // wstring& replace(size_type pos, size_type n1, const wchar_t* s)
+  // wstring& replace(size_type pos, size_type n1, size_type n2, wchar_t c)
+  // wstring& replace(iterator it1, iterator it2, const wstring& str)
+  // wstring& replace(iterator it1, iterator it2, const wchar_t* s, size_type n)
+  // wstring& replace(iterator it1, iterator it2, const wchar_t* s)
+  // wstring& replace(iterator it1, iterator it2, size_type n, char c)
+  // template<typename InputIter>
+  //   wstring& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
+
+  // with mods, from tstring.cc, from jason merrill, et. al.
+  std::wstring X = L"Hello";
+  std::wstring x = X;
+
+  wchar_t ch = x[0];
+  VERIFY( ch == L'H' );
+
+  std::wstring z = x.substr(2, 3);
+  VERIFY( z == L"llo" );
+
+  x.replace(2, 2, L"r");
+  VERIFY( x == L"Hero" );
+
+  x = X;
+  x.replace(0, 1, L"j");
+  VERIFY( x == L"jello" );
+
+  wchar_t ar[] = { L'H', L'e', L'l', L'l', L'o' };
+  x.replace(std::find(x.begin(), x.end(), L'l'), 
+           std::find(x.rbegin(), x.rend(), L'l').base(), ar, 
+           ar + sizeof(ar) / sizeof(ar[0]));
+  VERIFY( x == L"jeHelloo" );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..da9678a
--- /dev/null
@@ -0,0 +1,47 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test02()
+{
+  bool test = true;
+  const wchar_t* strlit = L"../the long pier/Hanalei Bay/Kauai/Hawaii";
+  std::wstring aux = strlit;
+  aux.replace(aux.begin()+5, aux.begin()+20,
+             aux.begin()+10, aux.begin()+15);
+  VERIFY(aux == L"../thg piealei Bay/Kauai/Hawaii");
+  
+  aux = strlit;
+  aux.replace(aux.begin() + 10, aux.begin() + 15,
+             aux.begin() + 5, aux.begin() + 20);
+  VERIFY(aux == L"../the lone long pier/Hanr/Hanalei Bay/Kauai/Hawaii");
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/3.cc
new file mode 100644 (file)
index 0000000..2ff6ef2
--- /dev/null
@@ -0,0 +1,74 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// Some more miscellaneous tests
+void
+test03()
+{
+  bool test = true;
+  const wchar_t* title01 = L"nine types of ambiguity";
+  const wchar_t* title02 = L"ultra";
+  std::wstring str01 = title01;
+  std::wstring str02 = title02;
+
+  str01.replace(0, 4, str02);
+  VERIFY(str01 == L"ultra types of ambiguity");
+
+  str01.replace(15, 9, str02, 2, 2);
+  VERIFY(str01 == L"ultra types of tr");
+
+  str01 = title01;
+  str02.replace(0, 0, str01, 0, std::wstring::npos);
+  VERIFY(str02 == L"nine types of ambiguityultra");
+
+  str02.replace(11, 2, title02, 5);
+  VERIFY(str02 == L"nine types ultra ambiguityultra");
+
+  str02.replace(11, 5, title01, 2);
+  VERIFY(str02 == L"nine types ni ambiguityultra");
+
+  str01.replace(str01.size(), 0, title02);
+  VERIFY(str01 == L"nine types of ambiguityultra");
+  
+  str01 = title01;
+  str02 = title02;
+  str01.replace(str01.begin(), str01.end(), str02);
+  VERIFY(str01 == L"ultra");
+
+  str01.replace(str01.begin(), str01.begin(), title01, 4);
+  VERIFY(str01 == L"nineultra");
+
+  str01.replace(str01.end(), str01.end(), title01 + 5, 5);
+  VERIFY(str01 == L"nineultratypes");
+  
+  str01.replace(str01.begin(), str01.end(), title02);
+  VERIFY(str01 == L"ultra");
+}
+
+int main()
+{ 
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/4.cc
new file mode 100644 (file)
index 0000000..bc827d0
--- /dev/null
@@ -0,0 +1,67 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// Some more tests for 
+// template<typename InputIter>
+//   wstring& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
+void
+test04()
+{
+  bool test = true;
+  std::wstring str01 = L"geogaddi";
+  std::wstring str02;
+
+  typedef std::wstring::iterator iterator;
+  typedef std::wstring::const_iterator const_iterator;
+  
+  iterator it1 = str01.begin();
+  iterator it2 = str01.end();
+  str02.replace(str02.begin(), str02.end(), it1, it2);
+  VERIFY(str02 == L"geogaddi");
+
+  str02 = L"boards";
+  const_iterator c_it1 = str01.begin();
+  const_iterator c_it2 = str01.end();
+  str02.replace(str02.begin(), str02.end(), c_it1, c_it2);
+  VERIFY(str02 == L"geogaddi");
+
+  str02 = L"boards";
+  const wchar_t* c_ptr1 = str01.c_str();
+  const wchar_t* c_ptr2 = str01.c_str() + 8;
+  str02.replace(str02.begin(), str02.end(), c_ptr1, c_ptr2);
+  VERIFY(str02 == L"geogaddi");
+
+  str02 = L"boards";
+  wchar_t* ptr1 = &*str01.begin();
+  wchar_t* ptr2 = &*str01.end();
+  str02.replace(str02.begin(), str02.end(), ptr1, ptr2);
+  VERIFY(str02 == L"geogaddi");
+}
+
+int main()
+{ 
+  test04();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/5.cc b/libstdc++-v3/testsuite/21_strings/basic_string/replace/wchar_t/5.cc
new file mode 100644 (file)
index 0000000..f54cfb9
--- /dev/null
@@ -0,0 +1,43 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// We wrongly used __n1 instead of __foldn1 in the length_error
+// check at the beginning of replace(__pos, __n1, __s, __n2)
+void
+test05()
+{
+  bool test = true;
+  std::wstring str01 = L"londinium";
+  std::wstring str02 = L"cydonia";
+
+  str01.replace(0, 20, str02.c_str(), 3);
+  VERIFY(str01 == L"cyd");
+}
+
+int main()
+{ 
+  test05();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
 
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -19,7 +19,6 @@
 // USA.
 
 #include <string>
-#include <stdexcept>
 #include <testsuite_hooks.h>
 
 // 21.3.6.2 basic_string rfind
@@ -91,35 +90,8 @@ bool test01(void)
   return test;
 }
 
-// 21.3.6.4 basic_string::find_last_of
-bool test02()
-{
-  bool test = true;
-
-  // test find_last_of
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-  return test;
-}
-
-// 21.3.6.6 basic_string::find_last_not_of
-bool test03()
-{
-  bool test = true;
-
-  // test find_last_not_of
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-  return test;
-}
 int main()
 {
   test01();
-  test02();
-  test03();
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc
new file mode 100644 (file)
index 0000000..9b905df
--- /dev/null
@@ -0,0 +1,41 @@
+// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.4 basic_string::find_last_of
+bool test02()
+{
+  bool test = true;
+
+  // test find_last_of
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc
new file mode 100644 (file)
index 0000000..d8b6c81
--- /dev/null
@@ -0,0 +1,40 @@
+// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.6 basic_string::find_last_not_of
+bool test03()
+{
+  bool test = true;
+
+  // test find_last_not_of
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+int main()
+{
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..9681bf4
--- /dev/null
@@ -0,0 +1,97 @@
+// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.2 basic_string rfind
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const wchar_t str_lit01[] = L"mave";
+  const std::wstring str01(L"mavericks, santa cruz");
+  std::wstring str02(str_lit01);
+  std::wstring str03(L"s, s");
+  std::wstring str04;
+
+  // size_type rfind(const wstring&, size_type pos = 0) const;
+  csz01 = str01.rfind(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str01, 4);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str02,3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str02);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str03);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.rfind(str03, 3);
+  VERIFY( csz01 == npos );
+  csz01 = str01.rfind(str03, 12);
+  VERIFY( csz01 == 8 );
+
+  // An empty string consists of no characters
+  // therefore it should be found at every point in a string,
+  // except beyond the end
+  csz01 = str01.rfind(str04, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str04, 5);
+  VERIFY( csz01 == 5 );
+  csz01 = str01.rfind(str04, str01.size());
+  VERIFY( csz01 == str01.size() );
+  csz01 = str01.rfind(str04, str01.size()+1);
+  VERIFY( csz01 == str01.size() );
+
+  // size_type rfind(const wchar_t* s, size_type pos, size_type n) const;
+  csz01 = str01.rfind(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str_lit01, 3, 0);
+  VERIFY( csz01 == 3 );
+
+  // size_type rfind(const wchar_t* s, size_type pos = 0) const;
+  csz01 = str01.rfind(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.rfind(str_lit01, 3);
+  VERIFY( csz01 == 0 );
+
+  // size_type rfind(wchar_t c, size_type pos = 0) const;
+  csz01 = str01.rfind(L'z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+  csz01 = str01.rfind(L'/');
+  VERIFY( csz01 == npos );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..9b905df
--- /dev/null
@@ -0,0 +1,41 @@
+// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.4 basic_string::find_last_of
+bool test02()
+{
+  bool test = true;
+
+  // test find_last_of
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc
new file mode 100644 (file)
index 0000000..d8b6c81
--- /dev/null
@@ -0,0 +1,40 @@
+// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.6 basic_string::find_last_not_of
+bool test03()
+{
+  bool test = true;
+
+  // test find_last_not_of
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+int main()
+{
+  test03();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-06-10 bkoz
 
-// Copyright (C) 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/substr/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/substr/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..843ebb6
--- /dev/null
@@ -0,0 +1,80 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.7 basic_string::substr
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  typedef std::wstring::const_reference cref;
+  typedef std::wstring::reference ref;
+  csize_type npos = std::wstring::npos;
+  csize_type csz01, csz02;
+
+  const wchar_t str_lit01[] = L"rockaway, pacifica";
+  const std::wstring str01(str_lit01);
+  std::wstring str02;
+
+  // basic_string<charT, _Traits, _Alloc>
+  //  substr(size_type pos = 0, size_type n = npos) const;
+  csz01 = str01.size();
+  str02 = str01.substr(0, 1);
+  VERIFY( str02 == L"r" );
+  str02 = str01.substr(10);
+  VERIFY( str02 == L"pacifica" );
+
+  try {
+    str02 = str01.substr(csz01 + 1);
+    VERIFY( false ); 
+  }
+  catch(std::out_of_range& fail) {
+    VERIFY( true );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+ try {
+    str02 = str01.substr(csz01);
+    VERIFY( str02.size() == 0 );
+  }
+  catch(std::out_of_range& fail) {
+    VERIFY( false );
+  }
+  catch(...) {
+    VERIFY( false );
+  }
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test01();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 2001-04-02  Benjamin Kosnik  <bkoz@redhat.com>
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -22,7 +22,6 @@
 
 #include <string>
 #include <cstring>
-#include <cwchar>
 
 void test01()
 {
@@ -64,28 +63,8 @@ void test01()
   v = std::memchr(v, 'a', 3);
 }
 
-void test02()
-{
-  using namespace std;
-
-  const char* ccarray1 = "san francisco roof garden inspectors";
-  const char* ccarray2 = "san francisco sunny-day park inspectors";
-  char carray[50];
-  strcpy(carray, ccarray1);
-  void* v = carray;
-  const void* cv = ccarray1;
-  memchr(cv, '/', 3);
-  strchr(ccarray1, '/');
-  strpbrk(ccarray1, ccarray2);
-  strrchr(ccarray1, 'c');
-  strstr(carray, carray);
-}
-
 int main()
 {
   test01();
-  test02();
-
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc
new file mode 100644 (file)
index 0000000..7ec0561
--- /dev/null
@@ -0,0 +1,48 @@
+// 2001-04-02  Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.4: null-terminiated sequence utilities
+
+#include <string>
+#include <cstring>
+
+void test02()
+{
+  using namespace std;
+
+  const char* ccarray1 = "san francisco roof garden inspectors";
+  const char* ccarray2 = "san francisco sunny-day park inspectors";
+  char carray[50];
+  strcpy(carray, ccarray1);
+  void* v = carray;
+  const void* cv = ccarray1;
+  memchr(cv, '/', 3);
+  strchr(ccarray1, '/');
+  strpbrk(ccarray1, ccarray2);
+  strrchr(ccarray1, 'c');
+  strstr(carray, carray);
+}
+
+int main()
+{
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..3ad6aed
--- /dev/null
@@ -0,0 +1,69 @@
+// 2001-04-02  Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.4: null-terminiated sequence utilities
+
+#include <string>
+#include <cstring>
+#include <cwchar>
+
+void test01()
+{
+  bool test = true;
+  wchar_t c = L'a';
+  const wchar_t cc = L'b';
+  wchar_t* c1 = &c;
+  const wchar_t* cc1 = &cc;
+  const wchar_t* ccarray1 = L"san francisco roof garden inspectors";
+  const wchar_t* ccarray2 = L"san francisco sunny-day park inspectors";
+  wchar_t carray[50];
+  std::wcscpy(carray, ccarray1);
+  
+  // const wchar_t* wcschr(const wchar_t* s, wchar_t c);
+  // wchar_t* wcschr(wchar_t* s, wchar_t c);
+  cc1 = std::wcschr(ccarray1, L'c');
+  c1 = std::wcschr(carray, L'c');
+
+  // const char* wcspbrk(const wchar_t* s1, const wchar_t* s2);
+  // char* wcspbrk(wchar_t* s1, const wchar_t* s2);
+  cc1 = std::wcspbrk(ccarray1, ccarray2);
+  c1 = std::wcspbrk(carray, ccarray2);
+
+  // const wchar_t* strrchr(const wchar_t* s, wchar_t c);
+  // wchar_t* strrchr(wchar_t* s, wchar_t c);
+  cc1 = std::wcsrchr(ccarray1, L'c');
+  c1 = std::wcsrchr(carray, L'c');
+
+  // const wchar_t* strstr(const wchar_t* s1, const wchar_t* s2);
+  // wchar_t* strstr(wchar_t* s1, const wchar_t* s2);
+  cc1 = std::wcsstr(ccarray1, ccarray2);
+  c1 = std::wcsstr(carray, carray);
+
+  // const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
+  // wchar_t* wmemchr(      wchar_t* s, wchar_t c, size_t n);
+  cc1 = std::wmemchr(ccarray1, L'a', 3);
+  c1 = std::wmemchr(carray, L'a', 3);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..3a8f77c
--- /dev/null
@@ -0,0 +1,47 @@
+// 2001-04-02  Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.4: null-terminiated sequence utilities
+
+#include <string>
+#include <cstring>
+#include <cwchar>
+
+void test02()
+{
+  using namespace std;
+
+  const wchar_t* ccarray1 = L"san francisco roof garden inspectors";
+  const wchar_t* ccarray2 = L"san francisco sunny-day park inspectors";
+  wchar_t carray[50];
+  wcscpy(carray, ccarray1);
+  wmemchr(ccarray1, L'/', 3);
+  wcschr(ccarray1, L'/');
+  wcspbrk(ccarray1, ccarray2);
+  wcsrchr(ccarray1, L'c');
+  wcsstr(carray, carray);
+}
+
+int main()
+{
+  test02();
+  return 0;
+}
@@ -1,6 +1,6 @@
 // 1999-06-03 bkoz
 
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 #include <string>
 #include <testsuite_hooks.h>
 
-int test01(void)
-{
-  bool test = true;
-  const std::string str_01("zuma beach");
-  const std::string str_02("montara and ocean beach");
-
-  // 21.1.1 character traits requirements
-
-  // Key for decoding what function signatures really mean:
-  // X                 == char_traits<_CharT>
-  // [c,d]     == _CharT
-  // [p,q]     == const _CharT*
-  // s                 == _CharT*
-  // [n,i,j]   == size_t
-  // f                 == X::int_type
-  // pos       == X::pos_type
-  // state     == X::state_type
-
-  // void X::assign(char c, char d)
-  // assigns c = d;
-  char c1 = 'z';
-  char c2 = 'u';
-  VERIFY( c1 != c2 );
-  std::char_traits<char>::assign(c1,c2);
-  VERIFY( c1 == 'u' );
-
-  // char* X::move(char* s, const char* p, size_t n)
-  // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
-  // correctly even where p is in [s, s + n), and yields s.
-  char array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h',  0};
-  const char str_lit1[] = "montara and ocean beach";
-  int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars
-  char array2[len];
-
-  VERIFY( str_lit1[0] == 'm' );
-  c1 = array2[0];
-  c2 = str_lit1[0];
-  char c3 = array2[1];
-  char c4 = str_lit1[1];
-  std::char_traits<char>::move(array2, str_lit1, 0);
-  VERIFY( array2[0] == c1 );
-  VERIFY( str_lit1[0] == c2 );
-  std::char_traits<char>::move(array2, str_lit1, 1);
-  VERIFY( array2[0] == c2 );
-  VERIFY( str_lit1[0] == c2 );
-  VERIFY( array2[1] == c3 );
-  VERIFY( str_lit1[1] == c4 );
-  std::char_traits<char>::move(array2, str_lit1, 2);
-  VERIFY( array2[0] == c2 );
-  VERIFY( str_lit1[0] == c2 );
-  VERIFY( array2[1] == c4 );
-  VERIFY( str_lit1[1] == c4 );
-
-  char* pc1 = array1 + 1;
-  c1 = pc1[0];
-  c2 = array1[0];
-  VERIFY( c1 != c2 );
-  char* pc2 = std::char_traits<char>::move(array1, pc1, 0);
-  c3 = pc1[0];
-  c4 = array1[0];
-  VERIFY( c1 == c3 );
-  VERIFY( c2 == c4 );
-  VERIFY( pc2 == array1 );
-
-  c1 = pc1[0];
-  c2 = array1[0];
-  char* pc3 = pc1;
-  pc2 = std::char_traits<char>::move(array1, pc1, 10);
-  c3 = pc1[0];
-  c4 = array1[0];
-  VERIFY( c1 != c3 ); // underlying char array changed.
-  VERIFY( c4 != c3 );
-  VERIFY( pc2 == array1 );
-  VERIFY( pc3 == pc1 ); // but pointers o-tay
-  c1 = *(str_01.data());
-  c2 = array1[0];
-  VERIFY( c1 != c2 );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-  return test;
-}
-
-#if _GLIBCPP_USE_WCHAR_T
-int test02(void)
+void test01(void)
 {
   bool test = true;
   const std::wstring str_01(L"zuma beach");
@@ -185,20 +100,10 @@ int test02(void)
   c1 = *(str_01.data());
   c2 = array1[0];
   VERIFY( c1 != c2 );
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-
-  return test;
 }
-#endif  //_GLIBCPP_USE_WCHAR_T
 
 int main()
 { 
   test01();
-#if _GLIBCPP_USE_WCHAR_T
-  test02();
-#endif
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..a93d2f5
--- /dev/null
@@ -0,0 +1,109 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.1.1 Characher traits requirements
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test02(void)
+{
+  bool test = true;
+  const std::wstring str_01(L"zuma beach");
+  const std::wstring str_02(L"montara and ocean beach");
+  // 21.1.1 character traits requirements
+
+  // Key for decoding what function signatures really mean:
+  // X                == char_traits<_CharT>
+  // [c,d]    == _CharT
+  // [p,q]    == const _CharT*
+  // s                == _CharT*
+  // [n,i,j]  == size_t
+  // f                == X::int_type
+  // pos      == X::pos_type
+  // state    == X::state_type
+
+  // void X::assign(wchar_t c, wchar_t d)
+  // assigns c = d;
+  wchar_t c1 = L'z';
+  wchar_t c2 = L'u';
+  VERIFY( c1 != c2 );
+  std::char_traits<wchar_t>::assign(c1,c2);
+  VERIFY( c1 == L'u' );
+
+  // char* X::move(char* s, const char* p, size_t n)
+  // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
+  // correctly even where p is in [s, s + n), and yields s.   
+  wchar_t array1[] = {L'z', L'u', L'm', L'a', L' ', L'b', L'e', L'a', L'c', L'h',  0};
+  const wchar_t str_lit1[] = L"montara and ocean beach";
+  int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars
+  wchar_t array2[len];
+
+  VERIFY( str_lit1[0] == 'm' );
+  c1 = array2[0];
+  c2 = str_lit1[0];
+  wchar_t c3 = array2[1];
+  wchar_t c4 = str_lit1[1];
+  std::char_traits<wchar_t>::move(array2, str_lit1, 0);
+  VERIFY( array2[0] == c1 );
+  VERIFY( str_lit1[0] == c2 );
+  std::char_traits<wchar_t>::move(array2, str_lit1, 1);
+  VERIFY( array2[0] == c2 );
+  VERIFY( str_lit1[0] == c2 );
+  VERIFY( array2[1] == c3 );
+  VERIFY( str_lit1[1] == c4 );
+  std::char_traits<wchar_t>::move(array2, str_lit1, 2);
+  VERIFY( array2[0] == c2 );
+  VERIFY( str_lit1[0] == c2 );
+  VERIFY( array2[1] == c4 );
+  VERIFY( str_lit1[1] == c4 );
+  wchar_t* pc1 = array1 + 1;
+  c1 = pc1[0];
+  c2 = array1[0];
+  VERIFY( c1 != c2 );
+  wchar_t* pc2 = std::char_traits<wchar_t>::move(array1, pc1, 0);
+  c3 = pc1[0];
+  c4 = array1[0];
+  VERIFY( c1 == c3 );
+  VERIFY( c2 == c4 );
+  VERIFY( pc2 == array1 );
+
+  c1 = pc1[0];
+  c2 = array1[0];
+  wchar_t* pc3 = pc1;
+  pc2 = std::char_traits<wchar_t>::move(array1, pc1, 10);
+  c3 = pc1[0];
+  c4 = array1[0];
+  VERIFY( c1 != c3 ); // underlying wchar_t array changed.
+  VERIFY( c4 != c3 );
+  VERIFY( pc2 == array1 );
+  VERIFY( pc3 == pc1 ); // but pointers o-tay
+  c1 = *(str_01.data());
+  c2 = array1[0];
+  VERIFY( c1 != c2 );
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
@@ -1,7 +1,7 @@
 // 2001-02-11 gdr
 // Origin: Craig Rodrigues <rodrigc@mediaone.net>
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/21_strings/replace.cc b/libstdc++-v3/testsuite/21_strings/replace.cc
deleted file mode 100644 (file)
index 6dc9ec6..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-// 1999-06-10 bkoz
-
-// Copyright (C) 1994, 1999, 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 21.3.5.6 basic_string::replace
-
-#include <string>
-#include <stdexcept>
-#include <testsuite_hooks.h>
-
-bool test01(void)
-{
-  bool test = true;
-  typedef std::string::size_type csize_type;
-  typedef std::string::const_reference cref;
-  typedef std::string::reference ref;
-  csize_type npos = std::string::npos;
-  csize_type csz01, csz02;
-
-  const char str_lit01[] = "ventura, california";
-  const std::string str01(str_lit01);
-  std::string str02("del mar, california");
-  std::string str03(" and ");
-  std::string str05;
-
-  // string& replace(size_type pos, size_type n, const string& string)
-  // string& replace(size_type pos1, size_type n1, const string& string,
-  //                 size_type pos2, size_type n2)
-  // string& replace(size_type pos, size_type n1, const char* s, size_type n2)
-  // string& replace(size_type pos, size_type n1, const char* s)
-  // string& replace(size_type pos, size_type n1, size_type n2, char c)
-  // string& replace(iterator it1, iterator it2, const string& str)
-  // string& replace(iterator it1, iterator it2, const chat* s, size_type n)
-  // string& replace(iterator it1, iterator it2, const chat* s)
-  // string& replace(iterator it1, iterator it2, size_type n, char c)
-  // template<typename InputIter>
-  //   string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
-
-  // with mods, from tstring.cc, from jason merrill, et. al.
-  std::string X = "Hello";
-  std::string x = X;
-
-  char ch = x[0];
-  VERIFY( ch == 'H' );
-
-  std::string z = x.substr(2, 3);
-  VERIFY( z == "llo" );
-
-  x.replace(2, 2, "r");
-  VERIFY( x == "Hero" );
-
-  x = X;
-  x.replace(0, 1, "j");
-  VERIFY( x == "jello" );
-
-  int ar[] = { 'H', 'e', 'l', 'l', 'o' };
-  x.replace(std::find(x.begin(), x.end(), 'l'), 
-           std::find(x.rbegin(), x.rend(), 'l').base(), ar, 
-           ar + sizeof(ar) / sizeof(ar[0]));
-  VERIFY( x == "jeHelloo" );
-
-#ifdef DEBUG_ASSERT
-  assert(test);
-#endif
-  return test;
-}
-
-void
-test02()
-{
-  bool test = true;
-  const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii";
-  std::string aux = strlit;
-  aux.replace(aux.begin()+5, aux.begin()+20,
-             aux.begin()+10, aux.begin()+15);
-  VERIFY(aux == "../thg piealei Bay/Kauai/Hawaii");
-  
-  aux = strlit;
-  aux.replace(aux.begin() + 10, aux.begin() + 15,
-             aux.begin() + 5, aux.begin() + 20);
-  VERIFY(aux == "../the lone long pier/Hanr/Hanalei Bay/Kauai/Hawaii");
-}
-
-// Some more miscellaneous tests
-void
-test03()
-{
-  bool test = true;
-  const char* title01 = "nine types of ambiguity";
-  const char* title02 = "ultra";
-  std::string str01 = title01;
-  std::string str02 = title02;
-
-  str01.replace(0, 4, str02);
-  VERIFY(str01 == "ultra types of ambiguity");
-
-  str01.replace(15, 9, str02, 2, 2);
-  VERIFY(str01 == "ultra types of tr");
-
-  str01 = title01;
-  str02.replace(0, 0, str01, 0, std::string::npos);
-  VERIFY(str02 == "nine types of ambiguityultra");
-
-  str02.replace(11, 2, title02, 5);
-  VERIFY(str02 == "nine types ultra ambiguityultra");
-
-  str02.replace(11, 5, title01, 2);
-  VERIFY(str02 == "nine types ni ambiguityultra");
-
-  str01.replace(str01.size(), 0, title02);
-  VERIFY(str01 == "nine types of ambiguityultra");
-  
-  str01 = title01;
-  str02 = title02;
-  str01.replace(str01.begin(), str01.end(), str02);
-  VERIFY(str01 == "ultra");
-
-  str01.replace(str01.begin(), str01.begin(), title01, 4);
-  VERIFY(str01 == "nineultra");
-
-  str01.replace(str01.end(), str01.end(), title01 + 5, 5);
-  VERIFY(str01 == "nineultratypes");
-  
-  str01.replace(str01.begin(), str01.end(), title02);
-  VERIFY(str01 == "ultra");
-}
-
-// Some more tests for 
-// template<typename InputIter>
-//   string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
-void
-test04()
-{
-  bool test = true;
-  std::string str01 = "geogaddi";
-  std::string str02;
-
-  typedef std::string::iterator iterator;
-  typedef std::string::const_iterator const_iterator;
-  
-  iterator it1 = str01.begin();
-  iterator it2 = str01.end();
-  str02.replace(str02.begin(), str02.end(), it1, it2);
-  VERIFY(str02 == "geogaddi");
-
-  str02 = "boards";
-  const_iterator c_it1 = str01.begin();
-  const_iterator c_it2 = str01.end();
-  str02.replace(str02.begin(), str02.end(), c_it1, c_it2);
-  VERIFY(str02 == "geogaddi");
-
-  str02 = "boards";
-  const char* c_ptr1 = str01.c_str();
-  const char* c_ptr2 = str01.c_str() + 8;
-  str02.replace(str02.begin(), str02.end(), c_ptr1, c_ptr2);
-  VERIFY(str02 == "geogaddi");
-
-  str02 = "boards";
-  char* ptr1 = &*str01.begin();
-  char* ptr2 = &*str01.end();
-  str02.replace(str02.begin(), str02.end(), ptr1, ptr2);
-  VERIFY(str02 == "geogaddi");
-}
-
-// We wrongly used __n1 instead of __foldn1 in the length_error
-// check at the beginning of replace(__pos, __n1, __s, __n2)
-void
-test05()
-{
-  bool test = true;
-  std::string str01 = "londinium";
-  std::string str02 = "cydonia";
-
-  str01.replace(0, 20, str02.c_str(), 3);
-  VERIFY(str01 == "cyd");
-}
-
-int main()
-{ 
-  test01();
-  test02();
-  test03();
-  test04();
-  test05();
-  return 0;
-}
index 1970ea0..d51a3d3 100644 (file)
@@ -173,7 +173,7 @@ namespace __gnu_cxx_test
        VERIFY( preLC_ALL == postLC_ALL );
       }
     else
-      throw environment_variable(string("LC_ALL for") + string(name));
+      throw environment_variable(string("LC_ALL for ") + string(name));
   }
   
   void