OSDN Git Service

2003-03-24 Paolo Carlini <pcarlini@unitus.it>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Mar 2003 22:22:40 +0000 (22:22 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Mar 2003 22:22:40 +0000 (22:22 +0000)
* testsuite/21_strings/basic_string/find/char/1.cc: Remove
find_first_of, find_last_of and find_last_not_of tests.
* testsuite/21_strings/basic_string/find/char/2.cc: find_first_of
tests here, new file.
* testsuite/21_strings/basic_string/find/wchar_t/1.cc: Likewise, remove
wchar_t find_first_of, find_last_of and find_last_not_of tests.
* testsuite/21_strings/basic_string/find/wchar_t/2.cc: Likewise,
wchar_t find_first_of tests here, new file.
* testsuite/21_strings/basic_string/rfind/char/2.cc: find_last_of tests
here.
* testsuite/21_strings/basic_string/rfind/char/3.cc: find_last_not_of
tests here.
* testsuite/21_strings/basic_string/rfind/wchar_t/2.cc: likewise,
wchar_t find_last_of tests here.
* testsuite/21_strings/basic_string/rfind/wchar_t/3.cc: likewise,
wchar_t find_last_not_of tests here.

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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/21_strings/basic_string/find/char/1.cc
libstdc++-v3/testsuite/21_strings/basic_string/find/char/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/1.cc
libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/2.cc
libstdc++-v3/testsuite/21_strings/basic_string/rfind/char/3.cc
libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/2.cc
libstdc++-v3/testsuite/21_strings/basic_string/rfind/wchar_t/3.cc

index fe4ebf4..ca9b147 100644 (file)
@@ -1,3 +1,22 @@
+2003-03-24  Paolo Carlini  <pcarlini@unitus.it>
+
+       * testsuite/21_strings/basic_string/find/char/1.cc: Remove
+       find_first_of, find_last_of and find_last_not_of tests.
+       * testsuite/21_strings/basic_string/find/char/2.cc: find_first_of
+       tests here, new file.
+       * testsuite/21_strings/basic_string/find/wchar_t/1.cc: Likewise,
+       remove wchar_t find_first_of, find_last_of and find_last_not_of tests.
+       * testsuite/21_strings/basic_string/find/wchar_t/2.cc: Likewise,
+       wchar_t find_first_of tests here, new file.
+       * testsuite/21_strings/basic_string/rfind/char/2.cc: find_last_of
+       tests here.
+       * testsuite/21_strings/basic_string/rfind/char/3.cc: find_last_not_of
+       tests here.
+       * testsuite/21_strings/basic_string/rfind/wchar_t/2.cc: likewise,
+       wchar_t find_last_of tests here.
+       * testsuite/21_strings/basic_string/rfind/wchar_t/3.cc: likewise,
+       wchar_t find_last_not_of tests here.    
+
 2003-03-22  Loren J. Rittle  <ljrittle@acm.org>
 
        * config/os/hpux/ctype_noninline.h (ctype<char>::classic_table):
index e59f577..561053c 100644 (file)
@@ -21,7 +21,6 @@
 // 21.3.6.1 basic_string find
 
 #include <string>
-#include <stdexcept>
 #include <testsuite_hooks.h>
 
 bool test01(void)
@@ -86,105 +85,6 @@ bool test01(void)
   csz01 = str01.find('/');
   VERIFY( csz01 == npos );
    
-  // size_type find_first_of(const string&, size_type pos = 0) const;
-  std::string str05("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 char* 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(char c, size_type pos = 0) const;
-  csz01 = str01.find_first_of('z');
-  csz02 = str01.size() - 1;
-  VERIFY( csz01 == csz02 );
-
-  // size_type find_last_of(const string& str, size_type pos = 0) const;
-  // size_type find_last_of(const char* s, size_type pos, size_type n) const;
-  // size_type find_last_of(const char* s, size_type pos = 0) const;
-  // size_type find_last_of(char c, size_type pos = 0) const;
-
-#if 1
-// from tstring.cc, from jason merrill, et. al.
-  std::string x;
-  std::string::size_type pos;
-  pos = x.find_last_not_of('X');
-  VERIFY( pos == npos );
-  pos = x.find_last_not_of("XYZ");
-  VERIFY( pos == npos );
-
-  std::string y("a");
-  pos = y.find_last_not_of('X');
-  VERIFY( pos == 0 );
-  pos = y.find_last_not_of('a');
-  VERIFY( pos == npos );
-  pos = y.find_last_not_of("XYZ");
-  VERIFY( pos == 0 );
-  pos = y.find_last_not_of("a");
-  VERIFY( pos == npos );
-
-  std::string z("ab");
-  pos = z.find_last_not_of('X');
-  VERIFY( pos == 1 );
-  pos = z.find_last_not_of("XYZ");
-  VERIFY( pos == 1 );
-  pos = z.find_last_not_of('b');
-  VERIFY( pos == 0 );
-  pos = z.find_last_not_of("Xb");
-  VERIFY( pos == 0 );
-  pos = z.find_last_not_of("Xa");
-  VERIFY( pos == 1 );
-  pos = z.find_last_of("ab");
-  VERIFY( pos == 1 );
-  pos = z.find_last_of("Xa");
-  VERIFY( pos == 0 );
-  pos = z.find_last_of("Xb");
-  VERIFY( pos == 1 );
-  pos = z.find_last_of("XYZ");
-  VERIFY( pos == std::string::npos );
-  pos = z.find_last_of('a');
-  VERIFY( pos == 0 );
-  pos = z.find_last_of('b');
-  VERIFY( pos == 1 );
-  pos = z.find_last_of('X');
-  VERIFY( pos == std::string::npos );
-#endif
-
 #ifdef DEBUG_ASSERT
   assert(test);
 #endif
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/char/2.cc
new file mode 100644 (file)
index 0000000..abc35e2
--- /dev/null
@@ -0,0 +1,97 @@
+// 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.3 basic_string find_first_of
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+  bool test = true;
+  typedef std::string::size_type csize_type;
+  csize_type npos = std::string::npos;
+  csize_type csz01, csz02;
+
+  const char str_lit01[] = "mave";
+  const std::string str01("mavericks, santa cruz");
+  std::string str02(str_lit01);
+  std::string str03("s, s");
+  std::string str04;
+
+  // size_type find_first_of(const string&, size_type pos = 0) const;
+  std::string str05("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 char* 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(char c, size_type pos = 0) const;
+  csz01 = str01.find_first_of('z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
index 4cd643e..ecf3182 100644 (file)
@@ -21,7 +21,6 @@
 // 21.3.6.1 basic_string find
 
 #include <string>
-#include <stdexcept>
 #include <testsuite_hooks.h>
 
 bool test01(void)
@@ -85,105 +84,6 @@ bool test01(void)
   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);
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/find/wchar_t/2.cc
new file mode 100644 (file)
index 0000000..8ae592d
--- /dev/null
@@ -0,0 +1,97 @@
+// 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.3 basic_string find_first_of
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+  bool test = true;
+  typedef std::wstring::size_type csize_type;
+  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_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 wchar_t* 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 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+  return test;
+}
+
+int main()
+{ 
+  test02();
+  return 0;
+}
index 9b905df..30e40a9 100644 (file)
@@ -1,4 +1,4 @@
-// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+// from tstring.cc, from jason merrill, et. al.
 
 // Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 //
 bool test02()
 {
   bool test = true;
-
-  // test find_last_of
+  std::string z("ab");
+  std::string::size_type pos;
+  pos = z.find_last_of("ab");
+  VERIFY( pos == 1 );
+  pos = z.find_last_of("Xa");
+  VERIFY( pos == 0 );
+  pos = z.find_last_of("Xb");
+  VERIFY( pos == 1 );
+  pos = z.find_last_of("XYZ");
+  VERIFY( pos == std::string::npos );
+  pos = z.find_last_of('a');
+  VERIFY( pos == 0 );
+  pos = z.find_last_of('b');
+  VERIFY( pos == 1 );
+  pos = z.find_last_of('X');
+  VERIFY( pos == std::string::npos );
 
 #ifdef DEBUG_ASSERT
   assert(test);
index d8b6c81..aeb132b 100644 (file)
@@ -1,4 +1,4 @@
-// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+// from tstring.cc, from jason merrill, et. al.
 
 // Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 //
 bool test03()
 {
   bool test = true;
+  typedef std::string::size_type csize_type;
+  std::string::size_type pos;
+  csize_type npos = std::string::npos;
 
-  // test find_last_not_of
+  std::string x;
+  pos = x.find_last_not_of('X');
+  VERIFY( pos == npos );
+  pos = x.find_last_not_of("XYZ");
+  VERIFY( pos == npos );
+
+  std::string y("a");
+  pos = y.find_last_not_of('X');
+  VERIFY( pos == 0 );
+  pos = y.find_last_not_of('a');
+  VERIFY( pos == npos );
+  pos = y.find_last_not_of("XYZ");
+  VERIFY( pos == 0 );
+  pos = y.find_last_not_of("a");
+  VERIFY( pos == npos );
+
+  std::string z("ab");
+  pos = z.find_last_not_of('X');
+  VERIFY( pos == 1 );
+  pos = z.find_last_not_of("XYZ");
+  VERIFY( pos == 1 );
+  pos = z.find_last_not_of('b');
+  VERIFY( pos == 0 );
+  pos = z.find_last_not_of("Xb");
+  VERIFY( pos == 0 );
+  pos = z.find_last_not_of("Xa");
+  VERIFY( pos == 1 );
 
 #ifdef DEBUG_ASSERT
   assert(test);
index 9b905df..587b19b 100644 (file)
@@ -1,4 +1,4 @@
-// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+// from tstring.cc, from jason merrill, et. al.
 
 // Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 //
 bool test02()
 {
   bool test = true;
-
-  // test find_last_of
+  std::wstring::size_type pos;
+  std::wstring z(L"ab");
+  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 );
 
 #ifdef DEBUG_ASSERT
   assert(test);
index d8b6c81..1bfd1eb 100644 (file)
@@ -1,4 +1,4 @@
-// 2000-06-22 -=dbv=-  (shamelessy copied from bkoz' find.cc)
+// from tstring.cc, from jason merrill, et. al.
 
 // Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 //
 bool test03()
 {
   bool test = true;
+  typedef std::wstring::size_type csize_type;
+  std::wstring::size_type pos;
+  csize_type npos = std::wstring::npos;
 
-  // test find_last_not_of
+  std::wstring x;
+  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 );
 
 #ifdef DEBUG_ASSERT
   assert(test);