| 142 | |
| 143 | template<class F> |
| 144 | static |
| 145 | void |
| 146 | grind(string_view s, F const& f, |
| 147 | const parse_options& po = parse_options()) |
| 148 | { |
| 149 | try |
| 150 | { |
| 151 | grind_one(s, {}, f, po); |
| 152 | |
| 153 | fail_loop([&](storage_ptr const& sp) |
| 154 | { |
| 155 | grind_one(s, sp, f, po); |
| 156 | }); |
| 157 | |
| 158 | if(s.size() > 1) |
| 159 | { |
| 160 | // Destroy the stream_parser at every |
| 161 | // split point to check leaks. |
| 162 | for(std::size_t i = 1; |
| 163 | i < s.size(); ++i) |
| 164 | { |
| 165 | fail_resource mr; |
| 166 | mr.fail_max = 0; |
| 167 | stream_parser p(storage_ptr(), po); |
| 168 | system::error_code ec; |
| 169 | p.reset(&mr); |
| 170 | p.write(s.data(), i, ec); |
| 171 | if(BOOST_TEST(! ec)) |
| 172 | p.write( |
| 173 | s.data() + i, |
| 174 | s.size() - i, ec); |
| 175 | if(BOOST_TEST(! ec)) |
| 176 | p.finish(ec); |
| 177 | if(BOOST_TEST(! ec)) |
| 178 | f(p.release(), po); |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | catch(std::exception const&) |
| 183 | { |
| 184 | BOOST_TEST_FAIL(); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | static |
| 189 | void |
nothing calls this directly
no test coverage detected