Commit 7626c237 by Benjamin Kosnik

find.cc: Empty strings can be found at all positions.


2000-06-19  Anthony Williams  <anthony@anthonyw.cjb.net>

	* testsuite/21_strings/find.cc: Empty strings can be found at all
	positions. Modified.

From-SVN: r34600
parent 3ef9fe61
2000-06-19 Anthony Williams <anthony@anthonyw.cjb.net>
* testsuite/21_strings/find.cc: Empty strings can be found at all
positions. Modified.
2000-06-19 Branko Cibej <branko.cibej@hermes.si>
* testsuite/20_utilities: New directory.
* testsuite/20_utilities/auto_ptr.cc: New file.
2000-06-14 Benjamin Kosnik <bkoz@purist.soma.redhat.com> 2000-06-14 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* src/Makefile.am (string_sources): Simplify, assuming that with * src/Makefile.am (string_sources): Simplify, assuming that with
......
// 1999-06-09 bkoz // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -56,21 +56,16 @@ bool test01(void) ...@@ -56,21 +56,16 @@ bool test01(void)
test &= csz01 == 8; test &= csz01 == 8;
csz01 = str01.find(str03, 12); csz01 = str01.find(str03, 12);
test &= csz01 == npos; 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); csz01 = str01.find(str04, 0);
test &= csz01 == npos || csz01 == str01.size(); test &= csz01 == 0;
csz01 = str01.find(str04, 5); 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; // size_type find(const char* s, size_type pos, size_type n) const;
csz01 = str01.find(str_lit01, 0, 3); csz01 = str01.find(str_lit01, 0, 3);
test &= csz01 == 0; test &= csz01 == 0;
csz01 = str01.find(str_lit01, 3, 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; // size_type find(const char* s, size_type pos = 0) const;
csz01 = str01.find(str_lit01); csz01 = str01.find(str_lit01);
...@@ -107,15 +102,17 @@ bool test01(void) ...@@ -107,15 +102,17 @@ bool test01(void)
csz01 = str01.find_first_of(str05, 4); csz01 = str01.find_first_of(str05, 4);
test &= csz01 == 4; test &= csz01 == 4;
// It is implementation-defined if a given string contains an empty // An empty string consists of no characters
// string. The only two times a char_type() (== empty string) ending // therefore it should be found at every point in a string,
// element is required to be part of the string is on c_str() and // except beyond the end
// operator[size()] const: the indeterminate, stored state of the
// string can vary, and not include a terminal char_type().
csz01 = str01.find_first_of(str04, 0); csz01 = str01.find_first_of(str04, 0);
test &= csz01 == npos || csz01 == str01.size(); test &= csz01 == npos;
csz01 = str01.find_first_of(str04, 5); 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; // size_type find_first_of(const char* s, size_type pos, size_type n) const;
csz01 = str01.find_first_of(str_lit01, 0, 3); csz01 = str01.find_first_of(str_lit01, 0, 3);
......
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