1 ///////////////////////////////////////////////////////////////////////////////
2 // test10.hpp
3 //
4 // Copyright 2008 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>
get_test_cases()14 boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
15 {
16 typedef typename boost::iterator_value<BidiIterT>::type char_type;
17 typedef xpr_test_case<BidiIterT> xpr_test_case;
18 typedef basic_regex<BidiIterT> regex_type;
19
20 static char_type const *nilbr = 0;
21 static xpr_test_case const test_cases[] =
22 {
23 xpr_test_case
24 (
25 "test16"
26 , L("foobarboo")
27 , regex_type(L('b') >> +_ >> L("ar") >> eos)
28 , no_match
29 )
30 , xpr_test_case
31 (
32 "test17"
33 , L("foobarboo")
34 , regex_type(L('b') >> +_ >> L('o') >> eos)
35 , backrefs(L("barboo"), nilbr)
36 )
37 , xpr_test_case
38 (
39 "test18"
40 , L("foobarboo")
41 , regex_type(L('b') >> +_ >> L("oo") >> eos)
42 , backrefs(L("barboo"), nilbr)
43 )
44 , xpr_test_case
45 (
46 "test19"
47 , L("+1234.56789F")
48 , regex_type(bos >> (s1= !(set=L('-'),L('+')) >> +range(L('0'),L('9'))
49 >> !(s2= L('.') >> *range(L('0'),L('9'))))
50 >> (s3= (set=L('C'),L('F'))) >> eos)
51 , backrefs(L("+1234.56789F"), L("+1234.56789"), L(".56789"), L("F"), nilbr)
52 )
53 , xpr_test_case
54 (
55 "test20"
56 , L("+1234.56789")
57 , regex_type( !(s1= as_xpr(L('+'))|L('-')) >> (s2= +range(L('0'),L('9')) >> !as_xpr(L('.')) >> *range(L('0'),L('9')) |
58 L('.') >> +range(L('0'),L('9'))) >> !(s3= (set=L('e'),L('E')) >> !(s4= as_xpr(L('+'))|L('-')) >> +range(L('0'),L('9'))))
59 , backrefs(L("+1234.56789"), L("+"), L("1234.56789"), L(""), L(""), nilbr)
60 )
61 };
62
63 return boost::make_iterator_range(test_cases);
64 }
65
66