blob: 060fb20edb433e341e7602956787c6a559ddccd6 [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
16#include <regex>
17#include <cassert>
18
19template <class CharT>
20void
21test(const CharT* p, std::regex_constants::syntax_option_type f, unsigned mc)
22{
23 std::basic_regex<CharT> r(p, f);
24 assert(r.flags() == f);
25 assert(r.mark_count() == mc);
26}
27
28int main()
29{
30 test("", std::regex_constants::basic, 0);
31 test("\\(a\\)", std::regex_constants::basic, 1);
32 test("\\(a[bc]\\)", std::regex_constants::basic, 1);
33 test("\\(a\\([bc]\\)\\)", std::regex_constants::basic, 2);
34 test("(a([bc]))", std::regex_constants::basic, 0);
35}