]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/regex/test/regress/test_grep.cpp
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
15 #pragma warning(disable:4127)
22 // basically check all our restart types - line, word, etc
23 // checking each one for null and non-null matches.
25 using namespace boost::regex_constants
;
26 TEST_REGEX_SEARCH("a", perl
|nosubs
, " a a a aa", match_default
, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
27 TEST_REGEX_SEARCH("a+b+", perl
|nosubs
, "aabaabbb ab", match_default
, make_array(0, 3, -2, 3, 8, -2, 9, 11, -2, -2));
28 TEST_REGEX_SEARCH("a(b*|c|e)d", perl
|nosubs
, "adabbdacd", match_default
, make_array(0, 2, -2, 2, 6, -2, 6, 9, -2, -2));
29 TEST_REGEX_SEARCH("a", perl
|nosubs
, "\na\na\na\naa", match_default
, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
30 TEST_REGEX_SEARCH("^", perl
|nosubs
, " \n\n \n\n\n", match_default
, make_array(0, 0, -2, 4, 4, -2, 5, 5, -2, 8, 8, -2, 9, 9, -2, 10, 10, -2, -2));
31 TEST_REGEX_SEARCH("^ab", perl
|nosubs
, "ab \nab ab\n", match_default
, make_array(0, 2, -2, 5, 7, -2, -2));
32 TEST_REGEX_SEARCH("^[^\\n]*\n", perl
|nosubs
, " \n \n\n \n", match_default
, make_array(0, 4, -2, 4, 7, -2, 7, 8, -2, 8, 11, -2, -2));
33 TEST_REGEX_SEARCH("\\<abc", perl
|nosubs
, "abcabc abc\n\nabc", match_default
, make_array(0, 3, -2, 7, 10, -2, 12, 15, -2, -2));
34 TEST_REGEX_SEARCH("\\<", perl
|nosubs
, " ab a aaa ", match_default
, make_array(2, 2, -2, 5, 5, -2, 7, 7, -2, -2));
35 TEST_REGEX_SEARCH("\\<\\w+\\W+", perl
|nosubs
, " aa aa a ", match_default
, make_array(1, 5, -2, 5, 9, -2, 9, 11, -2, -2));
37 TEST_REGEX_SEARCH("\\Aabc", perl
|nosubs
, "abc abc", match_default
, make_array(0, 3, -2, -2));
38 TEST_REGEX_SEARCH("\\G\\w+\\W+", perl
|nosubs
, "abc abc a cbbb ", match_default
, make_array(0, 5, -2, 5, 9, -2, 9, 11, -2, 11, 18, -2, -2));
39 TEST_REGEX_SEARCH("\\Ga+b+", perl
|nosubs
, "aaababb abb", match_default
, make_array(0, 4, -2, 4, 7, -2, -2));
40 TEST_REGEX_SEARCH("abc", perl
|nosubs
, "abc", match_default
, make_array(0, 3, -2, -2));
41 TEST_REGEX_SEARCH("abc", perl
|nosubs
, " abc abcabc", match_default
, make_array(1, 4, -2, 5, 8, -2, 8, 11, -2, -2));
42 TEST_REGEX_SEARCH("\\n\\n", perl
|nosubs
, " \n\n\n \n \n\n\n\n ", match_default
, make_array(1, 3, -2, 18, 20, -2, 20, 22, -2, -2));
43 TEST_REGEX_SEARCH("$", perl
|nosubs
, " \n\n \n\n\n", match_default
, make_array(3, 3, -2, 4, 4, -2, 7, 7, -2, 8, 8, -2, 9, 9, -2, 10, 10, -2, -2));
44 TEST_REGEX_SEARCH("\\b", perl
|nosubs
, " abb a abbb ", match_default
, make_array(2, 2, -2, 5, 5, -2, 6, 6, -2, 7, 7, -2, 8, 8, -2, 12, 12, -2, -2));
45 TEST_REGEX_SEARCH("A", perl
|icase
|nosubs
, " a a a aa", match_default
, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
46 TEST_REGEX_SEARCH("A+B+", perl
|icase
|nosubs
, "aabaabbb ab", match_default
, make_array(0, 3, -2, 3, 8, -2, 9, 11, -2, -2));
47 TEST_REGEX_SEARCH("A(B*|c|e)D", perl
|icase
|nosubs
, "adabbdacd", match_default
, make_array(0, 2, -2, 2, 6, -2, 6, 9, -2, -2));
48 TEST_REGEX_SEARCH("A", perl
|icase
|nosubs
, "\na\na\na\naa", match_default
, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
49 TEST_REGEX_SEARCH("^aB", perl
|icase
|nosubs
, "Ab \nab Ab\n", match_default
, make_array(0, 2, -2, 5, 7, -2, -2));
50 TEST_REGEX_SEARCH("\\<abc", perl
|icase
|nosubs
, "Abcabc aBc\n\nabc", match_default
, make_array(0, 3, -2, 7, 10, -2, 12, 15, -2, -2));
51 TEST_REGEX_SEARCH("ABC", perl
|icase
|nosubs
, "abc", match_default
, make_array(0, 3, -2, -2));
52 TEST_REGEX_SEARCH("abc", perl
|icase
|nosubs
, " ABC ABCABC ", match_default
, make_array(1, 4, -2, 5, 8, -2, 8, 11, -2, -2));
53 TEST_REGEX_SEARCH("a|\\Ab", perl
, "b ab", match_default
, make_array(0, 1, -2, 2, 3, -2, -2));
54 TEST_REGEX_SEARCH("a|^b", perl
, "b ab\nb", match_default
, make_array(0, 1, -2, 2, 3, -2, 5, 6, -2, -2));
55 TEST_REGEX_SEARCH("a|\\<b", perl
, "b ab\nb", match_default
, make_array(0, 1, -2, 2, 3, -2, 5, 6, -2, -2));
57 TEST_REGEX_SEARCH("\\Aabc", perl
, "abcabc", match_default
, make_array(0, 3, -2, -2));
58 TEST_REGEX_SEARCH("^abc", perl
, "abcabc", match_default
, make_array(0, 3, -2, -2));
59 TEST_REGEX_SEARCH("\\<abc", perl
, "abcabc", match_default
, make_array(0, 3, -2, -2));
60 TEST_REGEX_SEARCH("\\babc", perl
, "abcabc", match_default
, make_array(0, 3, -2, -2));
61 TEST_REGEX_SEARCH("(?<=\\Aabc)?abc", perl
, "abcabc", match_default
, make_array(0, 3, -2, 3, 6, -2, -2));
62 TEST_REGEX_SEARCH("(?<=^abc)?abc", perl
, "abcabc", match_default
, make_array(0, 3, -2, 3, 6, -2, -2));
63 TEST_REGEX_SEARCH("(?<=\\<abc)?abc", perl
, "abcabc", match_default
, make_array(0, 3, -2, 3, 6, -2, -2));
64 TEST_REGEX_SEARCH("(?<=\\babc)?abc", perl
, "abcabc", match_default
, make_array(0, 3, -2, 3, 6, -2, -2));
65 TEST_REGEX_SEARCH("(?<=^).{2}|(?<=^.{3}).{2}", perl
, "123456789", match_default
, make_array(0, 2, -2, 3, 5, -2, -2));