]>
Commit | Line | Data |
---|---|---|
1 | // 2010-12-15 Paolo Carlini <paolo.carlini@oracle.com> | |
2 | // | |
3 | // Copyright (C) 2010-2017 Free Software Foundation, Inc. | |
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 | // | |
20 | // { dg-do run { target c++11 } } | |
21 | // { dg-require-string-conversions "" } | |
22 | ||
23 | #include <ext/vstring.h> | |
24 | #include <testsuite_hooks.h> | |
25 | ||
26 | void test01() | |
27 | { | |
28 | using __gnu_cxx::__vstring; | |
29 | ||
30 | VERIFY( (__vstring("abc") + __vstring("def") | |
31 | == __vstring("abcdef")) ); | |
32 | __vstring s1("abc"); | |
33 | VERIFY( s1 + __vstring("def") == __vstring("abcdef") ); | |
34 | __vstring s2("def"); | |
35 | VERIFY( __vstring("abc") + s2 == __vstring("abcdef") ); | |
36 | VERIFY( __vstring("abc") + 'd' == __vstring("abcd") ); | |
37 | VERIFY( __vstring("abc") + "def" == __vstring("abcdef") ); | |
38 | VERIFY( 'a' + __vstring("bcd") == __vstring("abcd") ); | |
39 | VERIFY( "abc" + __vstring("def") == __vstring("abcdef") ); | |
40 | ||
41 | VERIFY( (__vstring("abcdefghij") + __vstring("klmnopqrst") | |
42 | == __vstring("abcdefghijklmnopqrst")) ); | |
43 | __vstring s1l("abcdefghij"); | |
44 | VERIFY( (s1l + __vstring("klmnopqrst") | |
45 | == __vstring("abcdefghijklmnopqrst")) ); | |
46 | __vstring s2l("klmnopqrst"); | |
47 | VERIFY( (__vstring("abcdefghij") + s2l | |
48 | == __vstring("abcdefghijklmnopqrst")) ); | |
49 | VERIFY( (__vstring("abcdefghijklmno") + 'p' | |
50 | == __vstring("abcdefghijklmnop")) ); | |
51 | VERIFY( (__vstring("abcdefghijklmno") + "pqrst" | |
52 | == __vstring("abcdefghijklmnopqrst")) ); | |
53 | VERIFY( ('a' + __vstring("bcdefghijklmnop") | |
54 | == __vstring("abcdefghijklmnop")) ); | |
55 | VERIFY( ("abcde" + __vstring("fghijklmnopqrst") | |
56 | == __vstring("abcdefghijklmnopqrst")) ); | |
57 | ||
58 | VERIFY( (__vstring("abcdefghijklmnopqrst") + __vstring("uvwxy") | |
59 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
60 | VERIFY( (__vstring("abcde") + __vstring("fghijklmnopqrstuvwxy") | |
61 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
62 | __vstring s1ll1("abcdefghijklmnopqrst"); | |
63 | VERIFY( (s1ll1 + __vstring("uvwxy") | |
64 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
65 | __vstring s1ll2("abcde"); | |
66 | VERIFY( (s1ll2 + __vstring("fghijklmnopqrstuvwxy") | |
67 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
68 | __vstring s2ll1("fghijklmnopqrstuvwxy"); | |
69 | VERIFY( (__vstring("abcde") + s2ll1 | |
70 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
71 | __vstring s2ll2("uvwxy"); | |
72 | VERIFY( (__vstring("abcdefghijklmnopqrst") + s2ll2 | |
73 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
74 | VERIFY( (__vstring("abcdefghijklmnopqrst") + 'u' | |
75 | == __vstring("abcdefghijklmnopqrstu")) ); | |
76 | VERIFY( (__vstring("abcdefghijklmnopqrst") + "uvwxy" | |
77 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
78 | VERIFY( (__vstring("abcde") + "fghijklmnopqrstuvwxy" | |
79 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
80 | VERIFY( ('a' + __vstring("bcdefghijklmnopqrstuvwxy") | |
81 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
82 | VERIFY( ("abcde" + __vstring("fghijklmnopqrstuvwxy") | |
83 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
84 | VERIFY( ("abcdefghijklmnopqrst" + __vstring("uvwxy") | |
85 | == __vstring("abcdefghijklmnopqrstuvwxy")) ); | |
86 | } | |
87 | ||
88 | int main() | |
89 | { | |
90 | test01(); | |
91 | return 0; | |
92 | } |