brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · dcbbbd7 Raw
49 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// file_type type() const noexcept;16// perms permissions(p) const 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  const file_status st(file_type::regular, perms::owner_read);29 30  // type test31  {32    static_assert(noexcept(st.type()),33                  "operation must be noexcept");34    static_assert(std::is_same<decltype(st.type()), file_type>::value,35                 "operation must return file_type");36    assert(st.type() == file_type::regular);37  }38  // permissions test39  {40    static_assert(noexcept(st.permissions()),41                  "operation must be noexcept");42    static_assert(std::is_same<decltype(st.permissions()), perms>::value,43                 "operation must return perms");44    assert(st.permissions() == perms::owner_read);45  }46 47  return 0;48}49