]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/filesystem/path/native/alloc.cc
1 // Copyright (C) 2016-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_allocator.h>
27 using alloc
= __gnu_test::uneq_allocator
<C
>;
32 using namespace std::filesystem
;
35 auto str
= p
.string
<char>(alloc
<char>(1));
37 VERIFY( str
.get_allocator() == alloc
<char>(1) );
39 #ifdef _GLIBCXX_USE_CHAR8_T
40 auto str8
= p
.string
<char8_t
>(alloc
<char8_t
>(1));
41 VERIFY( str8
== u8
"" );
42 VERIFY( str8
.get_allocator() == alloc
<char8_t
>(1) );
45 auto strw
= p
.string
<wchar_t>(alloc
<wchar_t>(2));
46 VERIFY( strw
== L
"" );
47 VERIFY( strw
.get_allocator() == alloc
<wchar_t>(2) );
49 auto str16
= p
.string
<char16_t
>(alloc
<char16_t
>(3));
50 VERIFY( str16
== u
"" );
51 VERIFY( str16
.get_allocator() == alloc
<char16_t
>(3) );
53 auto str32
= p
.string
<char32_t
>(alloc
<char32_t
>(4));
54 VERIFY( str32
== U
"" );
55 VERIFY( str32
.get_allocator() == alloc
<char32_t
>(4) );
61 using namespace std::filesystem
;
62 path p
= "abcdefghijklmnopqrstuvwxyz";
64 auto str
= p
.string
<char>(alloc
<char>(1));
65 VERIFY( str
== "abcdefghijklmnopqrstuvwxyz" );
66 VERIFY( str
.get_allocator() == alloc
<char>(1) );
68 #ifdef _GLIBCXX_USE_CHAR8_T
69 auto str8
= p
.string
<char8_t
>(alloc
<char8_t
>(1));
70 VERIFY( str8
== u8
"abcdefghijklmnopqrstuvwxyz" );
71 VERIFY( str8
.get_allocator() == alloc
<char8_t
>(1) );
74 auto strw
= p
.string
<wchar_t>(alloc
<wchar_t>(2));
75 VERIFY( strw
== L
"abcdefghijklmnopqrstuvwxyz" );
76 VERIFY( strw
.get_allocator() == alloc
<wchar_t>(2) );
78 auto str16
= p
.string
<char16_t
>(alloc
<char16_t
>(3));
79 VERIFY( str16
== u
"abcdefghijklmnopqrstuvwxyz" );
80 VERIFY( str16
.get_allocator() == alloc
<char16_t
>(3) );
82 auto str32
= p
.string
<char32_t
>(alloc
<char32_t
>(4));
83 VERIFY( str32
== U
"abcdefghijklmnopqrstuvwxyz" );
84 VERIFY( str32
.get_allocator() == alloc
<char32_t
>(4) );