]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* tstring.cc (findtest): New fn.
authorBob Sidebotham <rns@fore.com>
Sun, 12 Jul 1998 02:20:22 +0000 (02:20 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 12 Jul 1998 02:20:22 +0000 (22:20 -0400)
From-SVN: r21071

libstdc++/tests/ChangeLog
libstdc++/tests/tstring.cc

index 66f0566b106226905f9ee4245221b7c41c699e5c..337b91aede6d583a3346ccd4a6c4c4828dc00e5e 100644 (file)
@@ -1,3 +1,7 @@
+1998-07-12  Bob Sidebotham <rns@fore.com>
+
+       * tstring.cc (findtest): New fn.
+
 1998-06-01  Jason Merrill  <jason@yorick.cygnus.com>
 
        * tlist.cc, tvector.cc, tmap.cc: Remove explicit instantiations.
index 14e8706e38808d9ae76a6592b22c892555e71235..833d3d964604fe112e20988051c4ea4a448cb6ca 100644 (file)
@@ -109,6 +109,53 @@ void cattest()
   assert(z == "Hello, world.");
 }
 
+void
+findtest()
+{
+  string x;
+  string::size_type pos;
+  pos = x.find_last_not_of('X');
+  assert(pos == string::npos);
+  pos = x.find_last_not_of("XYZ");
+  assert(pos == string::npos);
+
+  string y("a");
+  pos = y.find_last_not_of('X');
+  assert(pos == 0);
+  pos = y.find_last_not_of('a');
+  assert(pos == string::npos);
+  pos = y.find_last_not_of("XYZ");
+  assert(pos == 0);
+  pos = y.find_last_not_of("a");
+  assert(pos == string::npos);
+
+  string z("ab");
+  pos = z.find_last_not_of('X');
+  assert(pos == 1);
+  pos = z.find_last_not_of("XYZ");
+  assert(pos == 1);
+  pos = z.find_last_not_of('b');
+  assert(pos == 0);
+  pos = z.find_last_not_of("Xb");
+  assert(pos == 0);
+  pos = z.find_last_not_of("Xa");
+  assert(pos == 1);
+  pos = z.find_last_of("ab");
+  assert(pos == 1);
+  pos = z.find_last_of("Xa");
+  assert(pos == 0);
+  pos = z.find_last_of("Xb");
+  assert(pos == 1);
+  pos = z.find_last_of("XYZ");
+  assert(pos == string::npos);
+  pos = z.find_last_of('a');
+  assert(pos == 0);
+  pos = z.find_last_of('b');
+  assert(pos == 1);
+  pos = z.find_last_of('X');
+  assert(pos == string::npos);
+}
+
 void comparetest()
 {  
   string x = X;
@@ -191,6 +238,7 @@ int main()
   decltest();
   cattest();
   comparetest();
+  findtest();
   substrtest();
   identitytest(X, X);
   identitytest(X, Y);