Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/xpressive/test/test7.hpp @ 69

Last change on this file since 69 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.5 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2// test7.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//
13template<typename BidiIterT>
14boost::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            "test127"
26          , L("foobar")
27          , regex_type(as_xpr(L("foo")) >> /*This is a comment[*/ L("bar"))
28          , backrefs(L("foobar"), nilbr)
29        )
30      , test_case
31        (
32            "test128"
33          , L("foobar")
34          , regex_type(bos >> L("foobar") >> eos)
35          , backrefs(L("foobar"), nilbr)
36        )
37      , test_case
38        (
39            "test129"
40          , L("foobar")
41          , regex_type(bos >> L('f') >> *as_xpr(L('o')))
42          , backrefs(L("foo"), nilbr)
43        )
44      , test_case
45        (
46            "test129.1"
47          , L("foobar")
48          , regex_type(bos >> L('f') >> *as_xpr(L('\157')))
49          , backrefs(L("foo"), nilbr)
50        )
51      , test_case
52        (
53            "test130"
54          , L("foo bar")
55          , regex_type(bos >> L("foo bar") >> eos)
56          , backrefs(L("foo bar"), nilbr)
57        )
58      , test_case
59        (
60            "test131"
61          , L("foo bar")
62          , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar") >> eos)
63          , backrefs(L("foo bar"), nilbr)
64        )
65      , test_case
66        (
67            "test132"
68          , L("foo bar")
69          , regex_type(bos >> (L("foo") >> set[L(' ')] >> L("bar")) >> eos /*This is a comment*/)
70          , backrefs(L("foo bar"), nilbr)
71        )
72      , test_case
73        (
74            "test133"
75          , L("foo bar")
76          , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar") /*This is a comment*/)
77          , backrefs(L("foo bar"), nilbr)
78        )
79      , test_case
80        (
81            "test134"
82          , L("foo bar#Thisisnotacomment")
83          , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar#Thisisnotacomment"))
84          , backrefs(L("foo bar#Thisisnotacomment"), nilbr)
85        )
86      , test_case
87        (
88            "test135"
89          , L("f oo b ar")
90          , regex_type(bos >> L("f oo b ar"))
91          , backrefs(L("f oo b ar"), nilbr)
92        )
93      , test_case
94        (
95            "test137"
96          , L("a--")
97          , regex_type(bos >> *(s1= optional(L('a'))) >> eos)
98          , no_match
99        )
100      , test_case
101        (
102            "test138"
103          , L("a--")
104          , regex_type(bos >> -*(s1= optional(L('a'))) >> eos)
105          , no_match
106        )
107      , test_case
108        (
109            "test139"
110          , L("bc")
111          , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
112          , backrefs(L("bc"), L(""), nilbr)
113        )
114      , test_case
115        (
116            "test140"
117          , L("bbc")
118          , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
119          , backrefs(L("bbc"), L(""), nilbr)
120        )
121    };
122
123    return boost::make_iterator_range(test_cases);
124}
Note: See TracBrowser for help on using the repository browser.