brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 2e9d764 Raw
53 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++1410 11// <filesystem>12 13// class file_status14 15// void type(file_type) noexcept;16// void permissions(perms) noexcept;17 18#include <filesystem>19#include <type_traits>20#include <cassert>21 22#include "test_macros.h"23namespace fs = std::filesystem;24 25int main(int, char**) {26  using namespace fs;27 28  file_status st;29 30  // type test31  {32    static_assert(noexcept(st.type(file_type::regular)),33                  "operation must be noexcept");34    static_assert(std::is_same<decltype(st.type(file_type::regular)), void>::value,35                 "operation must return void");36    assert(st.type() != file_type::regular);37    st.type(file_type::regular);38    assert(st.type() == file_type::regular);39  }40  // permissions test41  {42    static_assert(noexcept(st.permissions(perms::owner_read)),43                  "operation must be noexcept");44    static_assert(std::is_same<decltype(st.permissions(perms::owner_read)), void>::value,45                 "operation must return void");46    assert(st.permissions() != perms::owner_read);47    st.permissions(perms::owner_read);48    assert(st.permissions() == perms::owner_read);49  }50 51  return 0;52}53