• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
main(int,char **)23 int main(int, char**)
24 {
25     const std::error_category& e_cat1 = std::generic_category();
26     const std::error_category& e_cat2 = std::system_category();
27     std::string m1 = e_cat1.message(5);
28     std::string m2 = e_cat2.message(5);
29     std::string m3 = e_cat2.message(6);
30     assert(!m1.empty());
31     assert(!m2.empty());
32     assert(!m3.empty());
33     assert(m1 == m2);
34     assert(m1 != m3);
35 
36   return 0;
37 }
38