Home | History | Annotate | Download | only in class.file_status
      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 // file_type type() const noexcept;
     17 // perms permissions(p) const 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   const file_status st(file_type::regular, perms::owner_read);
     28 
     29   // type test
     30   {
     31     static_assert(noexcept(st.type()),
     32                   "operation must be noexcept");
     33     static_assert(std::is_same<decltype(st.type()), file_type>::value,
     34                  "operation must return file_type");
     35     assert(st.type() == file_type::regular);
     36   }
     37   // permissions test
     38   {
     39     static_assert(noexcept(st.permissions()),
     40                   "operation must be noexcept");
     41     static_assert(std::is_same<decltype(st.permissions()), perms>::value,
     42                  "operation must return perms");
     43     assert(st.permissions() == perms::owner_read);
     44   }
     45 }
     46