libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

file_status.mods.pass.cpp (1438B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // <filesystem>
     13 
     14 // class file_status
     15 
     16 // void type(file_type) noexcept;
     17 // void permissions(perms) noexcept;
     18 
     19 #include "filesystem_include.hpp"
     20 #include <type_traits>
     21 #include <cassert>
     22 
     23 
     24 int main() {
     25   using namespace fs;
     26 
     27   file_status st;
     28 
     29   // type test
     30   {
     31     static_assert(noexcept(st.type(file_type::regular)),
     32                   "operation must be noexcept");
     33     static_assert(std::is_same<decltype(st.type(file_type::regular)), void>::value,
     34                  "operation must return void");
     35     assert(st.type() != file_type::regular);
     36     st.type(file_type::regular);
     37     assert(st.type() == file_type::regular);
     38   }
     39   // permissions test
     40   {
     41     static_assert(noexcept(st.permissions(perms::owner_read)),
     42                   "operation must be noexcept");
     43     static_assert(std::is_same<decltype(st.permissions(perms::owner_read)), void>::value,
     44                  "operation must return void");
     45     assert(st.permissions() != perms::owner_read);
     46     st.permissions(perms::owner_read);
     47     assert(st.permissions() == perms::owner_read);
     48   }
     49 }