MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / multimatch

Method multimatch

test/testregex.cpp:124–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 }
123
124 void multimatch() const {
125 const auto r = assertRegex("info:.*");
126
127 std::string input =
128 "info: start\n"
129 "info: init\n"
130 "warn: missing\n"
131 "warn: invalid\n"
132 "info: done\n"
133 "error: notclean\n";
134
135 std::list<std::string> matches;
136 auto f = [&](int start, int end) {
137 matches.push_back(input.substr(start, end - start));
138 };
139 ASSERT_EQUALS("", r->match(input, std::move(f)));
140 ASSERT_EQUALS(3, matches.size());
141 auto it = matches.cbegin();
142 ASSERT_EQUALS("info: start", *it);
143 ASSERT_EQUALS("info: init", *(++it));
144 ASSERT_EQUALS("info: done", *(++it));
145 }
146
147 void partialmatch() const {
148 const auto r = assertRegex("123");

Callers

nothing calls this directly

Calls 3

push_backMethod · 0.45
matchMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected