This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: string find
- To: "Benjamin Kosnik" <bkoz at redhat dot com>
- Subject: Re: string find
- From: "Anthony Williams" <anthony_w dot geo at yahoo dot com>
- Date: Thu, 22 Jun 2000 11:15:10 +0100
- Cc: <libstdc++ at sourceware dot cygnus dot com>
- References: <Pine.SOL.3.91.1000620160939.23733A-100000@cse.cygnus.com>
- Reply-To: "Anthony Williams" <anthony at anthonyw dot cjb dot net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
find now works, the testsuite is incorrect (!)
Here is a patch to fix the testsuite, with a new check for find of an empty
string past the end. This test now passes again.
Index: testsuite/21_strings/find.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/testsuite/21_strings/find.cc,v
retrieving revision 1.3
diff -c -p -r1.3 find.cc
*** find.cc 2000/06/20 23:14:37 1.3
- --- find.cc 2000/06/22 10:14:05
*************** bool test01(void)
*** 65,70 ****
- --- 65,72 ----
csz01 = str01.find(str04, 5);
test &= csz01 == 5;
csz01 = str01.find(str04, str01.size());
+ test &= csz01 == str01.size();
+ csz01 = str01.find(str04, str01.size()+1);
test &= csz01 == npos;
// size_type find(const char* s, size_type pos, size_type n) const;
*************** bool test01(void)
*** 77,83 ****
csz01 = str01.find(str_lit01);
test &= csz01 == 0;
csz01 = str01.find(str_lit01, 3);
! test &= csz01 == 3; // zero length string should be found at pos
// size_type find(char c, size_type pos = 0) const;
csz01 = str01.find('z');
- --- 79,85 ----
csz01 = str01.find(str_lit01);
test &= csz01 == 0;
csz01 = str01.find(str_lit01, 3);
! test &= csz01 == npos;
// size_type find(char c, size_type pos = 0) const;
csz01 = str01.find('z');
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>
Comment: PGP Key at: http://i3.yimg.com/3/c7e5ee24/g/68fc2307.asc
iQA/AwUBOVHnLZvw+P4cG5rVEQIOMACghorUc3yuzIoSydG4L9R4hadzvPsAoJO8
vA2U4PPyW33M5JBWhOVuWIKR
=7Mo8
-----END PGP SIGNATURE-----
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com