]>
Commit | Line | Data |
---|---|---|
ce99f498 PC |
1 | // 2010-12-17 Paolo Carlini <paolo.carlini@oracle.com> |
2 | // | |
8d9254fc | 3 | // Copyright (C) 2010-2020 Free Software Foundation, Inc. |
ce99f498 PC |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | // | |
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | // | |
52066eae | 20 | // { dg-do run { target c++11 } } |
ce99f498 PC |
21 | // { dg-require-string-conversions "" } |
22 | ||
23 | #include <string> | |
24 | #include <testsuite_hooks.h> | |
25 | ||
26 | void test01() | |
27 | { | |
ce99f498 PC |
28 | using std::wstring; |
29 | ||
30 | VERIFY( (wstring(L"abc") + wstring(L"def") | |
31 | == wstring(L"abcdef")) ); | |
32 | wstring s1(L"abc"); | |
33 | VERIFY( s1 + wstring(L"def") == wstring(L"abcdef") ); | |
34 | wstring s2(L"def"); | |
35 | VERIFY( wstring(L"abc") + s2 == wstring(L"abcdef") ); | |
36 | VERIFY( wstring(L"abc") + L'd' == wstring(L"abcd") ); | |
37 | VERIFY( wstring(L"abc") + L"def" == wstring(L"abcdef") ); | |
38 | VERIFY( L'a' + wstring(L"bcd") == wstring(L"abcd") ); | |
39 | VERIFY( L"abc" + wstring(L"def") == wstring(L"abcdef") ); | |
40 | ||
41 | VERIFY( (wstring(L"abcdefghij") + wstring(L"klmnopqrst") | |
42 | == wstring(L"abcdefghijklmnopqrst")) ); | |
43 | wstring s1l(L"abcdefghij"); | |
44 | VERIFY( (s1l + wstring(L"klmnopqrst") | |
45 | == wstring(L"abcdefghijklmnopqrst")) ); | |
46 | wstring s2l(L"klmnopqrst"); | |
47 | VERIFY( (wstring(L"abcdefghij") + s2l | |
48 | == wstring(L"abcdefghijklmnopqrst")) ); | |
49 | VERIFY( (wstring(L"abcdefghijklmno") + L'p' | |
50 | == wstring(L"abcdefghijklmnop")) ); | |
51 | VERIFY( (wstring(L"abcdefghijklmno") + L"pqrst" | |
52 | == wstring(L"abcdefghijklmnopqrst")) ); | |
53 | VERIFY( (L'a' + wstring(L"bcdefghijklmnop") | |
54 | == wstring(L"abcdefghijklmnop")) ); | |
55 | VERIFY( (L"abcde" + wstring(L"fghijklmnopqrst") | |
56 | == wstring(L"abcdefghijklmnopqrst")) ); | |
57 | ||
58 | VERIFY( (wstring(L"abcdefghijklmnopqrst") + wstring(L"uvwxy") | |
59 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
60 | VERIFY( (wstring(L"abcde") + wstring(L"fghijklmnopqrstuvwxy") | |
61 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
62 | wstring s1ll1(L"abcdefghijklmnopqrst"); | |
63 | VERIFY( (s1ll1 + wstring(L"uvwxy") | |
64 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
65 | wstring s1ll2(L"abcde"); | |
66 | VERIFY( (s1ll2 + wstring(L"fghijklmnopqrstuvwxy") | |
67 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
68 | wstring s2ll1(L"fghijklmnopqrstuvwxy"); | |
69 | VERIFY( (wstring(L"abcde") + s2ll1 | |
70 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
71 | wstring s2ll2(L"uvwxy"); | |
72 | VERIFY( (wstring(L"abcdefghijklmnopqrst") + s2ll2 | |
73 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
74 | VERIFY( (wstring(L"abcdefghijklmnopqrst") + L'u' | |
75 | == wstring(L"abcdefghijklmnopqrstu")) ); | |
76 | VERIFY( (wstring(L"abcdefghijklmnopqrst") + L"uvwxy" | |
77 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
78 | VERIFY( (wstring(L"abcde") + L"fghijklmnopqrstuvwxy" | |
79 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
80 | VERIFY( (L'a' + wstring(L"bcdefghijklmnopqrstuvwxy") | |
81 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
82 | VERIFY( (L"abcde" + wstring(L"fghijklmnopqrstuvwxy") | |
83 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
84 | VERIFY( (L"abcdefghijklmnopqrst" + wstring(L"uvwxy") | |
85 | == wstring(L"abcdefghijklmnopqrstuvwxy")) ); | |
86 | } | |
87 | ||
88 | int main() | |
89 | { | |
90 | test01(); | |
91 | return 0; | |
92 | } |