xref: /llvm-project/libcxx/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp (revision e3f89a989a23b9bfcb9f9d01172cebb63db627e1)
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <regex>
10 
11 // template <class charT, class traits = regex_traits<charT>> class basic_regex;
12 
13 // basic_regex& assign(const charT* ptr, size_t len, flag_type f);
14 
15 #include <regex>
16 #include <cassert>
17 #include "test_macros.h"
18 
main(int,char **)19 int main(int, char**)
20 {
21     std::regex r0;
22     r0.assign("(a([bc]))", 9);
23     assert(r0.flags() == std::regex::ECMAScript);
24     assert(r0.mark_count() == 2);
25 
26     std::regex r1;
27     r1.assign("(a([bc]))", 9, std::regex::ECMAScript);
28     assert(r1.flags() == std::regex::ECMAScript);
29     assert(r1.mark_count() == 2);
30 
31     std::regex r2;
32     r2.assign("(a([bc]))", 9, std::regex::extended);
33     assert(r2.flags() == std::regex::extended);
34     assert(r2.mark_count() == 2);
35 
36   return 0;
37 }
38