Howard Hinnant | 7026a17 | 2010-08-13 18:11:23 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | 7026a17 | 2010-08-13 18:11:23 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <regex> |
| 11 | |
| 12 | // template <class charT, class traits = regex_traits<charT>> class basic_regex; |
| 13 | |
| 14 | // template <class InputIterator> |
| 15 | // basic_regex& |
| 16 | // assign(InputIterator first, InputIterator last, |
| 17 | // flag_type f = regex_constants::ECMAScript); |
| 18 | |
| 19 | #include <regex> |
| 20 | #include <cassert> |
| 21 | |
Marshall Clow | 83e2c4d | 2013-01-05 03:21:01 +0000 | [diff] [blame] | 22 | #include "test_iterators.h" |
Howard Hinnant | 7026a17 | 2010-08-13 18:11:23 +0000 | [diff] [blame] | 23 | |
| 24 | int main() |
| 25 | { |
| 26 | typedef input_iterator<std::string::const_iterator> I; |
| 27 | typedef forward_iterator<std::string::const_iterator> F; |
| 28 | std::string s4("(a([bc]))"); |
| 29 | std::regex r2; |
| 30 | |
| 31 | r2.assign(I(s4.begin()), I(s4.end())); |
| 32 | assert(r2.flags() == std::regex::ECMAScript); |
| 33 | assert(r2.mark_count() == 2); |
| 34 | |
| 35 | r2.assign(I(s4.begin()), I(s4.end()), std::regex::extended); |
| 36 | assert(r2.flags() == std::regex::extended); |
| 37 | assert(r2.mark_count() == 2); |
| 38 | |
| 39 | r2.assign(F(s4.begin()), F(s4.end())); |
| 40 | assert(r2.flags() == std::regex::ECMAScript); |
| 41 | assert(r2.mark_count() == 2); |
| 42 | |
| 43 | r2.assign(F(s4.begin()), F(s4.end()), std::regex::extended); |
| 44 | assert(r2.flags() == std::regex::extended); |
| 45 | assert(r2.mark_count() == 2); |
| 46 | } |