From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../21_strings/basic_string/operators/char/1.cc | 49 ++++ .../21_strings/basic_string/operators/char/2.cc | 294 +++++++++++++++++++++ .../21_strings/basic_string/operators/char/3.cc | 93 +++++++ .../21_strings/basic_string/operators/char/4.cc | 79 ++++++ .../21_strings/basic_string/operators/wchar_t/1.cc | 49 ++++ .../21_strings/basic_string/operators/wchar_t/2.cc | 294 +++++++++++++++++++++ .../21_strings/basic_string/operators/wchar_t/3.cc | 93 +++++++ .../21_strings/basic_string/operators/wchar_t/4.cc | 79 ++++++ 8 files changed, 1030 insertions(+) create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/char/3.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/char/4.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/3.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/4.cc (limited to 'libstdc++-v3/testsuite/21_strings/basic_string/operators') diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc new file mode 100644 index 000000000..e9b030e59 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc @@ -0,0 +1,49 @@ +// 1999-05-07 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 +// . + +// 21.3.6 string operations + +#include +#include +#include + +int test01(void) +{ + bool test __attribute__((unused)) = true; + + std::string str1; + std::string str2; + + // Should get this: + // 1:8-chars_8-chars_ + // 2:8-chars_8-chars_ + str1 = std::string("8-chars_") + "8-chars_"; + str1.c_str(); + // printf("1:%s\n", str1.c_str()); + str2 = str1 + "7-chars"; + // printf("2:%s\n", str1.c_str()); //str1 is gone + str1.c_str(); + return 0; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc new file mode 100644 index 000000000..7be6ae5cc --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/2.cc @@ -0,0 +1,294 @@ +// 1998-10-01, 1999-06-25 bkoz + +// Copyright (C) 1998, 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 +// . + +// 21.3.7.1 basic_string non-member functions + +// 21.3.7.2 operator== +/* +template + bool operator==(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator==(const charT* lhs, + const basic_string& rhs); + +template + bool operator==(const basic_string& lhs, + const charT* rhs); +*/ + +// 21.3.7.3 operator!= +/* +template + bool operator!=(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator!=(const charT* lhs, + const basic_string& rhs); + +template + bool operator!=(const basic_string& lhs, + const charT* rhs); +*/ + +// 21.3.7.4 operator< +/* +template + bool operator< (const basic_string& lhs, + const basic_string& rhs); + +template + bool operator< (const basic_string& lhs, + const charT* rhs); + +template + bool operator< (const charT* lhs, + const basic_string& rhs); +*/ + +// 21.3.7.5 operator> +/* +template + bool operator> (const basic_string& lhs, + const basic_string& rhs); + +template + bool operator> (const basic_string& lhs, + const charT* rhs); + +template + bool operator> (const charT* lhs, + const basic_string& rhs); +*/ + +//21.3.7.6 operator<= +/* +template + bool operator<=(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator<=(const basic_string& lhs, + const charT* rhs); + +template + bool operator<=(const charT* lhs, + const basic_string& rhs); +*/ + +// 21.3.7.7 operator>= +/* +template + bool operator>=(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator>=(const basic_string& lhs, + const charT* rhs); + +template + bool operator>=(const charT* lhs, + const basic_string& rhs); +*/ + +#include +#include + +int test01(void) +{ + bool test __attribute__((unused)) = true; + std::string str_0("costa rica"); + std::string str_1("costa marbella"); + std::string str_2("cost"); + std::string str_3("costa ricans"); + std::string str_4; + + str_4 = str_0; + //comparisons between string objects + VERIFY( !(str_0 == str_1) ); + VERIFY( !(str_0 == str_2) ); + VERIFY( !(str_0 == str_3) ); + VERIFY( !(str_1 == str_0) ); + VERIFY( !(str_2 == str_0) ); + VERIFY( !(str_3 == str_0) ); + VERIFY( str_4 == str_0 ); + VERIFY( str_0 == str_4 ); + + VERIFY( str_0 != str_1 ); + VERIFY( str_0 != str_2 ); + VERIFY( str_0 != str_3 ); + VERIFY( str_1 != str_0 ); + VERIFY( str_2 != str_0 ); + VERIFY( str_3 != str_0 ); + VERIFY( !(str_0 != str_4) ); + VERIFY( !(str_4 != str_0) ); + + VERIFY( str_0 > str_1 ); //true cuz r>m + VERIFY( str_0 > str_2 ); + VERIFY( !(str_0 > str_3) ); + VERIFY( !(str_1 > str_0) ); //false cuz m str_0) ); + VERIFY( str_3 > str_0 ); + VERIFY( !(str_0 > str_4) ); + VERIFY( !(str_4 > str_0) ); + + VERIFY( !(str_0 < str_1) ); //false cuz r>m + VERIFY( !(str_0 < str_2) ); + VERIFY( str_0 < str_3 ); + VERIFY( str_1 < str_0 ); //true cuz m= str_1 ); //true cuz r>m + VERIFY( str_0 >= str_2 ); + VERIFY( !(str_0 >= str_3) ); + VERIFY( !(str_1 >= str_0) );//false cuz m= str_0) ); + VERIFY( str_3 >= str_0 ); + VERIFY( str_0 >= str_4 ); + VERIFY( str_4 >= str_0 ); + + VERIFY( !(str_0 <= str_1) );//false cuz r>m + VERIFY( !(str_0 <= str_2) ); + VERIFY( str_0 <= str_3 ); + VERIFY( str_1 <= str_0 );//true cuz m "costa marbella" ); //true cuz r>m + VERIFY( str_0 > "cost" ); + VERIFY( !(str_0 > "costa ricans") ); + VERIFY( !("costa marbella" > str_0) );//false cuz m str_0) ); + VERIFY( "costa ricans" > str_0 ); + VERIFY( !("costa rica" > str_0) ); + VERIFY( !(str_0 > "costa rica") ); + + VERIFY( !(str_0 < "costa marbella") );//false cuz r>m + VERIFY( !(str_0 < "cost") ); + VERIFY( str_0 < "costa ricans" ); + VERIFY( "costa marbella" < str_0 );//true cuz m= "costa marbella" );//true cuz r>m + VERIFY( str_0 >= "cost" ); + VERIFY( !(str_0 >= "costa ricans") ); + VERIFY( !("costa marbella" >= str_0) );//false cuz m= str_0) ); + VERIFY( "costa ricans" >= str_0 ); + VERIFY( "costa rica" >= str_0 ); + VERIFY( str_0 >= "costa rica" ); + + VERIFY( !(str_0 <= "costa marbella") );//false cuz r>m + VERIFY( !(str_0 <= "cost") ); + VERIFY( str_0 <= "costa ricans" ); + VERIFY( "costa marbella" <= str_0 );//true cuz m + basic_string + operator+(const basic_string& lhs, + const basic_string& rhs); + +template + basic_string + operator+(const charT* lhs, + const basic_string& rhs); + +template + basic_string + operator+(const basic_string& lhs, + const charT* rhs); + +template + basic_string + operator+(charT lhs, const basic_string& rhs); + +template + basic_string + operator+(const basic_string& lhs, charT rhs); +*/ + + str_4 = str_0 + "ns"; + VERIFY( str_4 == str_3 ); + + const std::string str_5(" marbella"); + str_4 = "costa" + str_5; + VERIFY( str_4 == str_1 ); + + std::string str_6("ns"); + str_4 = str_0 + str_6; + VERIFY( str_4 == str_3 ); + + str_4 = str_0 + 'n'; + str_4 = str_4 + 's'; + VERIFY( str_4 == str_3 ); + + str_4 = 'a' + str_6; + str_4 = 'c' + str_4; + str_4 = 'i' + str_4; + str_4 = 'r' + str_4; + str_4 = ' ' + str_4; + str_4 = 'a' + str_4; + str_4 = 't' + str_4; + str_4 = 's' + str_4; + str_4 = 'o' + str_4; + str_4 = 'c' + str_4; + VERIFY( str_4 == str_3 ); + return 0; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/3.cc new file mode 100644 index 000000000..6bd573fe3 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/3.cc @@ -0,0 +1,93 @@ +// 2010-12-17 Paolo Carlini +// +// Copyright (C) 2010 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 +// . +// +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::string; + + VERIFY( (string("abc") + string("def") + == string("abcdef")) ); + string s1("abc"); + VERIFY( s1 + string("def") == string("abcdef") ); + string s2("def"); + VERIFY( string("abc") + s2 == string("abcdef") ); + VERIFY( string("abc") + 'd' == string("abcd") ); + VERIFY( string("abc") + "def" == string("abcdef") ); + VERIFY( 'a' + string("bcd") == string("abcd") ); + VERIFY( "abc" + string("def") == string("abcdef") ); + + VERIFY( (string("abcdefghij") + string("klmnopqrst") + == string("abcdefghijklmnopqrst")) ); + string s1l("abcdefghij"); + VERIFY( (s1l + string("klmnopqrst") + == string("abcdefghijklmnopqrst")) ); + string s2l("klmnopqrst"); + VERIFY( (string("abcdefghij") + s2l + == string("abcdefghijklmnopqrst")) ); + VERIFY( (string("abcdefghijklmno") + 'p' + == string("abcdefghijklmnop")) ); + VERIFY( (string("abcdefghijklmno") + "pqrst" + == string("abcdefghijklmnopqrst")) ); + VERIFY( ('a' + string("bcdefghijklmnop") + == string("abcdefghijklmnop")) ); + VERIFY( ("abcde" + string("fghijklmnopqrst") + == string("abcdefghijklmnopqrst")) ); + + VERIFY( (string("abcdefghijklmnopqrst") + string("uvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (string("abcde") + string("fghijklmnopqrstuvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); + string s1ll1("abcdefghijklmnopqrst"); + VERIFY( (s1ll1 + string("uvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); + string s1ll2("abcde"); + VERIFY( (s1ll2 + string("fghijklmnopqrstuvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); + string s2ll1("fghijklmnopqrstuvwxy"); + VERIFY( (string("abcde") + s2ll1 + == string("abcdefghijklmnopqrstuvwxy")) ); + string s2ll2("uvwxy"); + VERIFY( (string("abcdefghijklmnopqrst") + s2ll2 + == string("abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (string("abcdefghijklmnopqrst") + 'u' + == string("abcdefghijklmnopqrstu")) ); + VERIFY( (string("abcdefghijklmnopqrst") + "uvwxy" + == string("abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (string("abcde") + "fghijklmnopqrstuvwxy" + == string("abcdefghijklmnopqrstuvwxy")) ); + VERIFY( ('a' + string("bcdefghijklmnopqrstuvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); + VERIFY( ("abcde" + string("fghijklmnopqrstuvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); + VERIFY( ("abcdefghijklmnopqrst" + string("uvwxy") + == string("abcdefghijklmnopqrstuvwxy")) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/4.cc new file mode 100644 index 000000000..e1e771d2d --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/4.cc @@ -0,0 +1,79 @@ +// 2010-12-19 Paolo Carlini +// +// Copyright (C) 2010 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 +// . +// +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::string; + using std::move; + + string s01("abc"); + s01.reserve(30); + string s02("def"); + s02.reserve(30); + VERIFY( move(s01) + move(s02) == string("abcdef") ); + + string s03("abcdefghijklmnopqrstuvw"); + string s04("xyz"); + s04.reserve(30); + VERIFY( move(s03) + move(s04) == string("abcdefghijklmnopqrstuvwxyz") ); + + string s05("abc"); + s05.reserve(30); + string s06("defghijklmnopqrstuvwxyz"); + VERIFY( move(s05) + move(s06) == string("abcdefghijklmnopqrstuvwxyz") ); + + const string sc1("abc"); + string s07("def"); + s07.reserve(30); + VERIFY( sc1 + move(s07) == string("abcdef") ); + + const string sc2("def"); + string s08("abc"); + s08.reserve(30); + VERIFY( move(s08) + sc2 == string("abcdef") ); + + string s09("abc"); + s09.reserve(30); + VERIFY( move(s09) + 'd' == string("abcd") ); + + string s10("abc"); + s10.reserve(30); + VERIFY( move(s10) + "def" == string("abcdef") ); + + string s11("bcd"); + s11.reserve(30); + VERIFY( 'a' + move(s11) == string("abcd") ); + + string s12("def"); + s12.reserve(30); + VERIFY( "abc" + move(s12) == string("abcdef") ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc new file mode 100644 index 000000000..3bdc0d25b --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/1.cc @@ -0,0 +1,49 @@ +// 1999-05-07 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 +// . + +// 21.3.6 string operations + +#include +#include +#include + +int test01(void) +{ + bool test __attribute__((unused)) = true; + + std::wstring str1; + std::wstring str2; + + // Should get this: + // 1:8-chars_8-chars_ + // 2:8-chars_8-chars_ + str1 = std::wstring(L"8-chars_") + L"8-chars_"; + str1.c_str(); + // wprintf("1:%s\n", str1.c_str()); + str2 = str1 + L"7-chars"; + // wprintf("2:%s\n", str1.c_str()); //str1 is gone + str1.c_str(); + return 0; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc new file mode 100644 index 000000000..a563f5377 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/2.cc @@ -0,0 +1,294 @@ +// 1998-10-01, 1999-06-25 bkoz + +// Copyright (C) 1998, 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 +// . + +// 21.3.7.1 basic_string non-member functions + +// 21.3.7.2 operator== +/* +template + bool operator==(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator==(const charT* lhs, + const basic_string& rhs); + +template + bool operator==(const basic_string& lhs, + const charT* rhs); +*/ + +// 21.3.7.3 operator!= +/* +template + bool operator!=(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator!=(const charT* lhs, + const basic_string& rhs); + +template + bool operator!=(const basic_string& lhs, + const charT* rhs); +*/ + +// 21.3.7.4 operator< +/* +template + bool operator< (const basic_string& lhs, + const basic_string& rhs); + +template + bool operator< (const basic_string& lhs, + const charT* rhs); + +template + bool operator< (const charT* lhs, + const basic_string& rhs); +*/ + +// 21.3.7.5 operator> +/* +template + bool operator> (const basic_string& lhs, + const basic_string& rhs); + +template + bool operator> (const basic_string& lhs, + const charT* rhs); + +template + bool operator> (const charT* lhs, + const basic_string& rhs); +*/ + +//21.3.7.6 operator<= +/* +template + bool operator<=(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator<=(const basic_string& lhs, + const charT* rhs); + +template + bool operator<=(const charT* lhs, + const basic_string& rhs); +*/ + +// 21.3.7.7 operator>= +/* +template + bool operator>=(const basic_string& lhs, + const basic_string& rhs); + +template + bool operator>=(const basic_string& lhs, + const charT* rhs); + +template + bool operator>=(const charT* lhs, + const basic_string& rhs); +*/ + +#include +#include + +int test01(void) +{ + bool test __attribute__((unused)) = true; + std::wstring str_0(L"costa rica"); + std::wstring str_1(L"costa marbella"); + std::wstring str_2(L"cost"); + std::wstring str_3(L"costa ricans"); + std::wstring str_4; + + str_4 = str_0; + //comparisons between string objects + VERIFY( !(str_0 == str_1) ); + VERIFY( !(str_0 == str_2) ); + VERIFY( !(str_0 == str_3) ); + VERIFY( !(str_1 == str_0) ); + VERIFY( !(str_2 == str_0) ); + VERIFY( !(str_3 == str_0) ); + VERIFY( str_4 == str_0 ); + VERIFY( str_0 == str_4 ); + + VERIFY( str_0 != str_1 ); + VERIFY( str_0 != str_2 ); + VERIFY( str_0 != str_3 ); + VERIFY( str_1 != str_0 ); + VERIFY( str_2 != str_0 ); + VERIFY( str_3 != str_0 ); + VERIFY( !(str_0 != str_4) ); + VERIFY( !(str_4 != str_0) ); + + VERIFY( str_0 > str_1 ); //true cuz r>m + VERIFY( str_0 > str_2 ); + VERIFY( !(str_0 > str_3) ); + VERIFY( !(str_1 > str_0) ); //false cuz m str_0) ); + VERIFY( str_3 > str_0 ); + VERIFY( !(str_0 > str_4) ); + VERIFY( !(str_4 > str_0) ); + + VERIFY( !(str_0 < str_1) ); //false cuz r>m + VERIFY( !(str_0 < str_2) ); + VERIFY( str_0 < str_3 ); + VERIFY( str_1 < str_0 ); //true cuz m= str_1 ); //true cuz r>m + VERIFY( str_0 >= str_2 ); + VERIFY( !(str_0 >= str_3) ); + VERIFY( !(str_1 >= str_0) );//false cuz m= str_0) ); + VERIFY( str_3 >= str_0 ); + VERIFY( str_0 >= str_4 ); + VERIFY( str_4 >= str_0 ); + + VERIFY( !(str_0 <= str_1) );//false cuz r>m + VERIFY( !(str_0 <= str_2) ); + VERIFY( str_0 <= str_3 ); + VERIFY( str_1 <= str_0 );//true cuz m L"costa marbella" ); //true cuz r>m + VERIFY( str_0 > L"cost" ); + VERIFY( !(str_0 > L"costa ricans") ); + VERIFY( !(L"costa marbella" > str_0) );//false cuz m str_0) ); + VERIFY( L"costa ricans" > str_0 ); + VERIFY( !(L"costa rica" > str_0) ); + VERIFY( !(str_0 > L"costa rica") ); + + VERIFY( !(str_0 < L"costa marbella") );//false cuz r>m + VERIFY( !(str_0 < L"cost") ); + VERIFY( str_0 < L"costa ricans" ); + VERIFY( L"costa marbella" < str_0 );//true cuz m= L"costa marbella" );//true cuz r>m + VERIFY( str_0 >= L"cost" ); + VERIFY( !(str_0 >= L"costa ricans") ); + VERIFY( !(L"costa marbella" >= str_0) );//false cuz m= str_0) ); + VERIFY( L"costa ricans" >= str_0 ); + VERIFY( L"costa rica" >= str_0 ); + VERIFY( str_0 >= L"costa rica" ); + + VERIFY( !(str_0 <= L"costa marbella") );//false cuz r>m + VERIFY( !(str_0 <= L"cost") ); + VERIFY( str_0 <= L"costa ricans" ); + VERIFY( L"costa marbella" <= str_0 );//true cuz m + basic_string + operator+(const basic_string& lhs, + const basic_string& rhs); + +template + basic_string + operator+(const charT* lhs, + const basic_string& rhs); + +template + basic_string + operator+(const basic_string& lhs, + const charT* rhs); + +template + basic_string + operator+(charT lhs, const basic_string& rhs); + +template + basic_string + operator+(const basic_string& lhs, charT rhs); +*/ + + str_4 = str_0 + L"ns"; + VERIFY( str_4 == str_3 ); + + const std::wstring str_5(L" marbella"); + str_4 = L"costa" + str_5; + VERIFY( str_4 == str_1 ); + + std::wstring str_6(L"ns"); + str_4 = str_0 + str_6; + VERIFY( str_4 == str_3 ); + + str_4 = str_0 + L'n'; + str_4 = str_4 + L's'; + VERIFY( str_4 == str_3 ); + + str_4 = L'a' + str_6; + str_4 = L'c' + str_4; + str_4 = L'i' + str_4; + str_4 = L'r' + str_4; + str_4 = L' ' + str_4; + str_4 = L'a' + str_4; + str_4 = L't' + str_4; + str_4 = L's' + str_4; + str_4 = L'o' + str_4; + str_4 = L'c' + str_4; + VERIFY( str_4 == str_3 ); + return 0; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/3.cc new file mode 100644 index 000000000..77915f5e3 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/3.cc @@ -0,0 +1,93 @@ +// 2010-12-17 Paolo Carlini +// +// Copyright (C) 2010 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 +// . +// +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::wstring; + + VERIFY( (wstring(L"abc") + wstring(L"def") + == wstring(L"abcdef")) ); + wstring s1(L"abc"); + VERIFY( s1 + wstring(L"def") == wstring(L"abcdef") ); + wstring s2(L"def"); + VERIFY( wstring(L"abc") + s2 == wstring(L"abcdef") ); + VERIFY( wstring(L"abc") + L'd' == wstring(L"abcd") ); + VERIFY( wstring(L"abc") + L"def" == wstring(L"abcdef") ); + VERIFY( L'a' + wstring(L"bcd") == wstring(L"abcd") ); + VERIFY( L"abc" + wstring(L"def") == wstring(L"abcdef") ); + + VERIFY( (wstring(L"abcdefghij") + wstring(L"klmnopqrst") + == wstring(L"abcdefghijklmnopqrst")) ); + wstring s1l(L"abcdefghij"); + VERIFY( (s1l + wstring(L"klmnopqrst") + == wstring(L"abcdefghijklmnopqrst")) ); + wstring s2l(L"klmnopqrst"); + VERIFY( (wstring(L"abcdefghij") + s2l + == wstring(L"abcdefghijklmnopqrst")) ); + VERIFY( (wstring(L"abcdefghijklmno") + L'p' + == wstring(L"abcdefghijklmnop")) ); + VERIFY( (wstring(L"abcdefghijklmno") + L"pqrst" + == wstring(L"abcdefghijklmnopqrst")) ); + VERIFY( (L'a' + wstring(L"bcdefghijklmnop") + == wstring(L"abcdefghijklmnop")) ); + VERIFY( (L"abcde" + wstring(L"fghijklmnopqrst") + == wstring(L"abcdefghijklmnopqrst")) ); + + VERIFY( (wstring(L"abcdefghijklmnopqrst") + wstring(L"uvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (wstring(L"abcde") + wstring(L"fghijklmnopqrstuvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + wstring s1ll1(L"abcdefghijklmnopqrst"); + VERIFY( (s1ll1 + wstring(L"uvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + wstring s1ll2(L"abcde"); + VERIFY( (s1ll2 + wstring(L"fghijklmnopqrstuvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + wstring s2ll1(L"fghijklmnopqrstuvwxy"); + VERIFY( (wstring(L"abcde") + s2ll1 + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + wstring s2ll2(L"uvwxy"); + VERIFY( (wstring(L"abcdefghijklmnopqrst") + s2ll2 + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (wstring(L"abcdefghijklmnopqrst") + L'u' + == wstring(L"abcdefghijklmnopqrstu")) ); + VERIFY( (wstring(L"abcdefghijklmnopqrst") + L"uvwxy" + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (wstring(L"abcde") + L"fghijklmnopqrstuvwxy" + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (L'a' + wstring(L"bcdefghijklmnopqrstuvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (L"abcde" + wstring(L"fghijklmnopqrstuvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); + VERIFY( (L"abcdefghijklmnopqrst" + wstring(L"uvwxy") + == wstring(L"abcdefghijklmnopqrstuvwxy")) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/4.cc new file mode 100644 index 000000000..36e307d65 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/4.cc @@ -0,0 +1,79 @@ +// 2010-12-19 Paolo Carlini +// +// Copyright (C) 2010 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 +// . +// +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::wstring; + using std::move; + + wstring s01(L"abc"); + s01.reserve(30); + wstring s02(L"def"); + s02.reserve(30); + VERIFY( move(s01) + move(s02) == wstring(L"abcdef") ); + + wstring s03(L"abcdefghijklmnopqrstuvw"); + wstring s04(L"xyz"); + s04.reserve(30); + VERIFY( move(s03) + move(s04) == wstring(L"abcdefghijklmnopqrstuvwxyz") ); + + wstring s05(L"abc"); + s05.reserve(30); + wstring s06(L"defghijklmnopqrstuvwxyz"); + VERIFY( move(s05) + move(s06) == wstring(L"abcdefghijklmnopqrstuvwxyz") ); + + const wstring sc1(L"abc"); + wstring s07(L"def"); + s07.reserve(30); + VERIFY( sc1 + move(s07) == wstring(L"abcdef") ); + + const wstring sc2(L"def"); + wstring s08(L"abc"); + s08.reserve(30); + VERIFY( move(s08) + sc2 == wstring(L"abcdef") ); + + wstring s09(L"abc"); + s09.reserve(30); + VERIFY( move(s09) + L'd' == wstring(L"abcd") ); + + wstring s10(L"abc"); + s10.reserve(30); + VERIFY( move(s10) + L"def" == wstring(L"abcdef") ); + + wstring s11(L"bcd"); + s11.reserve(30); + VERIFY( L'a' + move(s11) == wstring(L"abcd") ); + + wstring s12(L"def"); + s12.reserve(30); + VERIFY( L"abc" + move(s12) == wstring(L"abcdef") ); +} + +int main() +{ + test01(); + return 0; +} -- cgit v1.2.3