xref: /llvm-project/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp (revision ac8c9f1e39e1a773fd81ce23dbf1c80ea186f226)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03, c++11, c++14
10 // UNSUPPORTED: availability-filesystem-missing
11 
12 // <filesystem>
13 
14 // class path;
15 // enum class format;
16 
17 #include <filesystem>
18 #include <type_traits>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 namespace fs = std::filesystem;
23 
24 int main(int, char**) {
25   typedef fs::path::format E;
26   static_assert(std::is_enum<E>::value, "");
27 
28   typedef std::underlying_type<E>::type UT;
29 
30   LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, "")); // Implementation detail
31 
32   static_assert(
33           E::auto_format   != E::native_format &&
34           E::auto_format   != E::generic_format &&
35           E::native_format != E::generic_format,
36         "Expected enumeration values are not unique");
37 
38   return 0;
39 }
40