diff options
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access')
12 files changed, 0 insertions, 803 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc deleted file mode 100644 index b45db4ccb..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/1.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.4 basic_string element access - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test __attribute__((unused)) = true; - typedef std::string::size_type csize_type; - typedef std::string::const_reference cref; - typedef std::string::reference ref; - csize_type csz01, csz02; - - const std::string str01("tamarindo, costa rica"); - std::string str02("41st street beach, capitola, california"); - std::string str03; - - // const_reference operator[] (size_type pos) const; - csz01 = str01.size(); - cref cref1 = str01[csz01 - 1]; - VERIFY( cref1 == 'a' ); - cref cref2 = str01[csz01]; - VERIFY( cref2 == char() ); - - // reference operator[] (size_type pos); - csz02 = str02.size(); - ref ref1 = str02[csz02 - 1]; - VERIFY( ref1 == 'a' ); - ref ref2 = str02[1]; - VERIFY( ref2 == '1' ); - - // const_reference at(size_type pos) const; - csz01 = str01.size(); - cref cref3 = str01.at(csz01 - 1); - VERIFY( cref3 == 'a' ); - try { - str01.at(csz01); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // reference at(size_type pos); - csz01 = str02.size(); - ref ref3 = str02.at(csz02 - 1); - VERIFY( ref3 == 'a' ); - try { - str02.at(csz02); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc deleted file mode 100644 index 9626b535f..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/2.cc +++ /dev/null @@ -1,110 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do a quick sanity check on known problems with element access and -// ref-counted strings. These should all pass, regardless of the -// underlying string implementation, of course. -bool test01(void) -{ - bool test __attribute__((unused)) = true; - typedef std::string::size_type csize_type; - typedef std::string::iterator siterator; - typedef std::string::reverse_iterator sriterator; - csize_type csz01, csz02; - siterator it1; - sriterator rit1; - - std::string str01("montara beach, half moon bay"); - const std::string str02("ocean beach, san francisco"); - std::string str03; - - // 21.3 p 5 - - // References, pointers, and iterators referring to the elements of - // a basic_string may be invalidated by the following uses of that - // basic_string object: - - // ... - - // Susequent to any of the above uses except the forms of insert() - // and erase() which return iterators, the first call to non-const - // member functions operator[](), at(), begin(), rbegin(), end(), or - // rend() - - str03 = str01; - it1 = str01.begin(); - *it1 = 'x'; - VERIFY( str01[0] == 'x' ); - VERIFY( str03[0] == 'm' ); - - str03 = str01; - csz01 = str01.size(); - rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ... - *rit1 = 'z'; // ... but it's taken care of here - VERIFY( str01[csz01 - 1] == 'z' ); - VERIFY( str03[csz01 - 1] == 'y' ); - - str03 = str01; - csz01 = str01.size(); - std::string::reference r1 = str01.at(csz01 - 2); - VERIFY( str03 == str01 ); - r1 = 'd'; - VERIFY( str01[csz01 - 2] == 'd' ); - VERIFY( str03[csz01 - 2] == 'a' ); - - str03 = str01; - csz01 = str01.size(); - std::string::reference r2 = str01[csz01 - 3]; - VERIFY( str03 == str01 ); - r2 = 'w'; - VERIFY( str01[csz01 - 3] == 'w' ); - VERIFY( str03[csz01 - 3] == 'b' ); - - str03 = str01; - csz02 = str01.size(); - it1 = str01.end(); - VERIFY( str03 == str01 ); - --it1; - *it1 = 'q'; - VERIFY( str01[csz02 - 1] == 'q' ); - VERIFY( str03[csz02 - 1] == 'z' ); - - str03 = str01; - rit1 = str01.rend(); - VERIFY( str03 == str01 ); - --rit1; - *rit1 = 'p'; - VERIFY( str01[0] == 'p' ); - VERIFY( str03[0] == 'x' ); - - // need to also test for const begin/const end - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/21674.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/21674.cc deleted file mode 100644 index 0c318bcf7..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/21674.cc +++ /dev/null @@ -1,32 +0,0 @@ -// { dg-do run { xfail { ! { *-*-darwin* } } } } -// { dg-require-debug-mode "" } -// { dg-options "-O0 -D_GLIBCXX_DEBUG" } - -// Copyright (C) 2005, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - - -#include <string> - -// libstdc++/21674 -// NB: Should work without any inlining or optimizations (ie. -O0). -int main() -{ - typedef std::string string_type; - string_type s; - s[1]; // abort -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc deleted file mode 100644 index 385ef28ba..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/3.cc +++ /dev/null @@ -1,83 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do another sanity check, this time for member functions that return -// iterators, namely insert and erase. -bool test02(void) -{ - bool test __attribute__((unused)) = true; - typedef std::string::size_type csize_type; - typedef std::string::iterator siterator; - typedef std::string::reverse_iterator sriterator; - siterator it1; - sriterator rit1; - - const std::string str01("its beach, santa cruz"); - - std::string str02 = str01; - std::string str05 = str02; // optional, so that begin below causes a mutate - std::string::iterator p = str02.insert(str02.begin(), ' '); - std::string str03 = str02; - VERIFY( str03 == str02 ); - *p = '!'; - VERIFY( *str03.c_str() == ' ' ); - str03[0] = '@'; - VERIFY( str02[0] == '!' ); - VERIFY( *p == '!' ); - VERIFY( str02 != str05 ); - VERIFY( str02 != str03 ); - - std::string str10 = str01; - std::string::iterator p2 = str10.insert(str10.begin(), 'a'); - std::string str11 = str10; - *p2 = 'e'; - VERIFY( str11 != str10 ); - - std::string str06 = str01; - std::string str07 = str06; // optional, so that begin below causes a mutate - p = str06.erase(str06.begin()); - std::string str08 = str06; - VERIFY( str08 == str06 ); - *p = '!'; - VERIFY( *str08.c_str() == 't' ); - str08[0] = '@'; - VERIFY( str06[0] == '!' ); - VERIFY( *p == '!' ); - VERIFY( str06 != str07 ); - VERIFY( str06 != str08 ); - - std::string str12 = str01; - p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1); - std::string str13 = str12; - *p2 = 'e'; - VERIFY( str12 != str13 ); - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/4.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/4.cc deleted file mode 100644 index 5adb1583a..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/4.cc +++ /dev/null @@ -1,49 +0,0 @@ -// 2004-01-18 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.4 basic_string element access - -#include <string> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2004-01/msg00184.html -void test01() -{ - bool test __attribute__((unused)) = true; - using namespace std; - - for (int i = 0; i < 2000; ++i) - { - string str_01; - - for (int j = 0; j < i; ++j) - str_01 += 'a'; - - str_01.reserve(i + 10); - - const string str_02(str_01); - VERIFY( str_02[i] == '\0' ); - } -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/empty.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/empty.cc deleted file mode 100644 index af0c7ff41..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/empty.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2004, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. -// - -#include <string> -#include <testsuite_hooks.h> - -// as per 21.3.4 -int main() -{ - bool test __attribute__((unused)) = true; - - { - std::string empty; - char c = empty[0]; - VERIFY( c == char() ); - } - - { - const std::string empty; - char c = empty[0]; - VERIFY( c == char() ); - } - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc deleted file mode 100644 index 13dac274b..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/1.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.4 basic_string element access - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -bool test01(void) -{ - bool test __attribute__((unused)) = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::const_reference cref; - typedef std::wstring::reference ref; - csize_type csz01, csz02; - - const std::wstring str01(L"tamarindo, costa rica"); - std::wstring str02(L"41st street beach, capitola, california"); - std::wstring str03; - - // const_reference operator[] (size_type pos) const; - csz01 = str01.size(); - cref cref1 = str01[csz01 - 1]; - VERIFY( cref1 == L'a' ); - cref cref2 = str01[csz01]; - VERIFY( cref2 == wchar_t() ); - - // reference operator[] (size_type pos); - csz02 = str02.size(); - ref ref1 = str02[csz02 - 1]; - VERIFY( ref1 == L'a' ); - ref ref2 = str02[1]; - VERIFY( ref2 == L'1' ); - - // const_reference at(size_type pos) const; - csz01 = str01.size(); - cref cref3 = str01.at(csz01 - 1); - VERIFY( cref3 == L'a' ); - try { - str01.at(csz01); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - - // reference at(size_type pos); - csz01 = str02.size(); - ref ref3 = str02.at(csz02 - 1); - VERIFY( ref3 == L'a' ); - try { - str02.at(csz02); - VERIFY( false ); // Should not get here, as exception thrown. - } - catch(std::out_of_range& fail) { - VERIFY( true ); - } - catch(...) { - VERIFY( false ); - } - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc deleted file mode 100644 index 6ffece7da..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/2.cc +++ /dev/null @@ -1,111 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do a quick sanity check on known problems with element access and -// ref-counted strings. These should all pass, regardless of the -// underlying string implementation, of course. -bool test01(void) -{ - bool test __attribute__((unused)) = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::iterator siterator; - typedef std::wstring::reverse_iterator sriterator; - csize_type csz01, csz02; - siterator it1; - sriterator rit1; - - std::wstring str01(L"montara beach, half moon bay"); - const std::wstring str02(L"ocean beach, san francisco"); - std::wstring str03; - - // 21.3 p 5 - - // References, pointers, and iterators referring to the elements of - // a basic_string may be invalidated by the following uses of that - // basic_string object: - - // ... - - // Susequent to any of the above uses except the forms of insert() - // and erase() which return iterators, the first call to non-const - // member functions operator[](), at(), begin(), rbegin(), end(), or - // rend() - - str03 = str01; - it1 = str01.begin(); - *it1 = L'x'; - VERIFY( str01[0] == L'x' ); - VERIFY( str03[0] == L'm' ); - - str03 = str01; - csz01 = str01.size(); - rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ... - *rit1 = L'z'; // ... but it's taken care of here - VERIFY( str01[csz01 - 1] == L'z' ); - VERIFY( str03[csz01 - 1] == L'y' ); - - str03 = str01; - csz01 = str01.size(); - std::wstring::reference r1 = str01.at(csz01 - 2); - VERIFY( str03 == str01 ); - r1 = L'd'; - VERIFY( str01[csz01 - 2] == L'd' ); - VERIFY( str03[csz01 - 2] == L'a' ); - - str03 = str01; - csz01 = str01.size(); - std::wstring::reference r2 = str01[csz01 - 3]; - VERIFY( str03 == str01 ); - r2 = L'w'; - VERIFY( str01[csz01 - 3] == L'w' ); - VERIFY( str03[csz01 - 3] == L'b' ); - - str03 = str01; - csz02 = str01.size(); - it1 = str01.end(); - VERIFY( str03 == str01 ); - --it1; - *it1 = L'q'; - VERIFY( str01[csz02 - 1] == L'q' ); - VERIFY( str03[csz02 - 1] == L'z' ); - - str03 = str01; - rit1 = str01.rend(); - VERIFY( str03 == str01 ); - --rit1; - *rit1 = L'p'; - VERIFY( str01[0] == L'p' ); - VERIFY( str03[0] == L'x' ); - - // need to also test for const begin/const end - VERIFY(test); - return test; -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc deleted file mode 100644 index ea0cfd7a0..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc +++ /dev/null @@ -1,32 +0,0 @@ -// { dg-do run { xfail { ! { *-*-darwin* } } } } -// { dg-require-debug-mode "" } -// { dg-options "-O0 -D_GLIBCXX_DEBUG" } - -// Copyright (C) 2005, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - - -#include <string> - -// libstdc++/21674 -// NB: Should work without any inlining or optimizations (ie. -O0). -int main() -{ - typedef std::wstring string_type; - string_type s; - s[1]; // abort -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc deleted file mode 100644 index 266f03736..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/3.cc +++ /dev/null @@ -1,83 +0,0 @@ -// 1999-06-08 bkoz - -// Copyright (C) 1999, 2003, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3 template class basic_string - -#include <string> -#include <stdexcept> -#include <testsuite_hooks.h> - -// Do another sanity check, this time for member functions that return -// iterators, namely insert and erase. -bool test02(void) -{ - bool test __attribute__((unused)) = true; - typedef std::wstring::size_type csize_type; - typedef std::wstring::iterator siterator; - typedef std::wstring::reverse_iterator sriterator; - siterator it1; - sriterator rit1; - - const std::wstring str01(L"its beach, santa cruz"); - - std::wstring str02 = str01; - std::wstring str05 = str02; // optional, so that begin below causes a mutate - std::wstring::iterator p = str02.insert(str02.begin(), L' '); - std::wstring str03 = str02; - VERIFY( str03 == str02 ); - *p = L'!'; - VERIFY( *str03.c_str() == L' ' ); - str03[0] = L'@'; - VERIFY( str02[0] == L'!' ); - VERIFY( *p == L'!' ); - VERIFY( str02 != str05 ); - VERIFY( str02 != str03 ); - - std::wstring str10 = str01; - std::wstring::iterator p2 = str10.insert(str10.begin(), L'a'); - std::wstring str11 = str10; - *p2 = L'e'; - VERIFY( str11 != str10 ); - - std::wstring str06 = str01; - std::wstring str07 = str06; // optional, so that begin below causes a mutate - p = str06.erase(str06.begin()); - std::wstring str08 = str06; - VERIFY( str08 == str06 ); - *p = L'!'; - VERIFY( *str08.c_str() == L't' ); - str08[0] = L'@'; - VERIFY( str06[0] == L'!' ); - VERIFY( *p == L'!' ); - VERIFY( str06 != str07 ); - VERIFY( str06 != str08 ); - - std::wstring str12 = str01; - p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1); - std::wstring str13 = str12; - *p2 = L'e'; - VERIFY( str12 != str13 ); - return test; -} - -int main() -{ - test02(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/4.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/4.cc deleted file mode 100644 index d05ab4169..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/4.cc +++ /dev/null @@ -1,49 +0,0 @@ -// 2004-01-18 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 21.3.4 basic_string element access - -#include <string> -#include <testsuite_hooks.h> - -// http://gcc.gnu.org/ml/libstdc++/2004-01/msg00184.html -void test01() -{ - bool test __attribute__((unused)) = true; - using namespace std; - - for (int i = 0; i < 2000; ++i) - { - wstring str_01; - - for (int j = 0; j < i; ++j) - str_01 += L'a'; - - str_01.reserve(i + 10); - - const wstring str_02(str_01); - VERIFY( str_02[i] == L'\0' ); - } -} - -int main() -{ - test01(); - return 0; -} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/empty.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/empty.cc deleted file mode 100644 index 9a70ace0e..000000000 --- a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/empty.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2004, 2009 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. -// - -#include <string> -#include <testsuite_hooks.h> - -// as per 21.3.4 -int main() -{ - bool test __attribute__((unused)) = true; - - { - std::wstring empty; - wchar_t c = empty[0]; - VERIFY( c == wchar_t() ); - } - - { - const std::wstring empty; - wchar_t c = empty[0]; - VERIFY( c == wchar_t() ); - } - return 0; -} |