From: Benjamin Kosnik Date: Mon, 19 Jun 2000 20:05:48 +0000 (+0000) Subject: find.cc: Empty strings can be found at all positions. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7626c23703a32dcb9af3a59cd24e0eb79f10fe15;p=platform%2Fupstream%2Fgcc.git find.cc: Empty strings can be found at all positions. 2000-06-19 Anthony Williams * testsuite/21_strings/find.cc: Empty strings can be found at all positions. Modified. From-SVN: r34600 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a6bb649..cf0c133 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2000-06-19 Anthony Williams + + * testsuite/21_strings/find.cc: Empty strings can be found at all + positions. Modified. + +2000-06-19 Branko Cibej + + * testsuite/20_utilities: New directory. + * testsuite/20_utilities/auto_ptr.cc: New file. + 2000-06-14 Benjamin Kosnik * src/Makefile.am (string_sources): Simplify, assuming that with diff --git a/libstdc++-v3/testsuite/21_strings/find.cc b/libstdc++-v3/testsuite/21_strings/find.cc index 6459f99..6202d83 100644 --- a/libstdc++-v3/testsuite/21_strings/find.cc +++ b/libstdc++-v3/testsuite/21_strings/find.cc @@ -1,6 +1,6 @@ // 1999-06-09 bkoz -// Copyright (C) 1994, 1999 Free Software Foundation, Inc. +// Copyright (C) 1994, 1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -56,21 +56,16 @@ bool test01(void) test &= csz01 == 8; csz01 = str01.find(str03, 12); test &= csz01 == npos; - // It is implementation-defined if a given string contains an empty - // string. The only two times a char_type() (== empty string) ending - // element is required to be part of the string is on c_str() and - // operator[size()] const: the indeterminate, stored state of the - // string can vary, and not include a terminal char_type(). csz01 = str01.find(str04, 0); - test &= csz01 == npos || csz01 == str01.size(); + test &= csz01 == 0; csz01 = str01.find(str04, 5); - test &= csz01 == npos || csz01 == str01.size(); + test &= csz01 == 5; // size_type find(const char* s, size_type pos, size_type n) const; csz01 = str01.find(str_lit01, 0, 3); test &= csz01 == 0; csz01 = str01.find(str_lit01, 3, 0); - test &= csz01 == npos; + test &= csz01 == 3; // size_type find(const char* s, size_type pos = 0) const; csz01 = str01.find(str_lit01); @@ -107,15 +102,17 @@ bool test01(void) csz01 = str01.find_first_of(str05, 4); test &= csz01 == 4; - // It is implementation-defined if a given string contains an empty - // string. The only two times a char_type() (== empty string) ending - // element is required to be part of the string is on c_str() and - // operator[size()] const: the indeterminate, stored state of the - // string can vary, and not include a terminal char_type(). + // An empty string consists of no characters + // therefore it should be found at every point in a string, + // except beyond the end csz01 = str01.find_first_of(str04, 0); - test &= csz01 == npos || csz01 == str01.size(); + test &= csz01 == npos; csz01 = str01.find_first_of(str04, 5); - test &= csz01 == npos || csz01 == str01.size(); + test &= csz01 == npos; + csz01 = str01.find(str04, str01.size()); + test &= csz01 == str01.size(); + csz01 = str01.find(str04, str01.size() + 1); + test &= csz01 == npos; // size_type find_first_of(const char* s, size_type pos, size_type n) const; csz01 = str01.find_first_of(str_lit01, 0, 3);