summaryrefslogtreecommitdiff
path: root/libstdc++/tests
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-12 02:20:22 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-12 02:20:22 +0000
commitd9dd3b949a3653402d46035685c7fa1c9a0f66eb (patch)
tree59a62a662630a19387af7a800b8f50cc1a579d8a /libstdc++/tests
parentb853285113f88f2e20a0fc94615905fc04d9a673 (diff)
downloadgcc-d9dd3b949a3653402d46035685c7fa1c9a0f66eb.tar.gz
* tstring.cc (findtest): New fn.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21071 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++/tests')
-rw-r--r--libstdc++/tests/ChangeLog4
-rw-r--r--libstdc++/tests/tstring.cc48
2 files changed, 52 insertions, 0 deletions
diff --git a/libstdc++/tests/ChangeLog b/libstdc++/tests/ChangeLog
index 66f0566b106..337b91aede6 100644
--- a/libstdc++/tests/ChangeLog
+++ b/libstdc++/tests/ChangeLog
@@ -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.
diff --git a/libstdc++/tests/tstring.cc b/libstdc++/tests/tstring.cc
index 14e8706e388..833d3d96460 100644
--- a/libstdc++/tests/tstring.cc
+++ b/libstdc++/tests/tstring.cc
@@ -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);