MCPcopy Create free account
hub / github.com/boostorg/json / grind

Method grind

test/double.cpp:144–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

parse_optionsClass · 0.85
fail_loopFunction · 0.85
finishMethod · 0.80
fFunction · 0.70
storage_ptrClass · 0.50
sizeMethod · 0.45
resetMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected