]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/filesystem/path/native/alloc.cc
1 // Copyright (C) 2016-2024 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 "-lstdc++fs" }
19 // { dg-do run { target c++11 } }
20 // { dg-require-filesystem-ts "" }
22 #include <experimental/filesystem>
24 #include <testsuite_hooks.h>
25 #include <testsuite_allocator.h>
28 using alloc
= __gnu_test::uneq_allocator
<C
>;
33 using namespace std::experimental::filesystem
;
36 auto str
= p
.string
<char>(alloc
<char>(1));
38 VERIFY( str
.get_allocator() == alloc
<char>(1) );
40 #ifdef _GLIBCXX_USE_CHAR8_T
41 auto str8
= p
.string
<char8_t
>(alloc
<char8_t
>(1));
42 VERIFY( str8
== u8
"" );
43 VERIFY( str8
.get_allocator() == alloc
<char8_t
>(1) );
46 #ifdef _GLIBCXX_USE_WCHAR_T
47 auto strw
= p
.string
<wchar_t>(alloc
<wchar_t>(2));
48 VERIFY( strw
== L
"" );
49 VERIFY( strw
.get_allocator() == alloc
<wchar_t>(2) );
52 auto str16
= p
.string
<char16_t
>(alloc
<char16_t
>(3));
53 VERIFY( str16
== u
"" );
54 VERIFY( str16
.get_allocator() == alloc
<char16_t
>(3) );
56 auto str32
= p
.string
<char32_t
>(alloc
<char32_t
>(4));
57 VERIFY( str32
== U
"" );
58 VERIFY( str32
.get_allocator() == alloc
<char32_t
>(4) );
64 using namespace std::experimental::filesystem
;
65 path p
= "abcdefghijklmnopqrstuvwxyz";
67 auto str
= p
.string
<char>(alloc
<char>(1));
68 VERIFY( str
== "abcdefghijklmnopqrstuvwxyz" );
69 VERIFY( str
.get_allocator() == alloc
<char>(1) );
71 #ifdef _GLIBCXX_USE_CHAR8_T
72 auto str8
= p
.string
<char8_t
>(alloc
<char8_t
>(1));
73 VERIFY( str8
== u8
"abcdefghijklmnopqrstuvwxyz" );
74 VERIFY( str8
.get_allocator() == alloc
<char8_t
>(1) );
77 #ifdef _GLIBCXX_USE_WCHAR_T
78 auto strw
= p
.string
<wchar_t>(alloc
<wchar_t>(2));
79 VERIFY( strw
== L
"abcdefghijklmnopqrstuvwxyz" );
80 VERIFY( strw
.get_allocator() == alloc
<wchar_t>(2) );
83 auto str16
= p
.string
<char16_t
>(alloc
<char16_t
>(3));
84 VERIFY( str16
== u
"abcdefghijklmnopqrstuvwxyz" );
85 VERIFY( str16
.get_allocator() == alloc
<char16_t
>(3) );
87 auto str32
= p
.string
<char32_t
>(alloc
<char32_t
>(4));
88 VERIFY( str32
== U
"abcdefghijklmnopqrstuvwxyz" );
89 VERIFY( str32
.get_allocator() == alloc
<char32_t
>(4) );