blob: 6145b8eae65bcdafcb1992067adb9f734be0e3ca [file] [log] [blame]
Howard Hinnant70505302010-06-17 00:34:59 +00001// -*- C++ -*-
2//===-------------------------- algorithm ---------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11// <regex>
12
13// class regex_error
14// : public runtime_error
15// {
16// public:
17// explicit regex_error(regex_constants::error_type ecode);
18// regex_constants::error_type code() const;
19// };
20
21#include <regex>
22#include <cassert>
23
24int main()
25{
26 {
27 std::regex_error e(std::regex_constants::error_collate);
28 assert(e.code() == std::regex_constants::error_collate);
29 assert(e.what() == std::string("error_collate"));
30 }
31 {
32 std::regex_error e(std::regex_constants::error_ctype);
33 assert(e.code() == std::regex_constants::error_ctype);
34 assert(e.what() == std::string("error_ctype"));
35 }
36 {
37 std::regex_error e(std::regex_constants::error_escape);
38 assert(e.code() == std::regex_constants::error_escape);
39 assert(e.what() == std::string("error_escape"));
40 }
41 {
42 std::regex_error e(std::regex_constants::error_backref);
43 assert(e.code() == std::regex_constants::error_backref);
44 assert(e.what() == std::string("error_backref"));
45 }
46 {
47 std::regex_error e(std::regex_constants::error_brack);
48 assert(e.code() == std::regex_constants::error_brack);
49 assert(e.what() == std::string("error_brack"));
50 }
51 {
52 std::regex_error e(std::regex_constants::error_paren);
53 assert(e.code() == std::regex_constants::error_paren);
54 assert(e.what() == std::string("error_paren"));
55 }
56 {
57 std::regex_error e(std::regex_constants::error_brace);
58 assert(e.code() == std::regex_constants::error_brace);
59 assert(e.what() == std::string("error_brace"));
60 }
61 {
62 std::regex_error e(std::regex_constants::error_badbrace);
63 assert(e.code() == std::regex_constants::error_badbrace);
64 assert(e.what() == std::string("error_badbrace"));
65 }
66 {
67 std::regex_error e(std::regex_constants::error_range);
68 assert(e.code() == std::regex_constants::error_range);
69 assert(e.what() == std::string("error_range"));
70 }
71 {
72 std::regex_error e(std::regex_constants::error_space);
73 assert(e.code() == std::regex_constants::error_space);
74 assert(e.what() == std::string("error_space"));
75 }
76 {
77 std::regex_error e(std::regex_constants::error_badrepeat);
78 assert(e.code() == std::regex_constants::error_badrepeat);
79 assert(e.what() == std::string("error_badrepeat"));
80 }
81 {
82 std::regex_error e(std::regex_constants::error_complexity);
83 assert(e.code() == std::regex_constants::error_complexity);
84 assert(e.what() == std::string("error_complexity"));
85 }
86 {
87 std::regex_error e(std::regex_constants::error_stack);
88 assert(e.code() == std::regex_constants::error_stack);
89 assert(e.what() == std::string("error_stack"));
90 }
91}