This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: string find


-----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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]