| 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-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// UNSUPPORTED: c++03, c++11, c++14 |
| 10 |
|
| 11 |
// <filesystem> |
| 12 |
|
| 13 |
// class directory_entry |
| 14 |
|
| 15 |
// bool operator==(directory_entry const&) const noexcept; |
| 16 |
// bool operator!=(directory_entry const&) const noexcept; |
| 17 |
// bool operator< (directory_entry const&) const noexcept; |
| 18 |
// bool operator<=(directory_entry const&) const noexcept; |
| 19 |
// bool operator> (directory_entry const&) const noexcept; |
| 20 |
// bool operator>=(directory_entry const&) const noexcept; |
| 21 |
// strong_ordering operator<=>(directory_entry const&) const noexcept; |
| 22 |
|
| 23 |
#include <filesystem> |
| 24 |
#include <cassert> |
| 25 |
#include <type_traits> |
| 26 |
#include <utility> |
| 27 |
|
| 28 |
#include "test_macros.h" |
| 29 |
#include "test_comparisons.h" |
| 30 |
namespace fs = std::filesystem; |
| 31 |
|
| 32 |
int main(int, char**) { |
| 33 |
using namespace fs; |
| 34 |
|
| 35 |
AssertComparisonsAreNoexcept<directory_entry>(); |
| 36 |
AssertComparisonsReturnBool<directory_entry>(); |
| 37 |
#if TEST_STD_VER > 17 |
| 38 |
AssertOrderAreNoexcept<directory_entry>(); |
| 39 |
AssertOrderReturn<std::strong_ordering, directory_entry>(); |
| 40 |
#endif |
| 41 |
|
| 42 |
typedef std::pair<path, path> TestType; |
| 43 |
TestType TestCases[] = {{"", ""}, {"", "a"}, {"a", "a"}, {"a", "b"}, {"foo/bar/baz", "foo/bar/baz/"}}; |
| 44 |
for (auto const& TC : TestCases) { |
| 45 |
assert(testComparisonsValues<directory_entry>(TC.first, TC.second)); |
| 46 |
assert(testComparisonsValues<directory_entry>(TC.second, TC.first)); |
| 47 |
#if TEST_STD_VER > 17 |
| 48 |
assert(testOrderValues<directory_entry>(TC.first, TC.second)); |
| 49 |
assert(testOrderValues<directory_entry>(TC.second, TC.first)); |
| 50 |
#endif |
| 51 |
} |
| 52 |
|
| 53 |
return 0; |
| 54 |
} |