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

Function main

test/parser_api.cpp:30–2110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28{};
29
30int main()
31{
32
33// full_parse_api
34{
35 std::string const str = "a";
36
37 // attr out param, iter/sent
38 {
39 char out = 0;
40 auto first = str.c_str();
41 BOOST_TEST(prefix_parse(
42 first, boost::parser::detail::text::null_sentinel, char_, out));
43 first = str.c_str();
44 BOOST_TEST(out == 'a');
45 out = 0;
46 first = str.c_str();
47 BOOST_TEST(!prefix_parse(
48 first,
49 boost::parser::detail::text::null_sentinel,
50 char_('b'),
51 out));
52 BOOST_TEST(out == 0);
53 }
54 // attr out param, range
55 {
56 char out = 0;
57 BOOST_TEST(parse(str, char_, out));
58 BOOST_TEST(out == 'a');
59 out = 0;
60 BOOST_TEST(!parse(str, char_('b'), out));
61 BOOST_TEST(out == 0);
62 }
63 // attr out param, pointer-as-range
64 {
65 char out = 0;
66 BOOST_TEST(parse(null_term(str.c_str()), char_, out));
67 BOOST_TEST(out == 'a');
68 out = 0;
69 BOOST_TEST(!parse(null_term(str.c_str()), char_('b'), out));
70 BOOST_TEST(out == 0);
71 }
72
73 // returned attr, iter/sent
74 {
75 auto first = str.c_str();
76 BOOST_TEST(prefix_parse(
77 first, boost::parser::detail::text::null_sentinel, char_));
78 first = str.c_str();
79 BOOST_TEST(
80 *prefix_parse(
81 first, boost::parser::detail::text::null_sentinel, char_) ==
82 'a');
83 first = str.c_str();
84 BOOST_TEST(!prefix_parse(
85 first, boost::parser::detail::text::null_sentinel, char_('b')));
86 }
87 // returned attr, range

Callers

nothing calls this directly

Calls 13

prefix_parseFunction · 0.85
null_termFunction · 0.85
callback_prefix_parseFunction · 0.85
_attrFunction · 0.85
repeatFunction · 0.85
with_error_handlerFunction · 0.85
parseFunction · 0.50
getFunction · 0.50
stringClass · 0.50
beginMethod · 0.45
endMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected