]>
Commit | Line | Data |
---|---|---|
2b522535 | 1 | // { dg-options "-std=gnu++17" } |
641cb5a6 | 2 | // { dg-do run { target c++17 } } |
641cb5a6 | 3 | |
8d9254fc | 4 | // Copyright (C) 2014-2020 Free Software Foundation, Inc. |
641cb5a6 JW |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 3, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING3. If not see | |
19 | // <http://www.gnu.org/licenses/>. | |
20 | ||
21 | #include <testsuite_fs.h> | |
22 | ||
23 | using std::filesystem::path; | |
24 | using __gnu_test::compare_paths; | |
25 | ||
26 | void | |
27 | test01() | |
28 | { | |
29 | for (std::string s : __gnu_test::test_paths) | |
30 | { | |
31 | path p0 = s, p1, p2, p3, p4; | |
32 | ||
33 | p1 = s; | |
34 | compare_paths(p0, p1); | |
35 | ||
36 | p2 = s.c_str(); | |
37 | compare_paths(p0, p2); | |
38 | ||
39 | #if _GLIBCXX_USE_WCHAR_T | |
40 | std::wstring ws(s.begin(), s.end()); | |
41 | ||
42 | p3 = ws; | |
43 | compare_paths(p0, p3); | |
44 | ||
45 | p4 = ws.c_str(); | |
46 | compare_paths(p0, p4); | |
47 | #endif | |
48 | } | |
49 | } | |
50 | ||
51 | void | |
52 | test02() | |
53 | { | |
54 | for (std::string s : __gnu_test::test_paths) | |
55 | { | |
56 | path p0 = s, p1, p2, p3, p4, p5, p6, p7, p8; | |
57 | ||
58 | p1.assign(s); | |
59 | compare_paths(p0, p1); | |
60 | ||
61 | p2.assign( s.begin(), s.end() ); | |
62 | compare_paths(p0, p2); | |
63 | ||
64 | p3.assign( s.c_str() ); | |
65 | compare_paths(p0, p3); | |
66 | ||
67 | p4.assign( s.c_str(), s.c_str() + s.size() ); | |
68 | compare_paths(p0, p4); | |
69 | ||
70 | #if _GLIBCXX_USE_WCHAR_T | |
71 | std::wstring ws(s.begin(), s.end()); | |
72 | ||
73 | p5.assign(ws); | |
74 | compare_paths(p0, p5); | |
75 | ||
76 | p6.assign( ws.begin(), ws.end() ); | |
77 | compare_paths(p0, p6); | |
78 | ||
79 | p7.assign( ws.c_str() ); | |
80 | compare_paths(p0, p7); | |
81 | ||
82 | p8.assign( ws.c_str(), ws.c_str() + ws.size() ); | |
83 | compare_paths(p0, p8); | |
84 | #endif | |
85 | } | |
86 | } | |
87 | ||
88 | int | |
89 | main() | |
90 | { | |
91 | test01(); | |
92 | test02(); | |
93 | } |