[29] | 1 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // test8.hpp |
---|
| 3 | // |
---|
| 4 | // Copyright 2004 Eric Niebler. Distributed under the Boost |
---|
| 5 | // Software License, Version 1.0. (See accompanying file |
---|
| 6 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
| 7 | |
---|
| 8 | #include "./test.hpp" |
---|
| 9 | |
---|
| 10 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 11 | // get_test_cases |
---|
| 12 | // |
---|
| 13 | template<typename BidiIterT> |
---|
| 14 | boost::iterator_range<test_case<BidiIterT> const *> get_test_cases() |
---|
| 15 | { |
---|
| 16 | typedef typename boost::iterator_value<BidiIterT>::type char_type; |
---|
| 17 | typedef test_case<BidiIterT> test_case; |
---|
| 18 | typedef basic_regex<BidiIterT> regex_type; |
---|
| 19 | |
---|
| 20 | static char_type const *nilbr = 0; |
---|
| 21 | static test_case const test_cases[] = |
---|
| 22 | { |
---|
| 23 | test_case |
---|
| 24 | ( |
---|
| 25 | "test141" |
---|
| 26 | , L("bbbc") |
---|
| 27 | , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos) |
---|
| 28 | , backrefs(L("bbbc"), L("b"), nilbr) |
---|
| 29 | ) |
---|
| 30 | , test_case |
---|
| 31 | ( |
---|
| 32 | "test142" |
---|
| 33 | , L("bbbbc") |
---|
| 34 | , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos) |
---|
| 35 | , no_match |
---|
| 36 | ) |
---|
| 37 | , test_case |
---|
| 38 | ( |
---|
| 39 | "test143" |
---|
| 40 | , L("bbbbc") |
---|
| 41 | , regex_type(bos >> *(s1= optional(L('b'))) >> L('d') >> eos) |
---|
| 42 | , no_match |
---|
| 43 | ) |
---|
| 44 | , test_case |
---|
| 45 | ( |
---|
| 46 | "test144" |
---|
| 47 | , L("bc") |
---|
| 48 | , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos) |
---|
| 49 | , backrefs(L("bc"), L(""), nilbr) |
---|
| 50 | ) |
---|
| 51 | , test_case |
---|
| 52 | ( |
---|
| 53 | "test145" |
---|
| 54 | , L("bbc") |
---|
| 55 | , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos) |
---|
| 56 | , backrefs(L("bbc"), L(""), nilbr) |
---|
| 57 | ) |
---|
| 58 | , test_case |
---|
| 59 | ( |
---|
| 60 | "test146" |
---|
| 61 | , L("bbbc") |
---|
| 62 | , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos) |
---|
| 63 | , backrefs(L("bbbc"), L("b"), nilbr) |
---|
| 64 | ) |
---|
| 65 | , test_case |
---|
| 66 | ( |
---|
| 67 | "test147" |
---|
| 68 | , L("bbbbc") |
---|
| 69 | , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos) |
---|
| 70 | , no_match |
---|
| 71 | ) |
---|
| 72 | , test_case |
---|
| 73 | ( |
---|
| 74 | "test148" |
---|
| 75 | , L("bbbbc") |
---|
| 76 | , regex_type(bos >> -*(s1= optional(L('b'))) >> L('d') >> eos) |
---|
| 77 | , no_match |
---|
| 78 | ) |
---|
| 79 | , test_case |
---|
| 80 | ( |
---|
| 81 | "test149" |
---|
| 82 | , L("bc") |
---|
| 83 | , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos) |
---|
| 84 | , backrefs(L("bc"), L(""), nilbr) |
---|
| 85 | ) |
---|
| 86 | , test_case |
---|
| 87 | ( |
---|
| 88 | "test150" |
---|
| 89 | , L("bbc") |
---|
| 90 | , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos) |
---|
| 91 | , backrefs(L("bbc"), L("b"), nilbr) |
---|
| 92 | ) |
---|
| 93 | }; |
---|
| 94 | |
---|
| 95 | return boost::make_iterator_range(test_cases); |
---|
| 96 | } |
---|