blob: f2d7c81430747e75cb7e4b9f406b5c14fb64b032 [file] [log] [blame]
Howard Hinnant853aff82010-06-25 20:56:08 +00001//===----------------------------------------------------------------------===//
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 Hinnante5561b02010-06-29 18:37:43 +000016#include <iostream>
17
Howard Hinnant853aff82010-06-25 20:56:08 +000018#include <regex>
19#include <cassert>
20
21template <class CharT>
22void
23test(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
30int 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}