55 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++14, c++1710 11// <filesystem>12 13// class file_status14 15// friend bool operator==(const file_status& lhs, const file_status& rhs) noexcept16// { return lhs.type() == rhs.type() && lhs.permissions() == rhs.permissions(); } // C++2017 18#include <cassert>19#include <filesystem>20 21#include "test_comparisons.h"22 23void test() {24 {25 std::filesystem::file_status f1;26 std::filesystem::file_status f2;27 28 assert(testEquality(f1, f2, true));29 }30 {31 std::filesystem::file_status f1{std::filesystem::file_type::regular, std::filesystem::perms::owner_read};32 std::filesystem::file_status f2{std::filesystem::file_type::regular, std::filesystem::perms::owner_read};33 34 assert(testEquality(f1, f2, true));35 }36 {37 std::filesystem::file_status f1{std::filesystem::file_type::regular, std::filesystem::perms::owner_read};38 std::filesystem::file_status f2{std::filesystem::file_type::none, std::filesystem::perms::owner_read};39 40 assert(testEquality(f1, f2, false));41 }42 {43 std::filesystem::file_status f1{std::filesystem::file_type::regular, std::filesystem::perms::owner_read};44 std::filesystem::file_status f2{std::filesystem::file_type::regular, std::filesystem::perms::owner_write};45 46 assert(testEquality(f1, f2, false));47 }48}49 50int main(int, char**) {51 test();52 53 return 0;54}55