211 {
212 std::string s1;
213 std::string s2 = "foo";
214 std::string s3 = " foo \r\nAbc";
215 std::string s4 = " \r\n foo ";
216 std::string s5 = "foo,bar";
217 std::string s6 = "foo;bar";
218 std::string s7 = "foo;baz,bar";
219 std::string s8 = "foo;bar;baz";
220 std::string s9 = "foo;bar=baz";
221 std::string s10 = "foo;bar=baz;boo";
222 std::string s11 = "foo;bar=baz;boo,bob";
223 std::string s12 = "foo;bar=\"a b c\"";
224 std::string s13 = "foo;bar=\"a \\\"b\\\" c\"";
225
226
227 std::string sx = "foo;bar=\"a \\\"b\\\" c\"";
230 std::string::const_iterator it;
231
233
235 BOOST_CHECK( it == s1.begin() );
236
239 BOOST_CHECK( it == s2.end() );
240 BOOST_CHECK_EQUAL(
p.
size(), 1 );
241 BOOST_CHECK(
p[0].first ==
"foo" );
242 BOOST_CHECK_EQUAL(
p[0].second.
size(), 0 );
243
246 BOOST_CHECK( it == s3.begin()+5 );
247 BOOST_CHECK_EQUAL(
p.
size(), 1 );
248 BOOST_CHECK(
p[0].first ==
"foo" );
249 BOOST_CHECK_EQUAL(
p[0].second.
size(), 0 );
250
253 BOOST_CHECK( it == s4.end() );
254 BOOST_CHECK_EQUAL(
p.
size(), 1 );
255 BOOST_CHECK(
p[0].first ==
"foo" );
256 BOOST_CHECK_EQUAL(
p[0].second.
size(), 0 );
257
260 BOOST_CHECK( it == s5.end() );
261 BOOST_CHECK_EQUAL(
p.
size(), 2 );
262 BOOST_CHECK(
p[0].first ==
"foo" );
263 BOOST_CHECK_EQUAL(
p[0].second.
size(), 0 );
264 BOOST_CHECK(
p[1].first ==
"bar" );
265 BOOST_CHECK_EQUAL(
p[1].second.
size(), 0 );
266
269 BOOST_CHECK( it == s6.end() );
270 BOOST_CHECK_EQUAL(
p.
size(), 1 );
271 BOOST_CHECK(
p[0].first ==
"foo" );
273 BOOST_CHECK_EQUAL(
a.size(), 1 );
274 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
275 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"" );
276
279 BOOST_CHECK( it == s7.end() );
280 BOOST_CHECK_EQUAL(
p.
size(), 2 );
281 BOOST_CHECK(
p[0].first ==
"foo" );
283 BOOST_CHECK_EQUAL(
a.size(), 1 );
284 BOOST_CHECK(
a.find(
"baz") !=
a.end() );
285 BOOST_CHECK_EQUAL(
a.find(
"baz")->second,
"" );
286 BOOST_CHECK(
p[1].first ==
"bar" );
288 BOOST_CHECK_EQUAL(
a.size(), 0 );
289
292 BOOST_CHECK( it == s8.end() );
293 BOOST_CHECK_EQUAL(
p.
size(), 1 );
294 BOOST_CHECK(
p[0].first ==
"foo" );
296 BOOST_CHECK_EQUAL(
a.size(), 2 );
297 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
298 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"" );
299 BOOST_CHECK(
a.find(
"baz") !=
a.end() );
300 BOOST_CHECK_EQUAL(
a.find(
"baz")->second,
"" );
301
304 BOOST_CHECK( it == s9.end() );
305 BOOST_CHECK_EQUAL(
p.
size(), 1 );
306 BOOST_CHECK(
p[0].first ==
"foo" );
308 BOOST_CHECK_EQUAL(
a.size(), 1 );
309 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
310 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"baz" );
311
314 BOOST_CHECK( it == s10.end() );
315 BOOST_CHECK_EQUAL(
p.
size(), 1 );
316 BOOST_CHECK(
p[0].first ==
"foo" );
318 BOOST_CHECK_EQUAL(
a.size(), 2 );
319 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
320 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"baz" );
321 BOOST_CHECK(
a.find(
"boo") !=
a.end() );
322 BOOST_CHECK_EQUAL(
a.find(
"boo")->second,
"" );
323
326 BOOST_CHECK( it == s11.end() );
327 BOOST_CHECK_EQUAL(
p.
size(), 2 );
328 BOOST_CHECK(
p[0].first ==
"foo" );
330 BOOST_CHECK_EQUAL(
a.size(), 2 );
331 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
332 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"baz" );
333 BOOST_CHECK(
a.find(
"boo") !=
a.end() );
334 BOOST_CHECK_EQUAL(
a.find(
"boo")->second,
"" );
336 BOOST_CHECK_EQUAL(
a.size(), 0 );
337
340 BOOST_CHECK( it == s12.end() );
341 BOOST_CHECK_EQUAL(
p.
size(), 1 );
342 BOOST_CHECK(
p[0].first ==
"foo" );
344 BOOST_CHECK_EQUAL(
a.size(), 1 );
345 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
346 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"a b c" );
347
350 BOOST_CHECK( it == s13.end() );
351 BOOST_CHECK_EQUAL(
p.
size(), 1 );
352 BOOST_CHECK(
p[0].first ==
"foo" );
354 BOOST_CHECK_EQUAL(
a.size(), 1 );
355 BOOST_CHECK(
a.find(
"bar") !=
a.end() );
356 BOOST_CHECK_EQUAL(
a.find(
"bar")->second,
"a \"b\" c" );
357}
InputIterator extract_parameters(InputIterator begin, InputIterator end, parameter_list ¶meters)
Extract HTTP parameters.
std::vector< std::pair< std::string, attribute_list > > parameter_list
The type of an HTTP parameter list.