// Copyright (C) 2016-2019 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// .
// { dg-options "-lstdc++fs" }
// { dg-do run { target c++11 } }
// { dg-require-filesystem-ts "" }
#include
#include
#include
#include
template
using alloc = __gnu_test::uneq_allocator;
void
test01()
{
using namespace std::experimental::filesystem;
path p;
auto str = p.string(alloc(1));
VERIFY( str == "" );
VERIFY( str.get_allocator() == alloc(1) );
#ifdef _GLIBCXX_USE_CHAR8_T
auto str8 = p.string(alloc(1));
VERIFY( str8 == u8"" );
VERIFY( str8.get_allocator() == alloc(1) );
#endif
auto strw = p.string(alloc(2));
VERIFY( strw == L"" );
VERIFY( strw.get_allocator() == alloc(2) );
auto str16 = p.string(alloc(3));
VERIFY( str16 == u"" );
VERIFY( str16.get_allocator() == alloc(3) );
auto str32 = p.string(alloc(4));
VERIFY( str32 == U"" );
VERIFY( str32.get_allocator() == alloc(4) );
}
void
test02()
{
using namespace std::experimental::filesystem;
path p = "abcdefghijklmnopqrstuvwxyz";
auto str = p.string(alloc(1));
VERIFY( str == "abcdefghijklmnopqrstuvwxyz" );
VERIFY( str.get_allocator() == alloc(1) );
#ifdef _GLIBCXX_USE_CHAR8_T
auto str8 = p.string(alloc(1));
VERIFY( str8 == u8"abcdefghijklmnopqrstuvwxyz" );
VERIFY( str8.get_allocator() == alloc(1) );
#endif
auto strw = p.string(alloc(2));
VERIFY( strw == L"abcdefghijklmnopqrstuvwxyz" );
VERIFY( strw.get_allocator() == alloc(2) );
auto str16 = p.string(alloc(3));
VERIFY( str16 == u"abcdefghijklmnopqrstuvwxyz" );
VERIFY( str16.get_allocator() == alloc(3) );
auto str32 = p.string(alloc(4));
VERIFY( str32 == U"abcdefghijklmnopqrstuvwxyz" );
VERIFY( str32.get_allocator() == alloc(4) );
}
int
main()
{
test01();
test02();
}