test9.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // test9.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. #include "./test.hpp"
  8. ///////////////////////////////////////////////////////////////////////////////
  9. // get_test_cases
  10. //
  11. template<typename BidiIterT>
  12. boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
  13. {
  14. typedef typename boost::iterator_value<BidiIterT>::type char_type;
  15. typedef xpr_test_case<BidiIterT> xpr_test_case;
  16. typedef basic_regex<BidiIterT> regex_type;
  17. static char_type const *nilbr = 0;
  18. static xpr_test_case const test_cases[] =
  19. {
  20. xpr_test_case
  21. (
  22. "test151"
  23. , L("bbbc")
  24. , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
  25. , backrefs(L("bbbc"), L("b"), nilbr)
  26. )
  27. , xpr_test_case
  28. (
  29. "test152"
  30. , L("bbbbc")
  31. , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
  32. , no_match
  33. )
  34. , xpr_test_case
  35. (
  36. "test153"
  37. , L("bbbbc")
  38. , regex_type(bos >> *(s1= -optional(L('b'))) >> L('d') >> eos)
  39. , no_match
  40. )
  41. , xpr_test_case
  42. (
  43. "test154"
  44. , L("bc")
  45. , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
  46. , backrefs(L("bc"), L(""), nilbr)
  47. )
  48. , xpr_test_case
  49. (
  50. "test155"
  51. , L("bbc")
  52. , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
  53. , backrefs(L("bbc"), L("b"), nilbr)
  54. )
  55. , xpr_test_case
  56. (
  57. "test156"
  58. , L("bbbc")
  59. , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
  60. , backrefs(L("bbbc"), L("b"), nilbr)
  61. )
  62. , xpr_test_case
  63. (
  64. "test157"
  65. , L("bbbbc")
  66. , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
  67. , no_match
  68. )
  69. , xpr_test_case
  70. (
  71. "test158"
  72. , L("bbbbc")
  73. , regex_type(bos >> -*(s1= -optional(L('b'))) >> L('d') >> eos)
  74. , no_match
  75. )
  76. , xpr_test_case
  77. (
  78. "test159"
  79. , L("bbc")
  80. , regex_type(bos >> *(s1= nil | nil | nil | L('b')) >> L("bc") >> eos)
  81. , backrefs(L("bbc"), L(""), nilbr)
  82. )
  83. , xpr_test_case
  84. (
  85. "test160"
  86. , L("bbc")
  87. , regex_type(bos >> -*(s1= nil | nil | nil | L('b')) >> L("bc") >> eos)
  88. , backrefs(L("bbc"), L("b"), nilbr)
  89. )
  90. , xpr_test_case
  91. (
  92. "test164"
  93. , L("1yzZ^aAc2")
  94. , regex_type(icase(+range(L('Z'),L('a'))))
  95. , backrefs(L("zZ^aA"), nilbr)
  96. )
  97. , xpr_test_case
  98. (
  99. "test165"
  100. , L("1yzZ^aAc2")
  101. , regex_type(+range(L('Z'),L('a')))
  102. , backrefs(L("Z^a"), nilbr)
  103. )
  104. };
  105. return boost::make_iterator_range(test_cases);
  106. }