brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · ecd0451 Raw
38 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <regex>10 11// template <class charT, class traits = regex_traits<charT>> class basic_regex;12 13// template <class ST, class SA>14//    basic_regex(const basic_string<charT, ST, SA>& s);15 16#include <regex>17#include <cassert>18#include "test_macros.h"19 20template <class String>21void22test(const String& p, unsigned mc)23{24    std::basic_regex<typename String::value_type> r(p);25    assert(r.flags() == std::regex_constants::ECMAScript);26    assert(r.mark_count() == mc);27}28 29int main(int, char**)30{31    test(std::string("\\(a\\)"), 0);32    test(std::string("\\(a[bc]\\)"), 0);33    test(std::string("\\(a\\([bc]\\)\\)"), 0);34    test(std::string("(a([bc]))"), 2);35 36  return 0;37}38