| 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 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 9 | |
| 10 | // <system_error> |
| 11 | |
| 12 | // class error_category |
| 13 | |
| 14 | // strong_ordering operator<=>(const error_category& rhs) const noexcept; |
| 15 | |
| 16 | #include <system_error> |
| 17 | #include <cassert> |
| 18 | |
| 19 | #include "test_macros.h" |
| 20 | #include "test_comparisons.h" |
| 21 | |
| 22 | int main(int, char**) { |
| 23 | AssertOrderAreNoexcept<std::error_category>(); |
| 24 | AssertOrderReturn<std::strong_ordering, std::error_category>(); |
| 25 | |
| 26 | const std::error_category& e_cat1 = std::generic_category(); |
| 27 | const std::error_category& e_cat2 = std::generic_category(); |
| 28 | const std::error_category& e_cat3 = std::system_category(); |
| 29 | |
| 30 | assert(testOrder(e_cat1, e_cat2, std::strong_ordering::equal)); |
| 31 | |
| 32 | bool isLess = e_cat1 < e_cat3; |
| 33 | assert(testOrder(e_cat1, e_cat3, isLess ? std::strong_ordering::less : std::strong_ordering::greater)); |
| 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |