Commit b0e7d996 by Bob Sidebotham Committed by Jason Merrill

* tstring.cc (findtest): New fn.

From-SVN: r21071
parent e70b4d8f
1998-07-12 Bob Sidebotham <rns@fore.com>
* tstring.cc (findtest): New fn.
1998-06-01 Jason Merrill <jason@yorick.cygnus.com> 1998-06-01 Jason Merrill <jason@yorick.cygnus.com>
* tlist.cc, tvector.cc, tmap.cc: Remove explicit instantiations. * tlist.cc, tvector.cc, tmap.cc: Remove explicit instantiations.
......
...@@ -109,6 +109,53 @@ void cattest() ...@@ -109,6 +109,53 @@ void cattest()
assert(z == "Hello, world."); 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() void comparetest()
{ {
string x = X; string x = X;
...@@ -191,6 +238,7 @@ int main() ...@@ -191,6 +238,7 @@ int main()
decltest(); decltest();
cattest(); cattest();
comparetest(); comparetest();
findtest();
substrtest(); substrtest();
identitytest(X, X); identitytest(X, X);
identitytest(X, Y); identitytest(X, Y);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment