MCPcopy Create free account
hub / github.com/boostorg/parser / main

Function main

test/parser.cpp:231–3260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231int main()
232{
233
234 msvc_only();
235 rule_example();
236
237 // basic
238 {
239 constexpr auto parser_1 = char_ >> char_;
240 constexpr auto parser_2 = char_ >> char_ >> char_;
241 constexpr auto parser_3 = char_ | char_;
242 constexpr auto parser_4 = char_('a') | char_('b') | char_('c');
243 constexpr auto parser_5 = char_('a') | char_('b') | eps;
244
245 {
246 std::string str = "a";
247 BOOST_TEST(parse(str, char_));
248 BOOST_TEST(!parse(str, char_('b')));
249 }
250 {
251 std::string str = "a";
252 char c = '\0';
253 BOOST_TEST(parse(str, char_, c));
254 BOOST_TEST(c == 'a');
255 BOOST_TEST(!parse(str, char_('b')));
256 }
257 {
258 std::string str = "b";
259 char c = '\0';
260 BOOST_TEST(parse(str, char_("ab"), c));
261 BOOST_TEST(c == 'b');
262 BOOST_TEST(!parse(str, char_("cd")));
263 }
264 {
265 std::string str = "b";
266 char c = '\0';
267 std::string const pattern_1 = "ab";
268 std::string const pattern_2 = "cd";
269 BOOST_TEST(parse(str, char_(pattern_1), c));
270 BOOST_TEST(c == 'b');
271 BOOST_TEST(!parse(str, char_(pattern_2)));
272 }
273 {
274 std::string str = "b";
275 char c = '\0';
276 BOOST_TEST(parse(str, char_('a', 'b'), c));
277 BOOST_TEST(c == 'b');
278 BOOST_TEST(!parse(str, char_('c', 'd')));
279 }
280 {
281 std::string str = " ";
282 BOOST_TEST(parse(str, blank));
283 BOOST_TEST(!parse(str, lower));
284 }
285 {
286 std::string str = "ab";
287 BOOST_TEST(!parse(str, char_));
288 {

Callers

nothing calls this directly

Calls 15

msvc_onlyFunction · 0.85
rule_exampleFunction · 0.85
prefix_parseFunction · 0.85
with_error_handlerFunction · 0.85
_attrFunction · 0.85
repeatFunction · 0.85
litFunction · 0.85
attrFunction · 0.85
print_printableFunction · 0.85
printFunction · 0.85
parseFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected