summaryrefslogtreecommitdiffstats
path: root/libcxx/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp
blob: f2d7c81430747e75cb7e4b9f406b5c14fb64b032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <regex>

// template <class charT, class traits = regex_traits<charT>> class basic_regex;

// basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);

#include <iostream>

#include <regex>
#include <cassert>

template <class CharT>
void
test(const CharT* p, std::regex_constants::syntax_option_type f, unsigned mc)
{
    std::basic_regex<CharT> r(p, f);
    assert(r.flags() == f);
    assert(r.mark_count() == mc);
}

int main()
{
    test("", std::regex_constants::basic, 0);
    test("\\(a\\)", std::regex_constants::basic, 1);
    test("\\(a[bc]\\)", std::regex_constants::basic, 1);
    test("\\(a\\([bc]\\)\\)", std::regex_constants::basic, 2);
    test("(a([bc]))", std::regex_constants::basic, 0);
}
OpenPOWER on IntegriCloud