]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/filesystem/path/construct/format.cc
1 // Copyright (C) 2017-2019 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-options "-std=gnu++17" }
19 // { dg-do run { target c++17 } }
23 #include <testsuite_hooks.h>
24 #include <testsuite_iterators.h>
26 using std::filesystem::path
;
31 // path(string_type&&, format)
32 auto s
= [&]() -> path::string_type
{ return path("foo/bar").native(); };
34 path
p1(s(), path::auto_format
);
36 path
p2(s(), path::native_format
);
38 path
p3(s(), path::generic_format
);
45 // path(const Source&, format)
46 const path::string_type s
= path("foo/bar").native();
48 path
p1(s
, path::auto_format
);
50 path
p2(s
, path::native_format
);
52 path
p3(s
, path::generic_format
);
59 // path(const Source&, format)
60 const std::string s
= "foo/bar";
62 path
p1(s
, path::auto_format
);
64 path
p2(s
, path::native_format
);
66 path
p3(s
, path::generic_format
);
73 #ifdef _GLIBCXX_USE_WCHAR_T
74 // path(const Source&, format)
75 const std::wstring s
= L
"foo/bar";
77 path
p1(s
, path::auto_format
);
79 path
p2(s
, path::native_format
);
81 path
p3(s
, path::generic_format
);
89 // path(const Source&, format)
90 const char* s
= "foo/bar";
92 path
p1(s
, path::auto_format
);
94 path
p2(s
, path::native_format
);
96 path
p3(s
, path::generic_format
);
103 // path(InputIterator, InputIterator, format)
104 const char s
[] = "foo/bar";
105 using namespace __gnu_test
;
106 const test_container
<const char, input_iterator_wrapper
> c(s
, s
+ strlen(s
));
108 path
p0(std::begin(c0
), std::end(c0
));
110 path
p1(std::begin(c1
), std::end(c1
), path::auto_format
);
113 path
p2(std::begin(c2
), std::end(c2
), path::native_format
);
116 path
p3(std::begin(c3
), std::end(c3
), path::generic_format
);
123 // path(const Source&, const locale&, format)
124 const char* s
= "foo/bar";
127 path
p1(s
, loc
, path::auto_format
);
129 path
p2(s
, loc
, path::native_format
);
131 path
p3(s
, loc
, path::generic_format
);
138 // path(InputIterator, InputIterator, const locale&, format)
139 const char s
[] = "foo/bar";
140 using namespace __gnu_test
;
141 const test_container
<const char, input_iterator_wrapper
> c(s
, s
+ strlen(s
));
144 path
p0(std::begin(c0
), std::end(c0
), loc
);
146 path
p1(std::begin(c1
), std::end(c1
), loc
, path::auto_format
);
149 path
p2(std::begin(c2
), std::end(c2
), loc
, path::native_format
);
152 path
p3(std::begin(c3
), std::end(c3
), loc
, path::generic_format
);