]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/filesystem/file_status/1.cc
1 // Copyright (C) 2017-2022 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 "-DUSE_FILESYSTEM_TS -lstdc++fs" }
19 // { dg-do run { target c++11 } }
20 // { dg-require-filesystem-ts "" }
22 #include <experimental/filesystem>
23 #include <testsuite_hooks.h>
25 namespace fs
= std::experimental::filesystem
;
27 template<typename
... Args
>
28 constexpr bool nothrow_constructible() {
29 return std::is_nothrow_constructible
<fs::file_status
, Args
...>::value
;
36 VERIFY( st0
.type() == fs::file_type::none
);
37 VERIFY( st0
.permissions() == fs::perms::unknown
);
38 static_assert( nothrow_constructible
<>(), "" );
40 fs::file_status
st1(fs::file_type::regular
);
41 VERIFY( st1
.type() == fs::file_type::regular
);
42 VERIFY( st1
.permissions() == fs::perms::unknown
);
43 static_assert( nothrow_constructible
<fs::file_type
>(), "" );
45 fs::file_status
st2(fs::file_type::directory
, fs::perms::owner_all
);
46 VERIFY( st2
.type() == fs::file_type::directory
);
47 VERIFY( st2
.permissions() == fs::perms::owner_all
);
48 static_assert( nothrow_constructible
<fs::file_type
, fs::perms
>(), "" );
50 static_assert( nothrow_constructible
<const fs::file_status
&>(), "" );
51 static_assert( nothrow_constructible
<fs::file_status
>(), "" );
58 VERIFY( st
.type() == fs::file_type::none
);
59 VERIFY( st
.permissions() == fs::perms::unknown
);
61 st
.type(fs::file_type::symlink
);
62 VERIFY( st
.type() == fs::file_type::symlink
);
63 VERIFY( st
.permissions() == fs::perms::unknown
);
65 st
.permissions(fs::perms::owner_all
);
66 VERIFY( st
.type() == fs::file_type::symlink
);
67 VERIFY( st
.permissions() == fs::perms::owner_all
);