Howard Hinnant | 853aff8 | 2010-06-25 20:56:08 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <regex> |
| 11 | |
| 12 | // template <class charT, class traits = regex_traits<charT>> class basic_regex; |
| 13 | |
| 14 | // basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); |
| 15 | |
Howard Hinnant | e5561b0 | 2010-06-29 18:37:43 +0000 | [diff] [blame^] | 16 | #include <iostream> |
| 17 | |
Howard Hinnant | 853aff8 | 2010-06-25 20:56:08 +0000 | [diff] [blame] | 18 | #include <regex> |
| 19 | #include <cassert> |
| 20 | |
| 21 | template <class CharT> |
| 22 | void |
| 23 | test(const CharT* p, std::regex_constants::syntax_option_type f, unsigned mc) |
| 24 | { |
| 25 | std::basic_regex<CharT> r(p, f); |
| 26 | assert(r.flags() == f); |
| 27 | assert(r.mark_count() == mc); |
| 28 | } |
| 29 | |
| 30 | int main() |
| 31 | { |
| 32 | test("", std::regex_constants::basic, 0); |
| 33 | test("\\(a\\)", std::regex_constants::basic, 1); |
| 34 | test("\\(a[bc]\\)", std::regex_constants::basic, 1); |
| 35 | test("\\(a\\([bc]\\)\\)", std::regex_constants::basic, 2); |
| 36 | test("(a([bc]))", std::regex_constants::basic, 0); |
| 37 | } |