| 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 |
// <system_error> |
| 10 |
|
| 11 |
// class error_category |
| 12 |
|
| 13 |
// virtual string message(int ev) const = 0; |
| 14 |
|
| 15 |
#include <system_error> |
| 16 |
#include <cassert> |
| 17 |
#include <string> |
| 18 |
|
| 19 |
#include <stdio.h> |
| 20 |
|
| 21 |
#include "test_macros.h" |
| 22 |
|
| 23 |
int main(int, char**) { |
| 24 |
const std::error_category& e_cat1 = std::generic_category(); |
| 25 |
const std::error_category& e_cat2 = std::system_category(); |
| 26 |
std::string m1 = e_cat1.message(5); |
| 27 |
std::string m2 = e_cat2.message(5); |
| 28 |
std::string m3 = e_cat2.message(6); |
| 29 |
assert(!m1.empty()); |
| 30 |
assert(!m2.empty()); |
| 31 |
assert(!m3.empty()); |
| 32 |
LIBCPP_ASSERT(m1 == m2); |
| 33 |
assert(m1 != m3); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |