1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "quiche/common/platform/api/quiche_test.h"
6 #include "quiche/common/structured_headers.h"
7
8 // This file contains tests cases for the Structured Header parser and
9 // serializer, taken from the public test case repository at
10 // https://github.com/httpwg/structured-field-tests. All of the tests are named,
11 // so a given test case can be found in the JSON files in that repository by
12 // searching for the test name. This file is generated, with the test cases
13 // being automatically translated from the JSON source to C++ unit tests. Please
14 // do not modify, as the contents will be overwritten when this is re-generated.
15
16 // Generated on 2022-03-15 from structured-field-tests.git @
17 // faed1f92942abd4fb5d61b1f9f0dc359f499f1d7.
18
19 namespace quiche {
20 namespace structured_headers {
21 namespace {
22
23 // Helpers to make test cases clearer
24
Integer(int64_t value)25 Item Integer(int64_t value) { return Item(value); }
26
BooleanParam(std::string key,bool value)27 std::pair<std::string, Item> BooleanParam(std::string key, bool value) {
28 return std::make_pair(key, Item(value));
29 }
30
DoubleParam(std::string key,double value)31 std::pair<std::string, Item> DoubleParam(std::string key, double value) {
32 return std::make_pair(key, Item(value));
33 }
34
Param(std::string key,int64_t value)35 std::pair<std::string, Item> Param(std::string key, int64_t value) {
36 return std::make_pair(key, Item(value));
37 }
38
Param(std::string key,std::string value)39 std::pair<std::string, Item> Param(std::string key, std::string value) {
40 return std::make_pair(key, Item(value));
41 }
42
TokenParam(std::string key,std::string value)43 std::pair<std::string, Item> TokenParam(std::string key, std::string value) {
44 return std::make_pair(key, Item(value, Item::kTokenType));
45 }
46
47 const struct ParameterizedItemTestCase {
48 const char* name;
49 const char* raw;
50 size_t raw_len;
51 const std::optional<ParameterizedItem>
52 expected; // nullopt if parse error is expected.
53 const char* canonical; // nullptr if parse error is expected, or if canonical
54 // format is identical to raw.
55 } parameterized_item_test_cases[] = {
56 // binary.json
57 {"basic binary",
58 ":aGVsbG8=:",
59 10,
60 {{Item("hello", Item::kByteSequenceType), {}}},
61 nullptr},
62 {"empty binary",
63 "::",
64 2,
65 {{Item("", Item::kByteSequenceType), {}}},
66 nullptr},
67 {"bad paddding",
68 ":aGVsbG8:",
69 9,
70 {{Item("hello", Item::kByteSequenceType), {}}},
71 ":aGVsbG8=:"},
72 {"bad end delimiter", ":aGVsbG8=", 9, std::nullopt, nullptr},
73 {"extra whitespace", ":aGVsb G8=:", 11, std::nullopt, nullptr},
74 {"extra chars", ":aGVsbG!8=:", 11, std::nullopt, nullptr},
75 {"suffix chars", ":aGVsbG8=!:", 11, std::nullopt, nullptr},
76 {"non-zero pad bits",
77 ":iZ==:",
78 6,
79 {{Item("\211", Item::kByteSequenceType), {}}},
80 ":iQ==:"},
81 {"non-ASCII binary",
82 ":/+Ah:",
83 6,
84 {{Item("\377\340!", Item::kByteSequenceType), {}}},
85 nullptr},
86 {"base64url binary", ":_-Ah:", 6, std::nullopt, nullptr},
87 // boolean.json
88 {"basic true boolean", "?1", 2, {{Item(true), {}}}, nullptr},
89 {"basic false boolean", "?0", 2, {{Item(false), {}}}, nullptr},
90 {"unknown boolean", "?Q", 2, std::nullopt, nullptr},
91 {"whitespace boolean", "? 1", 3, std::nullopt, nullptr},
92 {"negative zero boolean", "?-0", 3, std::nullopt, nullptr},
93 {"T boolean", "?T", 2, std::nullopt, nullptr},
94 {"F boolean", "?F", 2, std::nullopt, nullptr},
95 {"t boolean", "?t", 2, std::nullopt, nullptr},
96 {"f boolean", "?f", 2, std::nullopt, nullptr},
97 {"spelled-out True boolean", "?True", 5, std::nullopt, nullptr},
98 {"spelled-out False boolean", "?False", 6, std::nullopt, nullptr},
99 // examples.json
100 {"Foo-Example",
101 "2; foourl=\"https://foo.example.com/\"",
102 36,
103 {{Integer(2), {Param("foourl", "https://foo.example.com/")}}},
104 "2;foourl=\"https://foo.example.com/\""},
105 {"Example-IntHeader",
106 "1; a; b=?0",
107 10,
108 {{Integer(1), {BooleanParam("a", true), BooleanParam("b", false)}}},
109 "1;a;b=?0"},
110 {"Example-IntItemHeader", "5", 1, {{Integer(5), {}}}, nullptr},
111 {"Example-IntItemHeader (params)",
112 "5; foo=bar",
113 10,
114 {{Integer(5), {TokenParam("foo", "bar")}}},
115 "5;foo=bar"},
116 {"Example-IntegerHeader", "42", 2, {{Integer(42), {}}}, nullptr},
117 {"Example-FloatHeader", "4.5", 3, {{Item(4.500000), {}}}, nullptr},
118 {"Example-StringHeader",
119 "\"hello world\"",
120 13,
121 {{Item("hello world"), {}}},
122 nullptr},
123 {"Example-BinaryHdr",
124 ":cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg==:",
125 46,
126 {{Item("pretend this is binary content.", Item::kByteSequenceType), {}}},
127 nullptr},
128 {"Example-BoolHdr", "?1", 2, {{Item(true), {}}}, nullptr},
129 // item.json
130 {"empty item", "", 0, std::nullopt, nullptr},
131 {"leading space", " \t 1", 4, std::nullopt, nullptr},
132 {"trailing space", "1 \t ", 4, std::nullopt, nullptr},
133 {"leading and trailing space", " 1 ", 5, {{Integer(1), {}}}, "1"},
134 {"leading and trailing whitespace", " 1 ", 8, {{Integer(1), {}}}, "1"},
135 // number-generated.json
136 {"1 digits of zero", "0", 1, {{Integer(0), {}}}, "0"},
137 {"1 digit small integer", "1", 1, {{Integer(1), {}}}, nullptr},
138 {"1 digit large integer", "9", 1, {{Integer(9), {}}}, nullptr},
139 {"2 digits of zero", "00", 2, {{Integer(0), {}}}, "0"},
140 {"2 digit small integer", "11", 2, {{Integer(11), {}}}, nullptr},
141 {"2 digit large integer", "99", 2, {{Integer(99), {}}}, nullptr},
142 {"3 digits of zero", "000", 3, {{Integer(0), {}}}, "0"},
143 {"3 digit small integer", "111", 3, {{Integer(111), {}}}, nullptr},
144 {"3 digit large integer", "999", 3, {{Integer(999), {}}}, nullptr},
145 {"4 digits of zero", "0000", 4, {{Integer(0), {}}}, "0"},
146 {"4 digit small integer", "1111", 4, {{Integer(1111), {}}}, nullptr},
147 {"4 digit large integer", "9999", 4, {{Integer(9999), {}}}, nullptr},
148 {"5 digits of zero", "00000", 5, {{Integer(0), {}}}, "0"},
149 {"5 digit small integer", "11111", 5, {{Integer(11111), {}}}, nullptr},
150 {"5 digit large integer", "99999", 5, {{Integer(99999), {}}}, nullptr},
151 {"6 digits of zero", "000000", 6, {{Integer(0), {}}}, "0"},
152 {"6 digit small integer", "111111", 6, {{Integer(111111), {}}}, nullptr},
153 {"6 digit large integer", "999999", 6, {{Integer(999999), {}}}, nullptr},
154 {"7 digits of zero", "0000000", 7, {{Integer(0), {}}}, "0"},
155 {"7 digit small integer", "1111111", 7, {{Integer(1111111), {}}}, nullptr},
156 {"7 digit large integer", "9999999", 7, {{Integer(9999999), {}}}, nullptr},
157 {"8 digits of zero", "00000000", 8, {{Integer(0), {}}}, "0"},
158 {"8 digit small integer",
159 "11111111",
160 8,
161 {{Integer(11111111), {}}},
162 nullptr},
163 {"8 digit large integer",
164 "99999999",
165 8,
166 {{Integer(99999999), {}}},
167 nullptr},
168 {"9 digits of zero", "000000000", 9, {{Integer(0), {}}}, "0"},
169 {"9 digit small integer",
170 "111111111",
171 9,
172 {{Integer(111111111), {}}},
173 nullptr},
174 {"9 digit large integer",
175 "999999999",
176 9,
177 {{Integer(999999999), {}}},
178 nullptr},
179 {"10 digits of zero", "0000000000", 10, {{Integer(0), {}}}, "0"},
180 {"10 digit small integer",
181 "1111111111",
182 10,
183 {{Integer(1111111111), {}}},
184 nullptr},
185 {"10 digit large integer",
186 "9999999999",
187 10,
188 {{Integer(9999999999), {}}},
189 nullptr},
190 {"11 digits of zero", "00000000000", 11, {{Integer(0), {}}}, "0"},
191 {"11 digit small integer",
192 "11111111111",
193 11,
194 {{Integer(11111111111), {}}},
195 nullptr},
196 {"11 digit large integer",
197 "99999999999",
198 11,
199 {{Integer(99999999999), {}}},
200 nullptr},
201 {"12 digits of zero", "000000000000", 12, {{Integer(0), {}}}, "0"},
202 {"12 digit small integer",
203 "111111111111",
204 12,
205 {{Integer(111111111111), {}}},
206 nullptr},
207 {"12 digit large integer",
208 "999999999999",
209 12,
210 {{Integer(999999999999), {}}},
211 nullptr},
212 {"13 digits of zero", "0000000000000", 13, {{Integer(0), {}}}, "0"},
213 {"13 digit small integer",
214 "1111111111111",
215 13,
216 {{Integer(1111111111111), {}}},
217 nullptr},
218 {"13 digit large integer",
219 "9999999999999",
220 13,
221 {{Integer(9999999999999), {}}},
222 nullptr},
223 {"14 digits of zero", "00000000000000", 14, {{Integer(0), {}}}, "0"},
224 {"14 digit small integer",
225 "11111111111111",
226 14,
227 {{Integer(11111111111111), {}}},
228 nullptr},
229 {"14 digit large integer",
230 "99999999999999",
231 14,
232 {{Integer(99999999999999), {}}},
233 nullptr},
234 {"15 digits of zero", "000000000000000", 15, {{Integer(0), {}}}, "0"},
235 {"15 digit small integer",
236 "111111111111111",
237 15,
238 {{Integer(111111111111111), {}}},
239 nullptr},
240 {"15 digit large integer",
241 "999999999999999",
242 15,
243 {{Integer(999999999999999), {}}},
244 nullptr},
245 {"2 digit 0, 1 fractional small decimal",
246 "0.1",
247 3,
248 {{Item(0.100000), {}}},
249 "0.1"},
250 {"2 digit, 1 fractional 0 decimal",
251 "1.0",
252 3,
253 {{Item(1.000000), {}}},
254 "1.0"},
255 {"2 digit, 1 fractional small decimal",
256 "1.1",
257 3,
258 {{Item(1.100000), {}}},
259 nullptr},
260 {"2 digit, 1 fractional large decimal",
261 "9.9",
262 3,
263 {{Item(9.900000), {}}},
264 nullptr},
265 {"3 digit 0, 2 fractional small decimal",
266 "0.11",
267 4,
268 {{Item(0.110000), {}}},
269 "0.11"},
270 {"3 digit, 2 fractional 0 decimal",
271 "1.00",
272 4,
273 {{Item(1.000000), {}}},
274 "1.0"},
275 {"3 digit, 2 fractional small decimal",
276 "1.11",
277 4,
278 {{Item(1.110000), {}}},
279 nullptr},
280 {"3 digit, 2 fractional large decimal",
281 "9.99",
282 4,
283 {{Item(9.990000), {}}},
284 nullptr},
285 {"4 digit 0, 3 fractional small decimal",
286 "0.111",
287 5,
288 {{Item(0.111000), {}}},
289 "0.111"},
290 {"4 digit, 3 fractional 0 decimal",
291 "1.000",
292 5,
293 {{Item(1.000000), {}}},
294 "1.0"},
295 {"4 digit, 3 fractional small decimal",
296 "1.111",
297 5,
298 {{Item(1.111000), {}}},
299 nullptr},
300 {"4 digit, 3 fractional large decimal",
301 "9.999",
302 5,
303 {{Item(9.999000), {}}},
304 nullptr},
305 {"3 digit 0, 1 fractional small decimal",
306 "00.1",
307 4,
308 {{Item(0.100000), {}}},
309 "0.1"},
310 {"3 digit, 1 fractional 0 decimal",
311 "11.0",
312 4,
313 {{Item(11.000000), {}}},
314 "11.0"},
315 {"3 digit, 1 fractional small decimal",
316 "11.1",
317 4,
318 {{Item(11.100000), {}}},
319 nullptr},
320 {"3 digit, 1 fractional large decimal",
321 "99.9",
322 4,
323 {{Item(99.900000), {}}},
324 nullptr},
325 {"4 digit 0, 2 fractional small decimal",
326 "00.11",
327 5,
328 {{Item(0.110000), {}}},
329 "0.11"},
330 {"4 digit, 2 fractional 0 decimal",
331 "11.00",
332 5,
333 {{Item(11.000000), {}}},
334 "11.0"},
335 {"4 digit, 2 fractional small decimal",
336 "11.11",
337 5,
338 {{Item(11.110000), {}}},
339 nullptr},
340 {"4 digit, 2 fractional large decimal",
341 "99.99",
342 5,
343 {{Item(99.990000), {}}},
344 nullptr},
345 {"5 digit 0, 3 fractional small decimal",
346 "00.111",
347 6,
348 {{Item(0.111000), {}}},
349 "0.111"},
350 {"5 digit, 3 fractional 0 decimal",
351 "11.000",
352 6,
353 {{Item(11.000000), {}}},
354 "11.0"},
355 {"5 digit, 3 fractional small decimal",
356 "11.111",
357 6,
358 {{Item(11.111000), {}}},
359 nullptr},
360 {"5 digit, 3 fractional large decimal",
361 "99.999",
362 6,
363 {{Item(99.999000), {}}},
364 nullptr},
365 {"4 digit 0, 1 fractional small decimal",
366 "000.1",
367 5,
368 {{Item(0.100000), {}}},
369 "0.1"},
370 {"4 digit, 1 fractional 0 decimal",
371 "111.0",
372 5,
373 {{Item(111.000000), {}}},
374 "111.0"},
375 {"4 digit, 1 fractional small decimal",
376 "111.1",
377 5,
378 {{Item(111.100000), {}}},
379 nullptr},
380 {"4 digit, 1 fractional large decimal",
381 "999.9",
382 5,
383 {{Item(999.900000), {}}},
384 nullptr},
385 {"5 digit 0, 2 fractional small decimal",
386 "000.11",
387 6,
388 {{Item(0.110000), {}}},
389 "0.11"},
390 {"5 digit, 2 fractional 0 decimal",
391 "111.00",
392 6,
393 {{Item(111.000000), {}}},
394 "111.0"},
395 {"5 digit, 2 fractional small decimal",
396 "111.11",
397 6,
398 {{Item(111.110000), {}}},
399 nullptr},
400 {"5 digit, 2 fractional large decimal",
401 "999.99",
402 6,
403 {{Item(999.990000), {}}},
404 nullptr},
405 {"6 digit 0, 3 fractional small decimal",
406 "000.111",
407 7,
408 {{Item(0.111000), {}}},
409 "0.111"},
410 {"6 digit, 3 fractional 0 decimal",
411 "111.000",
412 7,
413 {{Item(111.000000), {}}},
414 "111.0"},
415 {"6 digit, 3 fractional small decimal",
416 "111.111",
417 7,
418 {{Item(111.111000), {}}},
419 nullptr},
420 {"6 digit, 3 fractional large decimal",
421 "999.999",
422 7,
423 {{Item(999.999000), {}}},
424 nullptr},
425 {"5 digit 0, 1 fractional small decimal",
426 "0000.1",
427 6,
428 {{Item(0.100000), {}}},
429 "0.1"},
430 {"5 digit, 1 fractional 0 decimal",
431 "1111.0",
432 6,
433 {{Item(1111.000000), {}}},
434 "1111.0"},
435 {"5 digit, 1 fractional small decimal",
436 "1111.1",
437 6,
438 {{Item(1111.100000), {}}},
439 nullptr},
440 {"5 digit, 1 fractional large decimal",
441 "9999.9",
442 6,
443 {{Item(9999.900000), {}}},
444 nullptr},
445 {"6 digit 0, 2 fractional small decimal",
446 "0000.11",
447 7,
448 {{Item(0.110000), {}}},
449 "0.11"},
450 {"6 digit, 2 fractional 0 decimal",
451 "1111.00",
452 7,
453 {{Item(1111.000000), {}}},
454 "1111.0"},
455 {"6 digit, 2 fractional small decimal",
456 "1111.11",
457 7,
458 {{Item(1111.110000), {}}},
459 nullptr},
460 {"6 digit, 2 fractional large decimal",
461 "9999.99",
462 7,
463 {{Item(9999.990000), {}}},
464 nullptr},
465 {"7 digit 0, 3 fractional small decimal",
466 "0000.111",
467 8,
468 {{Item(0.111000), {}}},
469 "0.111"},
470 {"7 digit, 3 fractional 0 decimal",
471 "1111.000",
472 8,
473 {{Item(1111.000000), {}}},
474 "1111.0"},
475 {"7 digit, 3 fractional small decimal",
476 "1111.111",
477 8,
478 {{Item(1111.111000), {}}},
479 nullptr},
480 {"7 digit, 3 fractional large decimal",
481 "9999.999",
482 8,
483 {{Item(9999.999000), {}}},
484 nullptr},
485 {"6 digit 0, 1 fractional small decimal",
486 "00000.1",
487 7,
488 {{Item(0.100000), {}}},
489 "0.1"},
490 {"6 digit, 1 fractional 0 decimal",
491 "11111.0",
492 7,
493 {{Item(11111.000000), {}}},
494 "11111.0"},
495 {"6 digit, 1 fractional small decimal",
496 "11111.1",
497 7,
498 {{Item(11111.100000), {}}},
499 nullptr},
500 {"6 digit, 1 fractional large decimal",
501 "99999.9",
502 7,
503 {{Item(99999.900000), {}}},
504 nullptr},
505 {"7 digit 0, 2 fractional small decimal",
506 "00000.11",
507 8,
508 {{Item(0.110000), {}}},
509 "0.11"},
510 {"7 digit, 2 fractional 0 decimal",
511 "11111.00",
512 8,
513 {{Item(11111.000000), {}}},
514 "11111.0"},
515 {"7 digit, 2 fractional small decimal",
516 "11111.11",
517 8,
518 {{Item(11111.110000), {}}},
519 nullptr},
520 {"7 digit, 2 fractional large decimal",
521 "99999.99",
522 8,
523 {{Item(99999.990000), {}}},
524 nullptr},
525 {"8 digit 0, 3 fractional small decimal",
526 "00000.111",
527 9,
528 {{Item(0.111000), {}}},
529 "0.111"},
530 {"8 digit, 3 fractional 0 decimal",
531 "11111.000",
532 9,
533 {{Item(11111.000000), {}}},
534 "11111.0"},
535 {"8 digit, 3 fractional small decimal",
536 "11111.111",
537 9,
538 {{Item(11111.111000), {}}},
539 nullptr},
540 {"8 digit, 3 fractional large decimal",
541 "99999.999",
542 9,
543 {{Item(99999.999000), {}}},
544 nullptr},
545 {"7 digit 0, 1 fractional small decimal",
546 "000000.1",
547 8,
548 {{Item(0.100000), {}}},
549 "0.1"},
550 {"7 digit, 1 fractional 0 decimal",
551 "111111.0",
552 8,
553 {{Item(111111.000000), {}}},
554 "111111.0"},
555 {"7 digit, 1 fractional small decimal",
556 "111111.1",
557 8,
558 {{Item(111111.100000), {}}},
559 nullptr},
560 {"7 digit, 1 fractional large decimal",
561 "999999.9",
562 8,
563 {{Item(999999.900000), {}}},
564 nullptr},
565 {"8 digit 0, 2 fractional small decimal",
566 "000000.11",
567 9,
568 {{Item(0.110000), {}}},
569 "0.11"},
570 {"8 digit, 2 fractional 0 decimal",
571 "111111.00",
572 9,
573 {{Item(111111.000000), {}}},
574 "111111.0"},
575 {"8 digit, 2 fractional small decimal",
576 "111111.11",
577 9,
578 {{Item(111111.110000), {}}},
579 nullptr},
580 {"8 digit, 2 fractional large decimal",
581 "999999.99",
582 9,
583 {{Item(999999.990000), {}}},
584 nullptr},
585 {"9 digit 0, 3 fractional small decimal",
586 "000000.111",
587 10,
588 {{Item(0.111000), {}}},
589 "0.111"},
590 {"9 digit, 3 fractional 0 decimal",
591 "111111.000",
592 10,
593 {{Item(111111.000000), {}}},
594 "111111.0"},
595 {"9 digit, 3 fractional small decimal",
596 "111111.111",
597 10,
598 {{Item(111111.111000), {}}},
599 nullptr},
600 {"9 digit, 3 fractional large decimal",
601 "999999.999",
602 10,
603 {{Item(999999.999000), {}}},
604 nullptr},
605 {"8 digit 0, 1 fractional small decimal",
606 "0000000.1",
607 9,
608 {{Item(0.100000), {}}},
609 "0.1"},
610 {"8 digit, 1 fractional 0 decimal",
611 "1111111.0",
612 9,
613 {{Item(1111111.000000), {}}},
614 "1111111.0"},
615 {"8 digit, 1 fractional small decimal",
616 "1111111.1",
617 9,
618 {{Item(1111111.100000), {}}},
619 nullptr},
620 {"8 digit, 1 fractional large decimal",
621 "9999999.9",
622 9,
623 {{Item(9999999.900000), {}}},
624 nullptr},
625 {"9 digit 0, 2 fractional small decimal",
626 "0000000.11",
627 10,
628 {{Item(0.110000), {}}},
629 "0.11"},
630 {"9 digit, 2 fractional 0 decimal",
631 "1111111.00",
632 10,
633 {{Item(1111111.000000), {}}},
634 "1111111.0"},
635 {"9 digit, 2 fractional small decimal",
636 "1111111.11",
637 10,
638 {{Item(1111111.110000), {}}},
639 nullptr},
640 {"9 digit, 2 fractional large decimal",
641 "9999999.99",
642 10,
643 {{Item(9999999.990000), {}}},
644 nullptr},
645 {"10 digit 0, 3 fractional small decimal",
646 "0000000.111",
647 11,
648 {{Item(0.111000), {}}},
649 "0.111"},
650 {"10 digit, 3 fractional 0 decimal",
651 "1111111.000",
652 11,
653 {{Item(1111111.000000), {}}},
654 "1111111.0"},
655 {"10 digit, 3 fractional small decimal",
656 "1111111.111",
657 11,
658 {{Item(1111111.111000), {}}},
659 nullptr},
660 {"10 digit, 3 fractional large decimal",
661 "9999999.999",
662 11,
663 {{Item(9999999.999000), {}}},
664 nullptr},
665 {"9 digit 0, 1 fractional small decimal",
666 "00000000.1",
667 10,
668 {{Item(0.100000), {}}},
669 "0.1"},
670 {"9 digit, 1 fractional 0 decimal",
671 "11111111.0",
672 10,
673 {{Item(11111111.000000), {}}},
674 "11111111.0"},
675 {"9 digit, 1 fractional small decimal",
676 "11111111.1",
677 10,
678 {{Item(11111111.100000), {}}},
679 nullptr},
680 {"9 digit, 1 fractional large decimal",
681 "99999999.9",
682 10,
683 {{Item(99999999.900000), {}}},
684 nullptr},
685 {"10 digit 0, 2 fractional small decimal",
686 "00000000.11",
687 11,
688 {{Item(0.110000), {}}},
689 "0.11"},
690 {"10 digit, 2 fractional 0 decimal",
691 "11111111.00",
692 11,
693 {{Item(11111111.000000), {}}},
694 "11111111.0"},
695 {"10 digit, 2 fractional small decimal",
696 "11111111.11",
697 11,
698 {{Item(11111111.110000), {}}},
699 nullptr},
700 {"10 digit, 2 fractional large decimal",
701 "99999999.99",
702 11,
703 {{Item(99999999.990000), {}}},
704 nullptr},
705 {"11 digit 0, 3 fractional small decimal",
706 "00000000.111",
707 12,
708 {{Item(0.111000), {}}},
709 "0.111"},
710 {"11 digit, 3 fractional 0 decimal",
711 "11111111.000",
712 12,
713 {{Item(11111111.000000), {}}},
714 "11111111.0"},
715 {"11 digit, 3 fractional small decimal",
716 "11111111.111",
717 12,
718 {{Item(11111111.111000), {}}},
719 nullptr},
720 {"11 digit, 3 fractional large decimal",
721 "99999999.999",
722 12,
723 {{Item(99999999.999000), {}}},
724 nullptr},
725 {"10 digit 0, 1 fractional small decimal",
726 "000000000.1",
727 11,
728 {{Item(0.100000), {}}},
729 "0.1"},
730 {"10 digit, 1 fractional 0 decimal",
731 "111111111.0",
732 11,
733 {{Item(111111111.000000), {}}},
734 "111111111.0"},
735 {"10 digit, 1 fractional small decimal",
736 "111111111.1",
737 11,
738 {{Item(111111111.100000), {}}},
739 nullptr},
740 {"10 digit, 1 fractional large decimal",
741 "999999999.9",
742 11,
743 {{Item(999999999.900000), {}}},
744 nullptr},
745 {"11 digit 0, 2 fractional small decimal",
746 "000000000.11",
747 12,
748 {{Item(0.110000), {}}},
749 "0.11"},
750 {"11 digit, 2 fractional 0 decimal",
751 "111111111.00",
752 12,
753 {{Item(111111111.000000), {}}},
754 "111111111.0"},
755 {"11 digit, 2 fractional small decimal",
756 "111111111.11",
757 12,
758 {{Item(111111111.110000), {}}},
759 nullptr},
760 {"11 digit, 2 fractional large decimal",
761 "999999999.99",
762 12,
763 {{Item(999999999.990000), {}}},
764 nullptr},
765 {"12 digit 0, 3 fractional small decimal",
766 "000000000.111",
767 13,
768 {{Item(0.111000), {}}},
769 "0.111"},
770 {"12 digit, 3 fractional 0 decimal",
771 "111111111.000",
772 13,
773 {{Item(111111111.000000), {}}},
774 "111111111.0"},
775 {"12 digit, 3 fractional small decimal",
776 "111111111.111",
777 13,
778 {{Item(111111111.111000), {}}},
779 nullptr},
780 {"12 digit, 3 fractional large decimal",
781 "999999999.999",
782 13,
783 {{Item(999999999.999000), {}}},
784 nullptr},
785 {"11 digit 0, 1 fractional small decimal",
786 "0000000000.1",
787 12,
788 {{Item(0.100000), {}}},
789 "0.1"},
790 {"11 digit, 1 fractional 0 decimal",
791 "1111111111.0",
792 12,
793 {{Item(1111111111.000000), {}}},
794 "1111111111.0"},
795 {"11 digit, 1 fractional small decimal",
796 "1111111111.1",
797 12,
798 {{Item(1111111111.100000), {}}},
799 nullptr},
800 {"11 digit, 1 fractional large decimal",
801 "9999999999.9",
802 12,
803 {{Item(9999999999.900000), {}}},
804 nullptr},
805 {"12 digit 0, 2 fractional small decimal",
806 "0000000000.11",
807 13,
808 {{Item(0.110000), {}}},
809 "0.11"},
810 {"12 digit, 2 fractional 0 decimal",
811 "1111111111.00",
812 13,
813 {{Item(1111111111.000000), {}}},
814 "1111111111.0"},
815 {"12 digit, 2 fractional small decimal",
816 "1111111111.11",
817 13,
818 {{Item(1111111111.110000), {}}},
819 nullptr},
820 {"12 digit, 2 fractional large decimal",
821 "9999999999.99",
822 13,
823 {{Item(9999999999.990000), {}}},
824 nullptr},
825 {"13 digit 0, 3 fractional small decimal",
826 "0000000000.111",
827 14,
828 {{Item(0.111000), {}}},
829 "0.111"},
830 {"13 digit, 3 fractional 0 decimal",
831 "1111111111.000",
832 14,
833 {{Item(1111111111.000000), {}}},
834 "1111111111.0"},
835 {"13 digit, 3 fractional small decimal",
836 "1111111111.111",
837 14,
838 {{Item(1111111111.111000), {}}},
839 nullptr},
840 {"13 digit, 3 fractional large decimal",
841 "9999999999.999",
842 14,
843 {{Item(9999999999.999001), {}}},
844 nullptr},
845 {"12 digit 0, 1 fractional small decimal",
846 "00000000000.1",
847 13,
848 {{Item(0.100000), {}}},
849 "0.1"},
850 {"12 digit, 1 fractional 0 decimal",
851 "11111111111.0",
852 13,
853 {{Item(11111111111.000000), {}}},
854 "11111111111.0"},
855 {"12 digit, 1 fractional small decimal",
856 "11111111111.1",
857 13,
858 {{Item(11111111111.100000), {}}},
859 nullptr},
860 {"12 digit, 1 fractional large decimal",
861 "99999999999.9",
862 13,
863 {{Item(99999999999.899994), {}}},
864 nullptr},
865 {"13 digit 0, 2 fractional small decimal",
866 "00000000000.11",
867 14,
868 {{Item(0.110000), {}}},
869 "0.11"},
870 {"13 digit, 2 fractional 0 decimal",
871 "11111111111.00",
872 14,
873 {{Item(11111111111.000000), {}}},
874 "11111111111.0"},
875 {"13 digit, 2 fractional small decimal",
876 "11111111111.11",
877 14,
878 {{Item(11111111111.110001), {}}},
879 nullptr},
880 {"13 digit, 2 fractional large decimal",
881 "99999999999.99",
882 14,
883 {{Item(99999999999.990005), {}}},
884 nullptr},
885 {"14 digit 0, 3 fractional small decimal",
886 "00000000000.111",
887 15,
888 {{Item(0.111000), {}}},
889 "0.111"},
890 {"14 digit, 3 fractional 0 decimal",
891 "11111111111.000",
892 15,
893 {{Item(11111111111.000000), {}}},
894 "11111111111.0"},
895 {"14 digit, 3 fractional small decimal",
896 "11111111111.111",
897 15,
898 {{Item(11111111111.111000), {}}},
899 nullptr},
900 {"14 digit, 3 fractional large decimal",
901 "99999999999.999",
902 15,
903 {{Item(99999999999.998993), {}}},
904 nullptr},
905 {"13 digit 0, 1 fractional small decimal",
906 "000000000000.1",
907 14,
908 {{Item(0.100000), {}}},
909 "0.1"},
910 {"13 digit, 1 fractional 0 decimal",
911 "111111111111.0",
912 14,
913 {{Item(111111111111.000000), {}}},
914 "111111111111.0"},
915 {"13 digit, 1 fractional small decimal",
916 "111111111111.1",
917 14,
918 {{Item(111111111111.100006), {}}},
919 nullptr},
920 {"13 digit, 1 fractional large decimal",
921 "999999999999.9",
922 14,
923 {{Item(999999999999.900024), {}}},
924 nullptr},
925 {"14 digit 0, 2 fractional small decimal",
926 "000000000000.11",
927 15,
928 {{Item(0.110000), {}}},
929 "0.11"},
930 {"14 digit, 2 fractional 0 decimal",
931 "111111111111.00",
932 15,
933 {{Item(111111111111.000000), {}}},
934 "111111111111.0"},
935 {"14 digit, 2 fractional small decimal",
936 "111111111111.11",
937 15,
938 {{Item(111111111111.110001), {}}},
939 nullptr},
940 {"14 digit, 2 fractional large decimal",
941 "999999999999.99",
942 15,
943 {{Item(999999999999.989990), {}}},
944 nullptr},
945 {"15 digit 0, 3 fractional small decimal",
946 "000000000000.111",
947 16,
948 {{Item(0.111000), {}}},
949 "0.111"},
950 {"15 digit, 3 fractional 0 decimal",
951 "111111111111.000",
952 16,
953 {{Item(111111111111.000000), {}}},
954 "111111111111.0"},
955 {"15 digit, 3 fractional small decimal",
956 "111111111111.111",
957 16,
958 {{Item(111111111111.110992), {}}},
959 nullptr},
960 {"15 digit, 3 fractional large decimal",
961 "999999999999.999",
962 16,
963 {{Item(999999999999.999023), {}}},
964 nullptr},
965 {"too many digit 0 decimal", "000000000000000.0", 17, std::nullopt,
966 nullptr},
967 {"too many fractional digits 0 decimal", "000000000000.0000", 17,
968 std::nullopt, nullptr},
969 {"too many digit 9 decimal", "999999999999999.9", 17, std::nullopt,
970 nullptr},
971 {"too many fractional digits 9 decimal", "999999999999.9999", 17,
972 std::nullopt, nullptr},
973 // number.json
974 {"basic integer", "42", 2, {{Integer(42), {}}}, nullptr},
975 {"zero integer", "0", 1, {{Integer(0), {}}}, nullptr},
976 {"negative zero", "-0", 2, {{Integer(0), {}}}, "0"},
977 {"double negative zero", "--0", 3, std::nullopt, nullptr},
978 {"negative integer", "-42", 3, {{Integer(-42), {}}}, nullptr},
979 {"leading 0 integer", "042", 3, {{Integer(42), {}}}, "42"},
980 {"leading 0 negative integer", "-042", 4, {{Integer(-42), {}}}, "-42"},
981 {"leading 0 zero", "00", 2, {{Integer(0), {}}}, "0"},
982 {"comma", "2,3", 3, std::nullopt, nullptr},
983 {"negative non-DIGIT first character", "-a23", 4, std::nullopt, nullptr},
984 {"sign out of place", "4-2", 3, std::nullopt, nullptr},
985 {"whitespace after sign", "- 42", 4, std::nullopt, nullptr},
986 {"long integer",
987 "123456789012345",
988 15,
989 {{Integer(123456789012345), {}}},
990 nullptr},
991 {"long negative integer",
992 "-123456789012345",
993 16,
994 {{Integer(-123456789012345), {}}},
995 nullptr},
996 {"too long integer", "1234567890123456", 16, std::nullopt, nullptr},
997 {"negative too long integer", "-1234567890123456", 17, std::nullopt,
998 nullptr},
999 {"simple decimal", "1.23", 4, {{Item(1.230000), {}}}, nullptr},
1000 {"negative decimal", "-1.23", 5, {{Item(-1.230000), {}}}, nullptr},
1001 {"decimal, whitespace after decimal", "1. 23", 5, std::nullopt, nullptr},
1002 {"decimal, whitespace before decimal", "1 .23", 5, std::nullopt, nullptr},
1003 {"negative decimal, whitespace after sign", "- 1.23", 6, std::nullopt,
1004 nullptr},
1005 {"tricky precision decimal",
1006 "123456789012.1",
1007 14,
1008 {{Item(123456789012.100006), {}}},
1009 nullptr},
1010 {"double decimal decimal", "1.5.4", 5, std::nullopt, nullptr},
1011 {"adjacent double decimal decimal", "1..4", 4, std::nullopt, nullptr},
1012 {"decimal with three fractional digits",
1013 "1.123",
1014 5,
1015 {{Item(1.123000), {}}},
1016 nullptr},
1017 {"negative decimal with three fractional digits",
1018 "-1.123",
1019 6,
1020 {{Item(-1.123000), {}}},
1021 nullptr},
1022 {"decimal with four fractional digits", "1.1234", 6, std::nullopt, nullptr},
1023 {"negative decimal with four fractional digits", "-1.1234", 7, std::nullopt,
1024 nullptr},
1025 {"decimal with thirteen integer digits", "1234567890123.0", 15,
1026 std::nullopt, nullptr},
1027 {"negative decimal with thirteen integer digits", "-1234567890123.0", 16,
1028 std::nullopt, nullptr},
1029 // string-generated.json
1030 {"0x00 in string", "\" \000 \"", 5, std::nullopt, nullptr},
1031 {"0x01 in string", "\" \001 \"", 5, std::nullopt, nullptr},
1032 {"0x02 in string", "\" \002 \"", 5, std::nullopt, nullptr},
1033 {"0x03 in string", "\" \003 \"", 5, std::nullopt, nullptr},
1034 {"0x04 in string", "\" \004 \"", 5, std::nullopt, nullptr},
1035 {"0x05 in string", "\" \005 \"", 5, std::nullopt, nullptr},
1036 {"0x06 in string", "\" \006 \"", 5, std::nullopt, nullptr},
1037 {"0x07 in string", "\" \a \"", 5, std::nullopt, nullptr},
1038 {"0x08 in string", "\" \b \"", 5, std::nullopt, nullptr},
1039 {"0x09 in string", "\" \t \"", 5, std::nullopt, nullptr},
1040 {"0x0a in string", "\" \n \"", 5, std::nullopt, nullptr},
1041 {"0x0b in string", "\" \v \"", 5, std::nullopt, nullptr},
1042 {"0x0c in string", "\" \f \"", 5, std::nullopt, nullptr},
1043 {"0x0d in string", "\" \r \"", 5, std::nullopt, nullptr},
1044 {"0x0e in string", "\" \016 \"", 5, std::nullopt, nullptr},
1045 {"0x0f in string", "\" \017 \"", 5, std::nullopt, nullptr},
1046 {"0x10 in string", "\" \020 \"", 5, std::nullopt, nullptr},
1047 {"0x11 in string", "\" \021 \"", 5, std::nullopt, nullptr},
1048 {"0x12 in string", "\" \022 \"", 5, std::nullopt, nullptr},
1049 {"0x13 in string", "\" \023 \"", 5, std::nullopt, nullptr},
1050 {"0x14 in string", "\" \024 \"", 5, std::nullopt, nullptr},
1051 {"0x15 in string", "\" \025 \"", 5, std::nullopt, nullptr},
1052 {"0x16 in string", "\" \026 \"", 5, std::nullopt, nullptr},
1053 {"0x17 in string", "\" \027 \"", 5, std::nullopt, nullptr},
1054 {"0x18 in string", "\" \030 \"", 5, std::nullopt, nullptr},
1055 {"0x19 in string", "\" \031 \"", 5, std::nullopt, nullptr},
1056 {"0x1a in string", "\" \032 \"", 5, std::nullopt, nullptr},
1057 {"0x1b in string", "\" \033 \"", 5, std::nullopt, nullptr},
1058 {"0x1c in string", "\" \034 \"", 5, std::nullopt, nullptr},
1059 {"0x1d in string", "\" \035 \"", 5, std::nullopt, nullptr},
1060 {"0x1e in string", "\" \036 \"", 5, std::nullopt, nullptr},
1061 {"0x1f in string", "\" \037 \"", 5, std::nullopt, nullptr},
1062 {"0x20 in string", "\" \"", 5, {{Item(" "), {}}}, nullptr},
1063 {"0x21 in string", "\" ! \"", 5, {{Item(" ! "), {}}}, nullptr},
1064 {"0x22 in string", "\" \" \"", 5, std::nullopt, nullptr},
1065 {"0x23 in string", "\" # \"", 5, {{Item(" # "), {}}}, nullptr},
1066 {"0x24 in string", "\" $ \"", 5, {{Item(" $ "), {}}}, nullptr},
1067 {"0x25 in string", "\" % \"", 5, {{Item(" % "), {}}}, nullptr},
1068 {"0x26 in string", "\" & \"", 5, {{Item(" & "), {}}}, nullptr},
1069 {"0x27 in string", "\" ' \"", 5, {{Item(" ' "), {}}}, nullptr},
1070 {"0x28 in string", "\" ( \"", 5, {{Item(" ( "), {}}}, nullptr},
1071 {"0x29 in string", "\" ) \"", 5, {{Item(" ) "), {}}}, nullptr},
1072 {"0x2a in string", "\" * \"", 5, {{Item(" * "), {}}}, nullptr},
1073 {"0x2b in string", "\" + \"", 5, {{Item(" + "), {}}}, nullptr},
1074 {"0x2c in string", "\" , \"", 5, {{Item(" , "), {}}}, nullptr},
1075 {"0x2d in string", "\" - \"", 5, {{Item(" - "), {}}}, nullptr},
1076 {"0x2e in string", "\" . \"", 5, {{Item(" . "), {}}}, nullptr},
1077 {"0x2f in string", "\" / \"", 5, {{Item(" / "), {}}}, nullptr},
1078 {"0x30 in string", "\" 0 \"", 5, {{Item(" 0 "), {}}}, nullptr},
1079 {"0x31 in string", "\" 1 \"", 5, {{Item(" 1 "), {}}}, nullptr},
1080 {"0x32 in string", "\" 2 \"", 5, {{Item(" 2 "), {}}}, nullptr},
1081 {"0x33 in string", "\" 3 \"", 5, {{Item(" 3 "), {}}}, nullptr},
1082 {"0x34 in string", "\" 4 \"", 5, {{Item(" 4 "), {}}}, nullptr},
1083 {"0x35 in string", "\" 5 \"", 5, {{Item(" 5 "), {}}}, nullptr},
1084 {"0x36 in string", "\" 6 \"", 5, {{Item(" 6 "), {}}}, nullptr},
1085 {"0x37 in string", "\" 7 \"", 5, {{Item(" 7 "), {}}}, nullptr},
1086 {"0x38 in string", "\" 8 \"", 5, {{Item(" 8 "), {}}}, nullptr},
1087 {"0x39 in string", "\" 9 \"", 5, {{Item(" 9 "), {}}}, nullptr},
1088 {"0x3a in string", "\" : \"", 5, {{Item(" : "), {}}}, nullptr},
1089 {"0x3b in string", "\" ; \"", 5, {{Item(" ; "), {}}}, nullptr},
1090 {"0x3c in string", "\" < \"", 5, {{Item(" < "), {}}}, nullptr},
1091 {"0x3d in string", "\" = \"", 5, {{Item(" = "), {}}}, nullptr},
1092 {"0x3e in string", "\" > \"", 5, {{Item(" > "), {}}}, nullptr},
1093 {"0x3f in string", "\" ? \"", 5, {{Item(" ? "), {}}}, nullptr},
1094 {"0x40 in string", "\" @ \"", 5, {{Item(" @ "), {}}}, nullptr},
1095 {"0x41 in string", "\" A \"", 5, {{Item(" A "), {}}}, nullptr},
1096 {"0x42 in string", "\" B \"", 5, {{Item(" B "), {}}}, nullptr},
1097 {"0x43 in string", "\" C \"", 5, {{Item(" C "), {}}}, nullptr},
1098 {"0x44 in string", "\" D \"", 5, {{Item(" D "), {}}}, nullptr},
1099 {"0x45 in string", "\" E \"", 5, {{Item(" E "), {}}}, nullptr},
1100 {"0x46 in string", "\" F \"", 5, {{Item(" F "), {}}}, nullptr},
1101 {"0x47 in string", "\" G \"", 5, {{Item(" G "), {}}}, nullptr},
1102 {"0x48 in string", "\" H \"", 5, {{Item(" H "), {}}}, nullptr},
1103 {"0x49 in string", "\" I \"", 5, {{Item(" I "), {}}}, nullptr},
1104 {"0x4a in string", "\" J \"", 5, {{Item(" J "), {}}}, nullptr},
1105 {"0x4b in string", "\" K \"", 5, {{Item(" K "), {}}}, nullptr},
1106 {"0x4c in string", "\" L \"", 5, {{Item(" L "), {}}}, nullptr},
1107 {"0x4d in string", "\" M \"", 5, {{Item(" M "), {}}}, nullptr},
1108 {"0x4e in string", "\" N \"", 5, {{Item(" N "), {}}}, nullptr},
1109 {"0x4f in string", "\" O \"", 5, {{Item(" O "), {}}}, nullptr},
1110 {"0x50 in string", "\" P \"", 5, {{Item(" P "), {}}}, nullptr},
1111 {"0x51 in string", "\" Q \"", 5, {{Item(" Q "), {}}}, nullptr},
1112 {"0x52 in string", "\" R \"", 5, {{Item(" R "), {}}}, nullptr},
1113 {"0x53 in string", "\" S \"", 5, {{Item(" S "), {}}}, nullptr},
1114 {"0x54 in string", "\" T \"", 5, {{Item(" T "), {}}}, nullptr},
1115 {"0x55 in string", "\" U \"", 5, {{Item(" U "), {}}}, nullptr},
1116 {"0x56 in string", "\" V \"", 5, {{Item(" V "), {}}}, nullptr},
1117 {"0x57 in string", "\" W \"", 5, {{Item(" W "), {}}}, nullptr},
1118 {"0x58 in string", "\" X \"", 5, {{Item(" X "), {}}}, nullptr},
1119 {"0x59 in string", "\" Y \"", 5, {{Item(" Y "), {}}}, nullptr},
1120 {"0x5a in string", "\" Z \"", 5, {{Item(" Z "), {}}}, nullptr},
1121 {"0x5b in string", "\" [ \"", 5, {{Item(" [ "), {}}}, nullptr},
1122 {"0x5c in string", "\" \\ \"", 5, std::nullopt, nullptr},
1123 {"0x5d in string", "\" ] \"", 5, {{Item(" ] "), {}}}, nullptr},
1124 {"0x5e in string", "\" ^ \"", 5, {{Item(" ^ "), {}}}, nullptr},
1125 {"0x5f in string", "\" _ \"", 5, {{Item(" _ "), {}}}, nullptr},
1126 {"0x60 in string", "\" ` \"", 5, {{Item(" ` "), {}}}, nullptr},
1127 {"0x61 in string", "\" a \"", 5, {{Item(" a "), {}}}, nullptr},
1128 {"0x62 in string", "\" b \"", 5, {{Item(" b "), {}}}, nullptr},
1129 {"0x63 in string", "\" c \"", 5, {{Item(" c "), {}}}, nullptr},
1130 {"0x64 in string", "\" d \"", 5, {{Item(" d "), {}}}, nullptr},
1131 {"0x65 in string", "\" e \"", 5, {{Item(" e "), {}}}, nullptr},
1132 {"0x66 in string", "\" f \"", 5, {{Item(" f "), {}}}, nullptr},
1133 {"0x67 in string", "\" g \"", 5, {{Item(" g "), {}}}, nullptr},
1134 {"0x68 in string", "\" h \"", 5, {{Item(" h "), {}}}, nullptr},
1135 {"0x69 in string", "\" i \"", 5, {{Item(" i "), {}}}, nullptr},
1136 {"0x6a in string", "\" j \"", 5, {{Item(" j "), {}}}, nullptr},
1137 {"0x6b in string", "\" k \"", 5, {{Item(" k "), {}}}, nullptr},
1138 {"0x6c in string", "\" l \"", 5, {{Item(" l "), {}}}, nullptr},
1139 {"0x6d in string", "\" m \"", 5, {{Item(" m "), {}}}, nullptr},
1140 {"0x6e in string", "\" n \"", 5, {{Item(" n "), {}}}, nullptr},
1141 {"0x6f in string", "\" o \"", 5, {{Item(" o "), {}}}, nullptr},
1142 {"0x70 in string", "\" p \"", 5, {{Item(" p "), {}}}, nullptr},
1143 {"0x71 in string", "\" q \"", 5, {{Item(" q "), {}}}, nullptr},
1144 {"0x72 in string", "\" r \"", 5, {{Item(" r "), {}}}, nullptr},
1145 {"0x73 in string", "\" s \"", 5, {{Item(" s "), {}}}, nullptr},
1146 {"0x74 in string", "\" t \"", 5, {{Item(" t "), {}}}, nullptr},
1147 {"0x75 in string", "\" u \"", 5, {{Item(" u "), {}}}, nullptr},
1148 {"0x76 in string", "\" v \"", 5, {{Item(" v "), {}}}, nullptr},
1149 {"0x77 in string", "\" w \"", 5, {{Item(" w "), {}}}, nullptr},
1150 {"0x78 in string", "\" x \"", 5, {{Item(" x "), {}}}, nullptr},
1151 {"0x79 in string", "\" y \"", 5, {{Item(" y "), {}}}, nullptr},
1152 {"0x7a in string", "\" z \"", 5, {{Item(" z "), {}}}, nullptr},
1153 {"0x7b in string", "\" { \"", 5, {{Item(" { "), {}}}, nullptr},
1154 {"0x7c in string", "\" | \"", 5, {{Item(" | "), {}}}, nullptr},
1155 {"0x7d in string", "\" } \"", 5, {{Item(" } "), {}}}, nullptr},
1156 {"0x7e in string", "\" ~ \"", 5, {{Item(" ~ "), {}}}, nullptr},
1157 {"0x7f in string", "\" \177 \"", 5, std::nullopt, nullptr},
1158 {"Escaped 0x00 in string", "\"\\\000\"", 4, std::nullopt, nullptr},
1159 {"Escaped 0x01 in string", "\"\\\001\"", 4, std::nullopt, nullptr},
1160 {"Escaped 0x02 in string", "\"\\\002\"", 4, std::nullopt, nullptr},
1161 {"Escaped 0x03 in string", "\"\\\003\"", 4, std::nullopt, nullptr},
1162 {"Escaped 0x04 in string", "\"\\\004\"", 4, std::nullopt, nullptr},
1163 {"Escaped 0x05 in string", "\"\\\005\"", 4, std::nullopt, nullptr},
1164 {"Escaped 0x06 in string", "\"\\\006\"", 4, std::nullopt, nullptr},
1165 {"Escaped 0x07 in string", "\"\\\a\"", 4, std::nullopt, nullptr},
1166 {"Escaped 0x08 in string", "\"\\\b\"", 4, std::nullopt, nullptr},
1167 {"Escaped 0x09 in string", "\"\\\t\"", 4, std::nullopt, nullptr},
1168 {"Escaped 0x0a in string", "\"\\\n\"", 4, std::nullopt, nullptr},
1169 {"Escaped 0x0b in string", "\"\\\v\"", 4, std::nullopt, nullptr},
1170 {"Escaped 0x0c in string", "\"\\\f\"", 4, std::nullopt, nullptr},
1171 {"Escaped 0x0d in string", "\"\\\r\"", 4, std::nullopt, nullptr},
1172 {"Escaped 0x0e in string", "\"\\\016\"", 4, std::nullopt, nullptr},
1173 {"Escaped 0x0f in string", "\"\\\017\"", 4, std::nullopt, nullptr},
1174 {"Escaped 0x10 in string", "\"\\\020\"", 4, std::nullopt, nullptr},
1175 {"Escaped 0x11 in string", "\"\\\021\"", 4, std::nullopt, nullptr},
1176 {"Escaped 0x12 in string", "\"\\\022\"", 4, std::nullopt, nullptr},
1177 {"Escaped 0x13 in string", "\"\\\023\"", 4, std::nullopt, nullptr},
1178 {"Escaped 0x14 in string", "\"\\\024\"", 4, std::nullopt, nullptr},
1179 {"Escaped 0x15 in string", "\"\\\025\"", 4, std::nullopt, nullptr},
1180 {"Escaped 0x16 in string", "\"\\\026\"", 4, std::nullopt, nullptr},
1181 {"Escaped 0x17 in string", "\"\\\027\"", 4, std::nullopt, nullptr},
1182 {"Escaped 0x18 in string", "\"\\\030\"", 4, std::nullopt, nullptr},
1183 {"Escaped 0x19 in string", "\"\\\031\"", 4, std::nullopt, nullptr},
1184 {"Escaped 0x1a in string", "\"\\\032\"", 4, std::nullopt, nullptr},
1185 {"Escaped 0x1b in string", "\"\\\033\"", 4, std::nullopt, nullptr},
1186 {"Escaped 0x1c in string", "\"\\\034\"", 4, std::nullopt, nullptr},
1187 {"Escaped 0x1d in string", "\"\\\035\"", 4, std::nullopt, nullptr},
1188 {"Escaped 0x1e in string", "\"\\\036\"", 4, std::nullopt, nullptr},
1189 {"Escaped 0x1f in string", "\"\\\037\"", 4, std::nullopt, nullptr},
1190 {"Escaped 0x20 in string", "\"\\ \"", 4, std::nullopt, nullptr},
1191 {"Escaped 0x21 in string", "\"\\!\"", 4, std::nullopt, nullptr},
1192 {"Escaped 0x22 in string", "\"\\\"\"", 4, {{Item("\""), {}}}, nullptr},
1193 {"Escaped 0x23 in string", "\"\\#\"", 4, std::nullopt, nullptr},
1194 {"Escaped 0x24 in string", "\"\\$\"", 4, std::nullopt, nullptr},
1195 {"Escaped 0x25 in string", "\"\\%\"", 4, std::nullopt, nullptr},
1196 {"Escaped 0x26 in string", "\"\\&\"", 4, std::nullopt, nullptr},
1197 {"Escaped 0x27 in string", "\"\\'\"", 4, std::nullopt, nullptr},
1198 {"Escaped 0x28 in string", "\"\\(\"", 4, std::nullopt, nullptr},
1199 {"Escaped 0x29 in string", "\"\\)\"", 4, std::nullopt, nullptr},
1200 {"Escaped 0x2a in string", "\"\\*\"", 4, std::nullopt, nullptr},
1201 {"Escaped 0x2b in string", "\"\\+\"", 4, std::nullopt, nullptr},
1202 {"Escaped 0x2c in string", "\"\\,\"", 4, std::nullopt, nullptr},
1203 {"Escaped 0x2d in string", "\"\\-\"", 4, std::nullopt, nullptr},
1204 {"Escaped 0x2e in string", "\"\\.\"", 4, std::nullopt, nullptr},
1205 {"Escaped 0x2f in string", "\"\\/\"", 4, std::nullopt, nullptr},
1206 {"Escaped 0x30 in string", "\"\\0\"", 4, std::nullopt, nullptr},
1207 {"Escaped 0x31 in string", "\"\\1\"", 4, std::nullopt, nullptr},
1208 {"Escaped 0x32 in string", "\"\\2\"", 4, std::nullopt, nullptr},
1209 {"Escaped 0x33 in string", "\"\\3\"", 4, std::nullopt, nullptr},
1210 {"Escaped 0x34 in string", "\"\\4\"", 4, std::nullopt, nullptr},
1211 {"Escaped 0x35 in string", "\"\\5\"", 4, std::nullopt, nullptr},
1212 {"Escaped 0x36 in string", "\"\\6\"", 4, std::nullopt, nullptr},
1213 {"Escaped 0x37 in string", "\"\\7\"", 4, std::nullopt, nullptr},
1214 {"Escaped 0x38 in string", "\"\\8\"", 4, std::nullopt, nullptr},
1215 {"Escaped 0x39 in string", "\"\\9\"", 4, std::nullopt, nullptr},
1216 {"Escaped 0x3a in string", "\"\\:\"", 4, std::nullopt, nullptr},
1217 {"Escaped 0x3b in string", "\"\\;\"", 4, std::nullopt, nullptr},
1218 {"Escaped 0x3c in string", "\"\\<\"", 4, std::nullopt, nullptr},
1219 {"Escaped 0x3d in string", "\"\\=\"", 4, std::nullopt, nullptr},
1220 {"Escaped 0x3e in string", "\"\\>\"", 4, std::nullopt, nullptr},
1221 {"Escaped 0x3f in string", "\"\\?\"", 4, std::nullopt, nullptr},
1222 {"Escaped 0x40 in string", "\"\\@\"", 4, std::nullopt, nullptr},
1223 {"Escaped 0x41 in string", "\"\\A\"", 4, std::nullopt, nullptr},
1224 {"Escaped 0x42 in string", "\"\\B\"", 4, std::nullopt, nullptr},
1225 {"Escaped 0x43 in string", "\"\\C\"", 4, std::nullopt, nullptr},
1226 {"Escaped 0x44 in string", "\"\\D\"", 4, std::nullopt, nullptr},
1227 {"Escaped 0x45 in string", "\"\\E\"", 4, std::nullopt, nullptr},
1228 {"Escaped 0x46 in string", "\"\\F\"", 4, std::nullopt, nullptr},
1229 {"Escaped 0x47 in string", "\"\\G\"", 4, std::nullopt, nullptr},
1230 {"Escaped 0x48 in string", "\"\\H\"", 4, std::nullopt, nullptr},
1231 {"Escaped 0x49 in string", "\"\\I\"", 4, std::nullopt, nullptr},
1232 {"Escaped 0x4a in string", "\"\\J\"", 4, std::nullopt, nullptr},
1233 {"Escaped 0x4b in string", "\"\\K\"", 4, std::nullopt, nullptr},
1234 {"Escaped 0x4c in string", "\"\\L\"", 4, std::nullopt, nullptr},
1235 {"Escaped 0x4d in string", "\"\\M\"", 4, std::nullopt, nullptr},
1236 {"Escaped 0x4e in string", "\"\\N\"", 4, std::nullopt, nullptr},
1237 {"Escaped 0x4f in string", "\"\\O\"", 4, std::nullopt, nullptr},
1238 {"Escaped 0x50 in string", "\"\\P\"", 4, std::nullopt, nullptr},
1239 {"Escaped 0x51 in string", "\"\\Q\"", 4, std::nullopt, nullptr},
1240 {"Escaped 0x52 in string", "\"\\R\"", 4, std::nullopt, nullptr},
1241 {"Escaped 0x53 in string", "\"\\S\"", 4, std::nullopt, nullptr},
1242 {"Escaped 0x54 in string", "\"\\T\"", 4, std::nullopt, nullptr},
1243 {"Escaped 0x55 in string", "\"\\U\"", 4, std::nullopt, nullptr},
1244 {"Escaped 0x56 in string", "\"\\V\"", 4, std::nullopt, nullptr},
1245 {"Escaped 0x57 in string", "\"\\W\"", 4, std::nullopt, nullptr},
1246 {"Escaped 0x58 in string", "\"\\X\"", 4, std::nullopt, nullptr},
1247 {"Escaped 0x59 in string", "\"\\Y\"", 4, std::nullopt, nullptr},
1248 {"Escaped 0x5a in string", "\"\\Z\"", 4, std::nullopt, nullptr},
1249 {"Escaped 0x5b in string", "\"\\[\"", 4, std::nullopt, nullptr},
1250 {"Escaped 0x5c in string", "\"\\\\\"", 4, {{Item("\\"), {}}}, nullptr},
1251 {"Escaped 0x5d in string", "\"\\]\"", 4, std::nullopt, nullptr},
1252 {"Escaped 0x5e in string", "\"\\^\"", 4, std::nullopt, nullptr},
1253 {"Escaped 0x5f in string", "\"\\_\"", 4, std::nullopt, nullptr},
1254 {"Escaped 0x60 in string", "\"\\`\"", 4, std::nullopt, nullptr},
1255 {"Escaped 0x61 in string", "\"\\a\"", 4, std::nullopt, nullptr},
1256 {"Escaped 0x62 in string", "\"\\b\"", 4, std::nullopt, nullptr},
1257 {"Escaped 0x63 in string", "\"\\c\"", 4, std::nullopt, nullptr},
1258 {"Escaped 0x64 in string", "\"\\d\"", 4, std::nullopt, nullptr},
1259 {"Escaped 0x65 in string", "\"\\e\"", 4, std::nullopt, nullptr},
1260 {"Escaped 0x66 in string", "\"\\f\"", 4, std::nullopt, nullptr},
1261 {"Escaped 0x67 in string", "\"\\g\"", 4, std::nullopt, nullptr},
1262 {"Escaped 0x68 in string", "\"\\h\"", 4, std::nullopt, nullptr},
1263 {"Escaped 0x69 in string", "\"\\i\"", 4, std::nullopt, nullptr},
1264 {"Escaped 0x6a in string", "\"\\j\"", 4, std::nullopt, nullptr},
1265 {"Escaped 0x6b in string", "\"\\k\"", 4, std::nullopt, nullptr},
1266 {"Escaped 0x6c in string", "\"\\l\"", 4, std::nullopt, nullptr},
1267 {"Escaped 0x6d in string", "\"\\m\"", 4, std::nullopt, nullptr},
1268 {"Escaped 0x6e in string", "\"\\n\"", 4, std::nullopt, nullptr},
1269 {"Escaped 0x6f in string", "\"\\o\"", 4, std::nullopt, nullptr},
1270 {"Escaped 0x70 in string", "\"\\p\"", 4, std::nullopt, nullptr},
1271 {"Escaped 0x71 in string", "\"\\q\"", 4, std::nullopt, nullptr},
1272 {"Escaped 0x72 in string", "\"\\r\"", 4, std::nullopt, nullptr},
1273 {"Escaped 0x73 in string", "\"\\s\"", 4, std::nullopt, nullptr},
1274 {"Escaped 0x74 in string", "\"\\t\"", 4, std::nullopt, nullptr},
1275 {"Escaped 0x75 in string", "\"\\u\"", 4, std::nullopt, nullptr},
1276 {"Escaped 0x76 in string", "\"\\v\"", 4, std::nullopt, nullptr},
1277 {"Escaped 0x77 in string", "\"\\w\"", 4, std::nullopt, nullptr},
1278 {"Escaped 0x78 in string", "\"\\x\"", 4, std::nullopt, nullptr},
1279 {"Escaped 0x79 in string", "\"\\y\"", 4, std::nullopt, nullptr},
1280 {"Escaped 0x7a in string", "\"\\z\"", 4, std::nullopt, nullptr},
1281 {"Escaped 0x7b in string", "\"\\{\"", 4, std::nullopt, nullptr},
1282 {"Escaped 0x7c in string", "\"\\|\"", 4, std::nullopt, nullptr},
1283 {"Escaped 0x7d in string", "\"\\}\"", 4, std::nullopt, nullptr},
1284 {"Escaped 0x7e in string", "\"\\~\"", 4, std::nullopt, nullptr},
1285 {"Escaped 0x7f in string", "\"\\\177\"", 4, std::nullopt, nullptr},
1286 // string.json
1287 {"basic string", "\"foo bar\"", 9, {{Item("foo bar"), {}}}, nullptr},
1288 {"empty string", "\"\"", 2, {{Item(""), {}}}, nullptr},
1289 {"long string",
1290 "\"foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1291 "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1292 "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1293 "foo foo foo foo foo foo foo foo foo foo foo foo \"",
1294 262,
1295 {{Item("foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1296 "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1297 "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1298 "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo "
1299 "foo "),
1300 {}}},
1301 nullptr},
1302 {"whitespace string", "\" \"", 5, {{Item(" "), {}}}, nullptr},
1303 {"non-ascii string", "\"f\374\374\"", 5, std::nullopt, nullptr},
1304 {"tab in string", "\"\\t\"", 4, std::nullopt, nullptr},
1305 {"newline in string", "\" \\n \"", 6, std::nullopt, nullptr},
1306 {"single quoted string", "'foo'", 5, std::nullopt, nullptr},
1307 {"unbalanced string", "\"foo", 4, std::nullopt, nullptr},
1308 {"string quoting",
1309 "\"foo \\\"bar\\\" \\\\ baz\"",
1310 20,
1311 {{Item("foo \"bar\" \\ baz"), {}}},
1312 nullptr},
1313 {"bad string quoting", "\"foo \\,\"", 8, std::nullopt, nullptr},
1314 {"ending string quote", "\"foo \\\"", 7, std::nullopt, nullptr},
1315 {"abruptly ending string quote", "\"foo \\", 6, std::nullopt, nullptr},
1316 // token-generated.json
1317 {"0x00 in token", "a\000a", 3, std::nullopt, nullptr},
1318 {"0x01 in token", "a\001a", 3, std::nullopt, nullptr},
1319 {"0x02 in token", "a\002a", 3, std::nullopt, nullptr},
1320 {"0x03 in token", "a\003a", 3, std::nullopt, nullptr},
1321 {"0x04 in token", "a\004a", 3, std::nullopt, nullptr},
1322 {"0x05 in token", "a\005a", 3, std::nullopt, nullptr},
1323 {"0x06 in token", "a\006a", 3, std::nullopt, nullptr},
1324 {"0x07 in token", "a\aa", 3, std::nullopt, nullptr},
1325 {"0x08 in token", "a\ba", 3, std::nullopt, nullptr},
1326 {"0x09 in token", "a\ta", 3, std::nullopt, nullptr},
1327 {"0x0a in token", "a\na", 3, std::nullopt, nullptr},
1328 {"0x0b in token", "a\va", 3, std::nullopt, nullptr},
1329 {"0x0c in token", "a\fa", 3, std::nullopt, nullptr},
1330 {"0x0d in token", "a\ra", 3, std::nullopt, nullptr},
1331 {"0x0e in token", "a\016a", 3, std::nullopt, nullptr},
1332 {"0x0f in token", "a\017a", 3, std::nullopt, nullptr},
1333 {"0x10 in token", "a\020a", 3, std::nullopt, nullptr},
1334 {"0x11 in token", "a\021a", 3, std::nullopt, nullptr},
1335 {"0x12 in token", "a\022a", 3, std::nullopt, nullptr},
1336 {"0x13 in token", "a\023a", 3, std::nullopt, nullptr},
1337 {"0x14 in token", "a\024a", 3, std::nullopt, nullptr},
1338 {"0x15 in token", "a\025a", 3, std::nullopt, nullptr},
1339 {"0x16 in token", "a\026a", 3, std::nullopt, nullptr},
1340 {"0x17 in token", "a\027a", 3, std::nullopt, nullptr},
1341 {"0x18 in token", "a\030a", 3, std::nullopt, nullptr},
1342 {"0x19 in token", "a\031a", 3, std::nullopt, nullptr},
1343 {"0x1a in token", "a\032a", 3, std::nullopt, nullptr},
1344 {"0x1b in token", "a\033a", 3, std::nullopt, nullptr},
1345 {"0x1c in token", "a\034a", 3, std::nullopt, nullptr},
1346 {"0x1d in token", "a\035a", 3, std::nullopt, nullptr},
1347 {"0x1e in token", "a\036a", 3, std::nullopt, nullptr},
1348 {"0x1f in token", "a\037a", 3, std::nullopt, nullptr},
1349 {"0x20 in token", "a a", 3, std::nullopt, nullptr},
1350 {"0x21 in token", "a!a", 3, {{Item("a!a", Item::kTokenType), {}}}, nullptr},
1351 {"0x22 in token", "a\"a", 3, std::nullopt, nullptr},
1352 {"0x23 in token", "a#a", 3, {{Item("a#a", Item::kTokenType), {}}}, nullptr},
1353 {"0x24 in token", "a$a", 3, {{Item("a$a", Item::kTokenType), {}}}, nullptr},
1354 {"0x25 in token", "a%a", 3, {{Item("a%a", Item::kTokenType), {}}}, nullptr},
1355 {"0x26 in token", "a&a", 3, {{Item("a&a", Item::kTokenType), {}}}, nullptr},
1356 {"0x27 in token", "a'a", 3, {{Item("a'a", Item::kTokenType), {}}}, nullptr},
1357 {"0x28 in token", "a(a", 3, std::nullopt, nullptr},
1358 {"0x29 in token", "a)a", 3, std::nullopt, nullptr},
1359 {"0x2a in token", "a*a", 3, {{Item("a*a", Item::kTokenType), {}}}, nullptr},
1360 {"0x2b in token", "a+a", 3, {{Item("a+a", Item::kTokenType), {}}}, nullptr},
1361 {"0x2c in token", "a,a", 3, std::nullopt, nullptr},
1362 {"0x2d in token", "a-a", 3, {{Item("a-a", Item::kTokenType), {}}}, nullptr},
1363 {"0x2e in token", "a.a", 3, {{Item("a.a", Item::kTokenType), {}}}, nullptr},
1364 {"0x2f in token", "a/a", 3, {{Item("a/a", Item::kTokenType), {}}}, nullptr},
1365 {"0x30 in token", "a0a", 3, {{Item("a0a", Item::kTokenType), {}}}, nullptr},
1366 {"0x31 in token", "a1a", 3, {{Item("a1a", Item::kTokenType), {}}}, nullptr},
1367 {"0x32 in token", "a2a", 3, {{Item("a2a", Item::kTokenType), {}}}, nullptr},
1368 {"0x33 in token", "a3a", 3, {{Item("a3a", Item::kTokenType), {}}}, nullptr},
1369 {"0x34 in token", "a4a", 3, {{Item("a4a", Item::kTokenType), {}}}, nullptr},
1370 {"0x35 in token", "a5a", 3, {{Item("a5a", Item::kTokenType), {}}}, nullptr},
1371 {"0x36 in token", "a6a", 3, {{Item("a6a", Item::kTokenType), {}}}, nullptr},
1372 {"0x37 in token", "a7a", 3, {{Item("a7a", Item::kTokenType), {}}}, nullptr},
1373 {"0x38 in token", "a8a", 3, {{Item("a8a", Item::kTokenType), {}}}, nullptr},
1374 {"0x39 in token", "a9a", 3, {{Item("a9a", Item::kTokenType), {}}}, nullptr},
1375 {"0x3a in token", "a:a", 3, {{Item("a:a", Item::kTokenType), {}}}, nullptr},
1376 {"0x3b in token",
1377 "a;a",
1378 3,
1379 {{Item("a", Item::kTokenType), {BooleanParam("a", true)}}},
1380 nullptr},
1381 {"0x3c in token", "a<a", 3, std::nullopt, nullptr},
1382 {"0x3d in token", "a=a", 3, std::nullopt, nullptr},
1383 {"0x3e in token", "a>a", 3, std::nullopt, nullptr},
1384 {"0x3f in token", "a?a", 3, std::nullopt, nullptr},
1385 {"0x40 in token", "a@a", 3, std::nullopt, nullptr},
1386 {"0x41 in token", "aAa", 3, {{Item("aAa", Item::kTokenType), {}}}, nullptr},
1387 {"0x42 in token", "aBa", 3, {{Item("aBa", Item::kTokenType), {}}}, nullptr},
1388 {"0x43 in token", "aCa", 3, {{Item("aCa", Item::kTokenType), {}}}, nullptr},
1389 {"0x44 in token", "aDa", 3, {{Item("aDa", Item::kTokenType), {}}}, nullptr},
1390 {"0x45 in token", "aEa", 3, {{Item("aEa", Item::kTokenType), {}}}, nullptr},
1391 {"0x46 in token", "aFa", 3, {{Item("aFa", Item::kTokenType), {}}}, nullptr},
1392 {"0x47 in token", "aGa", 3, {{Item("aGa", Item::kTokenType), {}}}, nullptr},
1393 {"0x48 in token", "aHa", 3, {{Item("aHa", Item::kTokenType), {}}}, nullptr},
1394 {"0x49 in token", "aIa", 3, {{Item("aIa", Item::kTokenType), {}}}, nullptr},
1395 {"0x4a in token", "aJa", 3, {{Item("aJa", Item::kTokenType), {}}}, nullptr},
1396 {"0x4b in token", "aKa", 3, {{Item("aKa", Item::kTokenType), {}}}, nullptr},
1397 {"0x4c in token", "aLa", 3, {{Item("aLa", Item::kTokenType), {}}}, nullptr},
1398 {"0x4d in token", "aMa", 3, {{Item("aMa", Item::kTokenType), {}}}, nullptr},
1399 {"0x4e in token", "aNa", 3, {{Item("aNa", Item::kTokenType), {}}}, nullptr},
1400 {"0x4f in token", "aOa", 3, {{Item("aOa", Item::kTokenType), {}}}, nullptr},
1401 {"0x50 in token", "aPa", 3, {{Item("aPa", Item::kTokenType), {}}}, nullptr},
1402 {"0x51 in token", "aQa", 3, {{Item("aQa", Item::kTokenType), {}}}, nullptr},
1403 {"0x52 in token", "aRa", 3, {{Item("aRa", Item::kTokenType), {}}}, nullptr},
1404 {"0x53 in token", "aSa", 3, {{Item("aSa", Item::kTokenType), {}}}, nullptr},
1405 {"0x54 in token", "aTa", 3, {{Item("aTa", Item::kTokenType), {}}}, nullptr},
1406 {"0x55 in token", "aUa", 3, {{Item("aUa", Item::kTokenType), {}}}, nullptr},
1407 {"0x56 in token", "aVa", 3, {{Item("aVa", Item::kTokenType), {}}}, nullptr},
1408 {"0x57 in token", "aWa", 3, {{Item("aWa", Item::kTokenType), {}}}, nullptr},
1409 {"0x58 in token", "aXa", 3, {{Item("aXa", Item::kTokenType), {}}}, nullptr},
1410 {"0x59 in token", "aYa", 3, {{Item("aYa", Item::kTokenType), {}}}, nullptr},
1411 {"0x5a in token", "aZa", 3, {{Item("aZa", Item::kTokenType), {}}}, nullptr},
1412 {"0x5b in token", "a[a", 3, std::nullopt, nullptr},
1413 {"0x5c in token", "a\\a", 3, std::nullopt, nullptr},
1414 {"0x5d in token", "a]a", 3, std::nullopt, nullptr},
1415 {"0x5e in token", "a^a", 3, {{Item("a^a", Item::kTokenType), {}}}, nullptr},
1416 {"0x5f in token", "a_a", 3, {{Item("a_a", Item::kTokenType), {}}}, nullptr},
1417 {"0x60 in token", "a`a", 3, {{Item("a`a", Item::kTokenType), {}}}, nullptr},
1418 {"0x61 in token", "aaa", 3, {{Item("aaa", Item::kTokenType), {}}}, nullptr},
1419 {"0x62 in token", "aba", 3, {{Item("aba", Item::kTokenType), {}}}, nullptr},
1420 {"0x63 in token", "aca", 3, {{Item("aca", Item::kTokenType), {}}}, nullptr},
1421 {"0x64 in token", "ada", 3, {{Item("ada", Item::kTokenType), {}}}, nullptr},
1422 {"0x65 in token", "aea", 3, {{Item("aea", Item::kTokenType), {}}}, nullptr},
1423 {"0x66 in token", "afa", 3, {{Item("afa", Item::kTokenType), {}}}, nullptr},
1424 {"0x67 in token", "aga", 3, {{Item("aga", Item::kTokenType), {}}}, nullptr},
1425 {"0x68 in token", "aha", 3, {{Item("aha", Item::kTokenType), {}}}, nullptr},
1426 {"0x69 in token", "aia", 3, {{Item("aia", Item::kTokenType), {}}}, nullptr},
1427 {"0x6a in token", "aja", 3, {{Item("aja", Item::kTokenType), {}}}, nullptr},
1428 {"0x6b in token", "aka", 3, {{Item("aka", Item::kTokenType), {}}}, nullptr},
1429 {"0x6c in token", "ala", 3, {{Item("ala", Item::kTokenType), {}}}, nullptr},
1430 {"0x6d in token", "ama", 3, {{Item("ama", Item::kTokenType), {}}}, nullptr},
1431 {"0x6e in token", "ana", 3, {{Item("ana", Item::kTokenType), {}}}, nullptr},
1432 {"0x6f in token", "aoa", 3, {{Item("aoa", Item::kTokenType), {}}}, nullptr},
1433 {"0x70 in token", "apa", 3, {{Item("apa", Item::kTokenType), {}}}, nullptr},
1434 {"0x71 in token", "aqa", 3, {{Item("aqa", Item::kTokenType), {}}}, nullptr},
1435 {"0x72 in token", "ara", 3, {{Item("ara", Item::kTokenType), {}}}, nullptr},
1436 {"0x73 in token", "asa", 3, {{Item("asa", Item::kTokenType), {}}}, nullptr},
1437 {"0x74 in token", "ata", 3, {{Item("ata", Item::kTokenType), {}}}, nullptr},
1438 {"0x75 in token", "aua", 3, {{Item("aua", Item::kTokenType), {}}}, nullptr},
1439 {"0x76 in token", "ava", 3, {{Item("ava", Item::kTokenType), {}}}, nullptr},
1440 {"0x77 in token", "awa", 3, {{Item("awa", Item::kTokenType), {}}}, nullptr},
1441 {"0x78 in token", "axa", 3, {{Item("axa", Item::kTokenType), {}}}, nullptr},
1442 {"0x79 in token", "aya", 3, {{Item("aya", Item::kTokenType), {}}}, nullptr},
1443 {"0x7a in token", "aza", 3, {{Item("aza", Item::kTokenType), {}}}, nullptr},
1444 {"0x7b in token", "a{a", 3, std::nullopt, nullptr},
1445 {"0x7c in token", "a|a", 3, {{Item("a|a", Item::kTokenType), {}}}, nullptr},
1446 {"0x7d in token", "a}a", 3, std::nullopt, nullptr},
1447 {"0x7e in token", "a~a", 3, {{Item("a~a", Item::kTokenType), {}}}, nullptr},
1448 {"0x7f in token", "a\177a", 3, std::nullopt, nullptr},
1449 {"0x00 starting an token", "\000a", 2, std::nullopt, nullptr},
1450 {"0x01 starting an token", "\001a", 2, std::nullopt, nullptr},
1451 {"0x02 starting an token", "\002a", 2, std::nullopt, nullptr},
1452 {"0x03 starting an token", "\003a", 2, std::nullopt, nullptr},
1453 {"0x04 starting an token", "\004a", 2, std::nullopt, nullptr},
1454 {"0x05 starting an token", "\005a", 2, std::nullopt, nullptr},
1455 {"0x06 starting an token", "\006a", 2, std::nullopt, nullptr},
1456 {"0x07 starting an token", "\aa", 2, std::nullopt, nullptr},
1457 {"0x08 starting an token", "\ba", 2, std::nullopt, nullptr},
1458 {"0x09 starting an token", "\ta", 2, std::nullopt, nullptr},
1459 {"0x0a starting an token", "\na", 2, std::nullopt, nullptr},
1460 {"0x0b starting an token", "\va", 2, std::nullopt, nullptr},
1461 {"0x0c starting an token", "\fa", 2, std::nullopt, nullptr},
1462 {"0x0d starting an token", "\ra", 2, std::nullopt, nullptr},
1463 {"0x0e starting an token", "\016a", 2, std::nullopt, nullptr},
1464 {"0x0f starting an token", "\017a", 2, std::nullopt, nullptr},
1465 {"0x10 starting an token", "\020a", 2, std::nullopt, nullptr},
1466 {"0x11 starting an token", "\021a", 2, std::nullopt, nullptr},
1467 {"0x12 starting an token", "\022a", 2, std::nullopt, nullptr},
1468 {"0x13 starting an token", "\023a", 2, std::nullopt, nullptr},
1469 {"0x14 starting an token", "\024a", 2, std::nullopt, nullptr},
1470 {"0x15 starting an token", "\025a", 2, std::nullopt, nullptr},
1471 {"0x16 starting an token", "\026a", 2, std::nullopt, nullptr},
1472 {"0x17 starting an token", "\027a", 2, std::nullopt, nullptr},
1473 {"0x18 starting an token", "\030a", 2, std::nullopt, nullptr},
1474 {"0x19 starting an token", "\031a", 2, std::nullopt, nullptr},
1475 {"0x1a starting an token", "\032a", 2, std::nullopt, nullptr},
1476 {"0x1b starting an token", "\033a", 2, std::nullopt, nullptr},
1477 {"0x1c starting an token", "\034a", 2, std::nullopt, nullptr},
1478 {"0x1d starting an token", "\035a", 2, std::nullopt, nullptr},
1479 {"0x1e starting an token", "\036a", 2, std::nullopt, nullptr},
1480 {"0x1f starting an token", "\037a", 2, std::nullopt, nullptr},
1481 {"0x20 starting an token",
1482 " a",
1483 2,
1484 {{Item("a", Item::kTokenType), {}}},
1485 "a"},
1486 {"0x21 starting an token", "!a", 2, std::nullopt, nullptr},
1487 {"0x22 starting an token", "\"a", 2, std::nullopt, nullptr},
1488 {"0x23 starting an token", "#a", 2, std::nullopt, nullptr},
1489 {"0x24 starting an token", "$a", 2, std::nullopt, nullptr},
1490 {"0x25 starting an token", "%a", 2, std::nullopt, nullptr},
1491 {"0x26 starting an token", "&a", 2, std::nullopt, nullptr},
1492 {"0x27 starting an token", "'a", 2, std::nullopt, nullptr},
1493 {"0x28 starting an token", "(a", 2, std::nullopt, nullptr},
1494 {"0x29 starting an token", ")a", 2, std::nullopt, nullptr},
1495 {"0x2a starting an token",
1496 "*a",
1497 2,
1498 {{Item("*a", Item::kTokenType), {}}},
1499 nullptr},
1500 {"0x2b starting an token", "+a", 2, std::nullopt, nullptr},
1501 {"0x2c starting an token", ",a", 2, std::nullopt, nullptr},
1502 {"0x2d starting an token", "-a", 2, std::nullopt, nullptr},
1503 {"0x2e starting an token", ".a", 2, std::nullopt, nullptr},
1504 {"0x2f starting an token", "/a", 2, std::nullopt, nullptr},
1505 {"0x30 starting an token", "0a", 2, std::nullopt, nullptr},
1506 {"0x31 starting an token", "1a", 2, std::nullopt, nullptr},
1507 {"0x32 starting an token", "2a", 2, std::nullopt, nullptr},
1508 {"0x33 starting an token", "3a", 2, std::nullopt, nullptr},
1509 {"0x34 starting an token", "4a", 2, std::nullopt, nullptr},
1510 {"0x35 starting an token", "5a", 2, std::nullopt, nullptr},
1511 {"0x36 starting an token", "6a", 2, std::nullopt, nullptr},
1512 {"0x37 starting an token", "7a", 2, std::nullopt, nullptr},
1513 {"0x38 starting an token", "8a", 2, std::nullopt, nullptr},
1514 {"0x39 starting an token", "9a", 2, std::nullopt, nullptr},
1515 {"0x3a starting an token", ":a", 2, std::nullopt, nullptr},
1516 {"0x3b starting an token", ";a", 2, std::nullopt, nullptr},
1517 {"0x3c starting an token", "<a", 2, std::nullopt, nullptr},
1518 {"0x3d starting an token", "=a", 2, std::nullopt, nullptr},
1519 {"0x3e starting an token", ">a", 2, std::nullopt, nullptr},
1520 {"0x3f starting an token", "?a", 2, std::nullopt, nullptr},
1521 {"0x40 starting an token", "@a", 2, std::nullopt, nullptr},
1522 {"0x41 starting an token",
1523 "Aa",
1524 2,
1525 {{Item("Aa", Item::kTokenType), {}}},
1526 nullptr},
1527 {"0x42 starting an token",
1528 "Ba",
1529 2,
1530 {{Item("Ba", Item::kTokenType), {}}},
1531 nullptr},
1532 {"0x43 starting an token",
1533 "Ca",
1534 2,
1535 {{Item("Ca", Item::kTokenType), {}}},
1536 nullptr},
1537 {"0x44 starting an token",
1538 "Da",
1539 2,
1540 {{Item("Da", Item::kTokenType), {}}},
1541 nullptr},
1542 {"0x45 starting an token",
1543 "Ea",
1544 2,
1545 {{Item("Ea", Item::kTokenType), {}}},
1546 nullptr},
1547 {"0x46 starting an token",
1548 "Fa",
1549 2,
1550 {{Item("Fa", Item::kTokenType), {}}},
1551 nullptr},
1552 {"0x47 starting an token",
1553 "Ga",
1554 2,
1555 {{Item("Ga", Item::kTokenType), {}}},
1556 nullptr},
1557 {"0x48 starting an token",
1558 "Ha",
1559 2,
1560 {{Item("Ha", Item::kTokenType), {}}},
1561 nullptr},
1562 {"0x49 starting an token",
1563 "Ia",
1564 2,
1565 {{Item("Ia", Item::kTokenType), {}}},
1566 nullptr},
1567 {"0x4a starting an token",
1568 "Ja",
1569 2,
1570 {{Item("Ja", Item::kTokenType), {}}},
1571 nullptr},
1572 {"0x4b starting an token",
1573 "Ka",
1574 2,
1575 {{Item("Ka", Item::kTokenType), {}}},
1576 nullptr},
1577 {"0x4c starting an token",
1578 "La",
1579 2,
1580 {{Item("La", Item::kTokenType), {}}},
1581 nullptr},
1582 {"0x4d starting an token",
1583 "Ma",
1584 2,
1585 {{Item("Ma", Item::kTokenType), {}}},
1586 nullptr},
1587 {"0x4e starting an token",
1588 "Na",
1589 2,
1590 {{Item("Na", Item::kTokenType), {}}},
1591 nullptr},
1592 {"0x4f starting an token",
1593 "Oa",
1594 2,
1595 {{Item("Oa", Item::kTokenType), {}}},
1596 nullptr},
1597 {"0x50 starting an token",
1598 "Pa",
1599 2,
1600 {{Item("Pa", Item::kTokenType), {}}},
1601 nullptr},
1602 {"0x51 starting an token",
1603 "Qa",
1604 2,
1605 {{Item("Qa", Item::kTokenType), {}}},
1606 nullptr},
1607 {"0x52 starting an token",
1608 "Ra",
1609 2,
1610 {{Item("Ra", Item::kTokenType), {}}},
1611 nullptr},
1612 {"0x53 starting an token",
1613 "Sa",
1614 2,
1615 {{Item("Sa", Item::kTokenType), {}}},
1616 nullptr},
1617 {"0x54 starting an token",
1618 "Ta",
1619 2,
1620 {{Item("Ta", Item::kTokenType), {}}},
1621 nullptr},
1622 {"0x55 starting an token",
1623 "Ua",
1624 2,
1625 {{Item("Ua", Item::kTokenType), {}}},
1626 nullptr},
1627 {"0x56 starting an token",
1628 "Va",
1629 2,
1630 {{Item("Va", Item::kTokenType), {}}},
1631 nullptr},
1632 {"0x57 starting an token",
1633 "Wa",
1634 2,
1635 {{Item("Wa", Item::kTokenType), {}}},
1636 nullptr},
1637 {"0x58 starting an token",
1638 "Xa",
1639 2,
1640 {{Item("Xa", Item::kTokenType), {}}},
1641 nullptr},
1642 {"0x59 starting an token",
1643 "Ya",
1644 2,
1645 {{Item("Ya", Item::kTokenType), {}}},
1646 nullptr},
1647 {"0x5a starting an token",
1648 "Za",
1649 2,
1650 {{Item("Za", Item::kTokenType), {}}},
1651 nullptr},
1652 {"0x5b starting an token", "[a", 2, std::nullopt, nullptr},
1653 {"0x5c starting an token", "\\a", 2, std::nullopt, nullptr},
1654 {"0x5d starting an token", "]a", 2, std::nullopt, nullptr},
1655 {"0x5e starting an token", "^a", 2, std::nullopt, nullptr},
1656 {"0x5f starting an token", "_a", 2, std::nullopt, nullptr},
1657 {"0x60 starting an token", "`a", 2, std::nullopt, nullptr},
1658 {"0x61 starting an token",
1659 "aa",
1660 2,
1661 {{Item("aa", Item::kTokenType), {}}},
1662 nullptr},
1663 {"0x62 starting an token",
1664 "ba",
1665 2,
1666 {{Item("ba", Item::kTokenType), {}}},
1667 nullptr},
1668 {"0x63 starting an token",
1669 "ca",
1670 2,
1671 {{Item("ca", Item::kTokenType), {}}},
1672 nullptr},
1673 {"0x64 starting an token",
1674 "da",
1675 2,
1676 {{Item("da", Item::kTokenType), {}}},
1677 nullptr},
1678 {"0x65 starting an token",
1679 "ea",
1680 2,
1681 {{Item("ea", Item::kTokenType), {}}},
1682 nullptr},
1683 {"0x66 starting an token",
1684 "fa",
1685 2,
1686 {{Item("fa", Item::kTokenType), {}}},
1687 nullptr},
1688 {"0x67 starting an token",
1689 "ga",
1690 2,
1691 {{Item("ga", Item::kTokenType), {}}},
1692 nullptr},
1693 {"0x68 starting an token",
1694 "ha",
1695 2,
1696 {{Item("ha", Item::kTokenType), {}}},
1697 nullptr},
1698 {"0x69 starting an token",
1699 "ia",
1700 2,
1701 {{Item("ia", Item::kTokenType), {}}},
1702 nullptr},
1703 {"0x6a starting an token",
1704 "ja",
1705 2,
1706 {{Item("ja", Item::kTokenType), {}}},
1707 nullptr},
1708 {"0x6b starting an token",
1709 "ka",
1710 2,
1711 {{Item("ka", Item::kTokenType), {}}},
1712 nullptr},
1713 {"0x6c starting an token",
1714 "la",
1715 2,
1716 {{Item("la", Item::kTokenType), {}}},
1717 nullptr},
1718 {"0x6d starting an token",
1719 "ma",
1720 2,
1721 {{Item("ma", Item::kTokenType), {}}},
1722 nullptr},
1723 {"0x6e starting an token",
1724 "na",
1725 2,
1726 {{Item("na", Item::kTokenType), {}}},
1727 nullptr},
1728 {"0x6f starting an token",
1729 "oa",
1730 2,
1731 {{Item("oa", Item::kTokenType), {}}},
1732 nullptr},
1733 {"0x70 starting an token",
1734 "pa",
1735 2,
1736 {{Item("pa", Item::kTokenType), {}}},
1737 nullptr},
1738 {"0x71 starting an token",
1739 "qa",
1740 2,
1741 {{Item("qa", Item::kTokenType), {}}},
1742 nullptr},
1743 {"0x72 starting an token",
1744 "ra",
1745 2,
1746 {{Item("ra", Item::kTokenType), {}}},
1747 nullptr},
1748 {"0x73 starting an token",
1749 "sa",
1750 2,
1751 {{Item("sa", Item::kTokenType), {}}},
1752 nullptr},
1753 {"0x74 starting an token",
1754 "ta",
1755 2,
1756 {{Item("ta", Item::kTokenType), {}}},
1757 nullptr},
1758 {"0x75 starting an token",
1759 "ua",
1760 2,
1761 {{Item("ua", Item::kTokenType), {}}},
1762 nullptr},
1763 {"0x76 starting an token",
1764 "va",
1765 2,
1766 {{Item("va", Item::kTokenType), {}}},
1767 nullptr},
1768 {"0x77 starting an token",
1769 "wa",
1770 2,
1771 {{Item("wa", Item::kTokenType), {}}},
1772 nullptr},
1773 {"0x78 starting an token",
1774 "xa",
1775 2,
1776 {{Item("xa", Item::kTokenType), {}}},
1777 nullptr},
1778 {"0x79 starting an token",
1779 "ya",
1780 2,
1781 {{Item("ya", Item::kTokenType), {}}},
1782 nullptr},
1783 {"0x7a starting an token",
1784 "za",
1785 2,
1786 {{Item("za", Item::kTokenType), {}}},
1787 nullptr},
1788 {"0x7b starting an token", "{a", 2, std::nullopt, nullptr},
1789 {"0x7c starting an token", "|a", 2, std::nullopt, nullptr},
1790 {"0x7d starting an token", "}a", 2, std::nullopt, nullptr},
1791 {"0x7e starting an token", "~a", 2, std::nullopt, nullptr},
1792 {"0x7f starting an token", "\177a", 2, std::nullopt, nullptr},
1793 // token.json
1794 {"basic token - item",
1795 "a_b-c.d3:f%00/*",
1796 15,
1797 {{Item("a_b-c.d3:f%00/*", Item::kTokenType), {}}},
1798 nullptr},
1799 {"token with capitals - item",
1800 "fooBar",
1801 6,
1802 {{Item("fooBar", Item::kTokenType), {}}},
1803 nullptr},
1804 {"token starting with capitals - item",
1805 "FooBar",
1806 6,
1807 {{Item("FooBar", Item::kTokenType), {}}},
1808 nullptr},
1809 };
1810
1811 const struct ListTestCase {
1812 const char* name;
1813 const char* raw;
1814 size_t raw_len;
1815 const std::optional<List> expected; // nullopt if parse error is expected.
1816 const char* canonical; // nullptr if parse error is expected, or if canonical
1817 // format is identical to raw.
1818 } list_test_cases[] = {
1819 // examples.json
1820 {"Example-StrListHeader",
1821 "\"foo\", \"bar\", \"It was the best of times.\"",
1822 41,
1823 {{{Item("foo"), {}},
1824 {Item("bar"), {}},
1825 {Item("It was the best of times."), {}}}},
1826 nullptr},
1827 {"Example-Hdr (list on one line)",
1828 "foo, bar",
1829 8,
1830 {{{Item("foo", Item::kTokenType), {}},
1831 {Item("bar", Item::kTokenType), {}}}},
1832 nullptr},
1833 {"Example-Hdr (list on two lines)",
1834 "foo, bar",
1835 8,
1836 {{{Item("foo", Item::kTokenType), {}},
1837 {Item("bar", Item::kTokenType), {}}}},
1838 "foo, bar"},
1839 {"Example-StrListListHeader",
1840 "(\"foo\" \"bar\"), (\"baz\"), (\"bat\" \"one\"), ()",
1841 41,
1842 {{{{{Item("foo"), {}}, {Item("bar"), {}}}, {}},
1843 {{{Item("baz"), {}}}, {}},
1844 {{{Item("bat"), {}}, {Item("one"), {}}}, {}},
1845 {std::vector<ParameterizedItem>(), {}}}},
1846 nullptr},
1847 {"Example-ListListParam",
1848 "(\"foo\"; a=1;b=2);lvl=5, (\"bar\" \"baz\");lvl=1",
1849 43,
1850 {{{{{Item("foo"), {Param("a", 1), Param("b", 2)}}}, {Param("lvl", 5)}},
1851 {{{Item("bar"), {}}, {Item("baz"), {}}}, {Param("lvl", 1)}}}},
1852 "(\"foo\";a=1;b=2);lvl=5, (\"bar\" \"baz\");lvl=1"},
1853 {"Example-ParamListHeader",
1854 "abc;a=1;b=2; cde_456, (ghi;jk=4 l);q=\"9\";r=w",
1855 44,
1856 {{{Item("abc", Item::kTokenType),
1857 {Param("a", 1), Param("b", 2), BooleanParam("cde_456", true)}},
1858 {{{Item("ghi", Item::kTokenType), {Param("jk", 4)}},
1859 {Item("l", Item::kTokenType), {}}},
1860 {Param("q", "9"), TokenParam("r", "w")}}}},
1861 "abc;a=1;b=2;cde_456, (ghi;jk=4 l);q=\"9\";r=w"},
1862 // key-generated.json
1863 {"0x00 in parameterised list key", "foo; a\000a=1", 10, std::nullopt,
1864 nullptr},
1865 {"0x01 in parameterised list key", "foo; a\001a=1", 10, std::nullopt,
1866 nullptr},
1867 {"0x02 in parameterised list key", "foo; a\002a=1", 10, std::nullopt,
1868 nullptr},
1869 {"0x03 in parameterised list key", "foo; a\003a=1", 10, std::nullopt,
1870 nullptr},
1871 {"0x04 in parameterised list key", "foo; a\004a=1", 10, std::nullopt,
1872 nullptr},
1873 {"0x05 in parameterised list key", "foo; a\005a=1", 10, std::nullopt,
1874 nullptr},
1875 {"0x06 in parameterised list key", "foo; a\006a=1", 10, std::nullopt,
1876 nullptr},
1877 {"0x07 in parameterised list key", "foo; a\aa=1", 10, std::nullopt,
1878 nullptr},
1879 {"0x08 in parameterised list key", "foo; a\ba=1", 10, std::nullopt,
1880 nullptr},
1881 {"0x09 in parameterised list key", "foo; a\ta=1", 10, std::nullopt,
1882 nullptr},
1883 {"0x0a in parameterised list key", "foo; a\na=1", 10, std::nullopt,
1884 nullptr},
1885 {"0x0b in parameterised list key", "foo; a\va=1", 10, std::nullopt,
1886 nullptr},
1887 {"0x0c in parameterised list key", "foo; a\fa=1", 10, std::nullopt,
1888 nullptr},
1889 {"0x0d in parameterised list key", "foo; a\ra=1", 10, std::nullopt,
1890 nullptr},
1891 {"0x0e in parameterised list key", "foo; a\016a=1", 10, std::nullopt,
1892 nullptr},
1893 {"0x0f in parameterised list key", "foo; a\017a=1", 10, std::nullopt,
1894 nullptr},
1895 {"0x10 in parameterised list key", "foo; a\020a=1", 10, std::nullopt,
1896 nullptr},
1897 {"0x11 in parameterised list key", "foo; a\021a=1", 10, std::nullopt,
1898 nullptr},
1899 {"0x12 in parameterised list key", "foo; a\022a=1", 10, std::nullopt,
1900 nullptr},
1901 {"0x13 in parameterised list key", "foo; a\023a=1", 10, std::nullopt,
1902 nullptr},
1903 {"0x14 in parameterised list key", "foo; a\024a=1", 10, std::nullopt,
1904 nullptr},
1905 {"0x15 in parameterised list key", "foo; a\025a=1", 10, std::nullopt,
1906 nullptr},
1907 {"0x16 in parameterised list key", "foo; a\026a=1", 10, std::nullopt,
1908 nullptr},
1909 {"0x17 in parameterised list key", "foo; a\027a=1", 10, std::nullopt,
1910 nullptr},
1911 {"0x18 in parameterised list key", "foo; a\030a=1", 10, std::nullopt,
1912 nullptr},
1913 {"0x19 in parameterised list key", "foo; a\031a=1", 10, std::nullopt,
1914 nullptr},
1915 {"0x1a in parameterised list key", "foo; a\032a=1", 10, std::nullopt,
1916 nullptr},
1917 {"0x1b in parameterised list key", "foo; a\033a=1", 10, std::nullopt,
1918 nullptr},
1919 {"0x1c in parameterised list key", "foo; a\034a=1", 10, std::nullopt,
1920 nullptr},
1921 {"0x1d in parameterised list key", "foo; a\035a=1", 10, std::nullopt,
1922 nullptr},
1923 {"0x1e in parameterised list key", "foo; a\036a=1", 10, std::nullopt,
1924 nullptr},
1925 {"0x1f in parameterised list key", "foo; a\037a=1", 10, std::nullopt,
1926 nullptr},
1927 {"0x20 in parameterised list key", "foo; a a=1", 10, std::nullopt, nullptr},
1928 {"0x21 in parameterised list key", "foo; a!a=1", 10, std::nullopt, nullptr},
1929 {"0x22 in parameterised list key", "foo; a\"a=1", 10, std::nullopt,
1930 nullptr},
1931 {"0x23 in parameterised list key", "foo; a#a=1", 10, std::nullopt, nullptr},
1932 {"0x24 in parameterised list key", "foo; a$a=1", 10, std::nullopt, nullptr},
1933 {"0x25 in parameterised list key", "foo; a%a=1", 10, std::nullopt, nullptr},
1934 {"0x26 in parameterised list key", "foo; a&a=1", 10, std::nullopt, nullptr},
1935 {"0x27 in parameterised list key", "foo; a'a=1", 10, std::nullopt, nullptr},
1936 {"0x28 in parameterised list key", "foo; a(a=1", 10, std::nullopt, nullptr},
1937 {"0x29 in parameterised list key", "foo; a)a=1", 10, std::nullopt, nullptr},
1938 {"0x2a in parameterised list key",
1939 "foo; a*a=1",
1940 10,
1941 {{{Item("foo", Item::kTokenType), {Param("a*a", 1)}}}},
1942 "foo;a*a=1"},
1943 {"0x2b in parameterised list key", "foo; a+a=1", 10, std::nullopt, nullptr},
1944 {"0x2c in parameterised list key", "foo; a,a=1", 10, std::nullopt, nullptr},
1945 {"0x2d in parameterised list key",
1946 "foo; a-a=1",
1947 10,
1948 {{{Item("foo", Item::kTokenType), {Param("a-a", 1)}}}},
1949 "foo;a-a=1"},
1950 {"0x2e in parameterised list key",
1951 "foo; a.a=1",
1952 10,
1953 {{{Item("foo", Item::kTokenType), {Param("a.a", 1)}}}},
1954 "foo;a.a=1"},
1955 {"0x2f in parameterised list key", "foo; a/a=1", 10, std::nullopt, nullptr},
1956 {"0x30 in parameterised list key",
1957 "foo; a0a=1",
1958 10,
1959 {{{Item("foo", Item::kTokenType), {Param("a0a", 1)}}}},
1960 "foo;a0a=1"},
1961 {"0x31 in parameterised list key",
1962 "foo; a1a=1",
1963 10,
1964 {{{Item("foo", Item::kTokenType), {Param("a1a", 1)}}}},
1965 "foo;a1a=1"},
1966 {"0x32 in parameterised list key",
1967 "foo; a2a=1",
1968 10,
1969 {{{Item("foo", Item::kTokenType), {Param("a2a", 1)}}}},
1970 "foo;a2a=1"},
1971 {"0x33 in parameterised list key",
1972 "foo; a3a=1",
1973 10,
1974 {{{Item("foo", Item::kTokenType), {Param("a3a", 1)}}}},
1975 "foo;a3a=1"},
1976 {"0x34 in parameterised list key",
1977 "foo; a4a=1",
1978 10,
1979 {{{Item("foo", Item::kTokenType), {Param("a4a", 1)}}}},
1980 "foo;a4a=1"},
1981 {"0x35 in parameterised list key",
1982 "foo; a5a=1",
1983 10,
1984 {{{Item("foo", Item::kTokenType), {Param("a5a", 1)}}}},
1985 "foo;a5a=1"},
1986 {"0x36 in parameterised list key",
1987 "foo; a6a=1",
1988 10,
1989 {{{Item("foo", Item::kTokenType), {Param("a6a", 1)}}}},
1990 "foo;a6a=1"},
1991 {"0x37 in parameterised list key",
1992 "foo; a7a=1",
1993 10,
1994 {{{Item("foo", Item::kTokenType), {Param("a7a", 1)}}}},
1995 "foo;a7a=1"},
1996 {"0x38 in parameterised list key",
1997 "foo; a8a=1",
1998 10,
1999 {{{Item("foo", Item::kTokenType), {Param("a8a", 1)}}}},
2000 "foo;a8a=1"},
2001 {"0x39 in parameterised list key",
2002 "foo; a9a=1",
2003 10,
2004 {{{Item("foo", Item::kTokenType), {Param("a9a", 1)}}}},
2005 "foo;a9a=1"},
2006 {"0x3a in parameterised list key", "foo; a:a=1", 10, std::nullopt, nullptr},
2007 {"0x3b in parameterised list key",
2008 "foo; a;a=1",
2009 10,
2010 {{{Item("foo", Item::kTokenType), {Param("a", 1)}}}},
2011 "foo;a=1"},
2012 {"0x3c in parameterised list key", "foo; a<a=1", 10, std::nullopt, nullptr},
2013 {"0x3d in parameterised list key", "foo; a=a=1", 10, std::nullopt, nullptr},
2014 {"0x3e in parameterised list key", "foo; a>a=1", 10, std::nullopt, nullptr},
2015 {"0x3f in parameterised list key", "foo; a?a=1", 10, std::nullopt, nullptr},
2016 {"0x40 in parameterised list key", "foo; a@a=1", 10, std::nullopt, nullptr},
2017 {"0x41 in parameterised list key", "foo; aAa=1", 10, std::nullopt, nullptr},
2018 {"0x42 in parameterised list key", "foo; aBa=1", 10, std::nullopt, nullptr},
2019 {"0x43 in parameterised list key", "foo; aCa=1", 10, std::nullopt, nullptr},
2020 {"0x44 in parameterised list key", "foo; aDa=1", 10, std::nullopt, nullptr},
2021 {"0x45 in parameterised list key", "foo; aEa=1", 10, std::nullopt, nullptr},
2022 {"0x46 in parameterised list key", "foo; aFa=1", 10, std::nullopt, nullptr},
2023 {"0x47 in parameterised list key", "foo; aGa=1", 10, std::nullopt, nullptr},
2024 {"0x48 in parameterised list key", "foo; aHa=1", 10, std::nullopt, nullptr},
2025 {"0x49 in parameterised list key", "foo; aIa=1", 10, std::nullopt, nullptr},
2026 {"0x4a in parameterised list key", "foo; aJa=1", 10, std::nullopt, nullptr},
2027 {"0x4b in parameterised list key", "foo; aKa=1", 10, std::nullopt, nullptr},
2028 {"0x4c in parameterised list key", "foo; aLa=1", 10, std::nullopt, nullptr},
2029 {"0x4d in parameterised list key", "foo; aMa=1", 10, std::nullopt, nullptr},
2030 {"0x4e in parameterised list key", "foo; aNa=1", 10, std::nullopt, nullptr},
2031 {"0x4f in parameterised list key", "foo; aOa=1", 10, std::nullopt, nullptr},
2032 {"0x50 in parameterised list key", "foo; aPa=1", 10, std::nullopt, nullptr},
2033 {"0x51 in parameterised list key", "foo; aQa=1", 10, std::nullopt, nullptr},
2034 {"0x52 in parameterised list key", "foo; aRa=1", 10, std::nullopt, nullptr},
2035 {"0x53 in parameterised list key", "foo; aSa=1", 10, std::nullopt, nullptr},
2036 {"0x54 in parameterised list key", "foo; aTa=1", 10, std::nullopt, nullptr},
2037 {"0x55 in parameterised list key", "foo; aUa=1", 10, std::nullopt, nullptr},
2038 {"0x56 in parameterised list key", "foo; aVa=1", 10, std::nullopt, nullptr},
2039 {"0x57 in parameterised list key", "foo; aWa=1", 10, std::nullopt, nullptr},
2040 {"0x58 in parameterised list key", "foo; aXa=1", 10, std::nullopt, nullptr},
2041 {"0x59 in parameterised list key", "foo; aYa=1", 10, std::nullopt, nullptr},
2042 {"0x5a in parameterised list key", "foo; aZa=1", 10, std::nullopt, nullptr},
2043 {"0x5b in parameterised list key", "foo; a[a=1", 10, std::nullopt, nullptr},
2044 {"0x5c in parameterised list key", "foo; a\\a=1", 10, std::nullopt,
2045 nullptr},
2046 {"0x5d in parameterised list key", "foo; a]a=1", 10, std::nullopt, nullptr},
2047 {"0x5e in parameterised list key", "foo; a^a=1", 10, std::nullopt, nullptr},
2048 {"0x5f in parameterised list key",
2049 "foo; a_a=1",
2050 10,
2051 {{{Item("foo", Item::kTokenType), {Param("a_a", 1)}}}},
2052 "foo;a_a=1"},
2053 {"0x60 in parameterised list key", "foo; a`a=1", 10, std::nullopt, nullptr},
2054 {"0x61 in parameterised list key",
2055 "foo; aaa=1",
2056 10,
2057 {{{Item("foo", Item::kTokenType), {Param("aaa", 1)}}}},
2058 "foo;aaa=1"},
2059 {"0x62 in parameterised list key",
2060 "foo; aba=1",
2061 10,
2062 {{{Item("foo", Item::kTokenType), {Param("aba", 1)}}}},
2063 "foo;aba=1"},
2064 {"0x63 in parameterised list key",
2065 "foo; aca=1",
2066 10,
2067 {{{Item("foo", Item::kTokenType), {Param("aca", 1)}}}},
2068 "foo;aca=1"},
2069 {"0x64 in parameterised list key",
2070 "foo; ada=1",
2071 10,
2072 {{{Item("foo", Item::kTokenType), {Param("ada", 1)}}}},
2073 "foo;ada=1"},
2074 {"0x65 in parameterised list key",
2075 "foo; aea=1",
2076 10,
2077 {{{Item("foo", Item::kTokenType), {Param("aea", 1)}}}},
2078 "foo;aea=1"},
2079 {"0x66 in parameterised list key",
2080 "foo; afa=1",
2081 10,
2082 {{{Item("foo", Item::kTokenType), {Param("afa", 1)}}}},
2083 "foo;afa=1"},
2084 {"0x67 in parameterised list key",
2085 "foo; aga=1",
2086 10,
2087 {{{Item("foo", Item::kTokenType), {Param("aga", 1)}}}},
2088 "foo;aga=1"},
2089 {"0x68 in parameterised list key",
2090 "foo; aha=1",
2091 10,
2092 {{{Item("foo", Item::kTokenType), {Param("aha", 1)}}}},
2093 "foo;aha=1"},
2094 {"0x69 in parameterised list key",
2095 "foo; aia=1",
2096 10,
2097 {{{Item("foo", Item::kTokenType), {Param("aia", 1)}}}},
2098 "foo;aia=1"},
2099 {"0x6a in parameterised list key",
2100 "foo; aja=1",
2101 10,
2102 {{{Item("foo", Item::kTokenType), {Param("aja", 1)}}}},
2103 "foo;aja=1"},
2104 {"0x6b in parameterised list key",
2105 "foo; aka=1",
2106 10,
2107 {{{Item("foo", Item::kTokenType), {Param("aka", 1)}}}},
2108 "foo;aka=1"},
2109 {"0x6c in parameterised list key",
2110 "foo; ala=1",
2111 10,
2112 {{{Item("foo", Item::kTokenType), {Param("ala", 1)}}}},
2113 "foo;ala=1"},
2114 {"0x6d in parameterised list key",
2115 "foo; ama=1",
2116 10,
2117 {{{Item("foo", Item::kTokenType), {Param("ama", 1)}}}},
2118 "foo;ama=1"},
2119 {"0x6e in parameterised list key",
2120 "foo; ana=1",
2121 10,
2122 {{{Item("foo", Item::kTokenType), {Param("ana", 1)}}}},
2123 "foo;ana=1"},
2124 {"0x6f in parameterised list key",
2125 "foo; aoa=1",
2126 10,
2127 {{{Item("foo", Item::kTokenType), {Param("aoa", 1)}}}},
2128 "foo;aoa=1"},
2129 {"0x70 in parameterised list key",
2130 "foo; apa=1",
2131 10,
2132 {{{Item("foo", Item::kTokenType), {Param("apa", 1)}}}},
2133 "foo;apa=1"},
2134 {"0x71 in parameterised list key",
2135 "foo; aqa=1",
2136 10,
2137 {{{Item("foo", Item::kTokenType), {Param("aqa", 1)}}}},
2138 "foo;aqa=1"},
2139 {"0x72 in parameterised list key",
2140 "foo; ara=1",
2141 10,
2142 {{{Item("foo", Item::kTokenType), {Param("ara", 1)}}}},
2143 "foo;ara=1"},
2144 {"0x73 in parameterised list key",
2145 "foo; asa=1",
2146 10,
2147 {{{Item("foo", Item::kTokenType), {Param("asa", 1)}}}},
2148 "foo;asa=1"},
2149 {"0x74 in parameterised list key",
2150 "foo; ata=1",
2151 10,
2152 {{{Item("foo", Item::kTokenType), {Param("ata", 1)}}}},
2153 "foo;ata=1"},
2154 {"0x75 in parameterised list key",
2155 "foo; aua=1",
2156 10,
2157 {{{Item("foo", Item::kTokenType), {Param("aua", 1)}}}},
2158 "foo;aua=1"},
2159 {"0x76 in parameterised list key",
2160 "foo; ava=1",
2161 10,
2162 {{{Item("foo", Item::kTokenType), {Param("ava", 1)}}}},
2163 "foo;ava=1"},
2164 {"0x77 in parameterised list key",
2165 "foo; awa=1",
2166 10,
2167 {{{Item("foo", Item::kTokenType), {Param("awa", 1)}}}},
2168 "foo;awa=1"},
2169 {"0x78 in parameterised list key",
2170 "foo; axa=1",
2171 10,
2172 {{{Item("foo", Item::kTokenType), {Param("axa", 1)}}}},
2173 "foo;axa=1"},
2174 {"0x79 in parameterised list key",
2175 "foo; aya=1",
2176 10,
2177 {{{Item("foo", Item::kTokenType), {Param("aya", 1)}}}},
2178 "foo;aya=1"},
2179 {"0x7a in parameterised list key",
2180 "foo; aza=1",
2181 10,
2182 {{{Item("foo", Item::kTokenType), {Param("aza", 1)}}}},
2183 "foo;aza=1"},
2184 {"0x7b in parameterised list key", "foo; a{a=1", 10, std::nullopt, nullptr},
2185 {"0x7c in parameterised list key", "foo; a|a=1", 10, std::nullopt, nullptr},
2186 {"0x7d in parameterised list key", "foo; a}a=1", 10, std::nullopt, nullptr},
2187 {"0x7e in parameterised list key", "foo; a~a=1", 10, std::nullopt, nullptr},
2188 {"0x7f in parameterised list key", "foo; a\177a=1", 10, std::nullopt,
2189 nullptr},
2190 {"0x00 starting a parameterised list key", "foo; \000a=1", 9, std::nullopt,
2191 nullptr},
2192 {"0x01 starting a parameterised list key", "foo; \001a=1", 9, std::nullopt,
2193 nullptr},
2194 {"0x02 starting a parameterised list key", "foo; \002a=1", 9, std::nullopt,
2195 nullptr},
2196 {"0x03 starting a parameterised list key", "foo; \003a=1", 9, std::nullopt,
2197 nullptr},
2198 {"0x04 starting a parameterised list key", "foo; \004a=1", 9, std::nullopt,
2199 nullptr},
2200 {"0x05 starting a parameterised list key", "foo; \005a=1", 9, std::nullopt,
2201 nullptr},
2202 {"0x06 starting a parameterised list key", "foo; \006a=1", 9, std::nullopt,
2203 nullptr},
2204 {"0x07 starting a parameterised list key", "foo; \aa=1", 9, std::nullopt,
2205 nullptr},
2206 {"0x08 starting a parameterised list key", "foo; \ba=1", 9, std::nullopt,
2207 nullptr},
2208 {"0x09 starting a parameterised list key", "foo; \ta=1", 9, std::nullopt,
2209 nullptr},
2210 {"0x0a starting a parameterised list key", "foo; \na=1", 9, std::nullopt,
2211 nullptr},
2212 {"0x0b starting a parameterised list key", "foo; \va=1", 9, std::nullopt,
2213 nullptr},
2214 {"0x0c starting a parameterised list key", "foo; \fa=1", 9, std::nullopt,
2215 nullptr},
2216 {"0x0d starting a parameterised list key", "foo; \ra=1", 9, std::nullopt,
2217 nullptr},
2218 {"0x0e starting a parameterised list key", "foo; \016a=1", 9, std::nullopt,
2219 nullptr},
2220 {"0x0f starting a parameterised list key", "foo; \017a=1", 9, std::nullopt,
2221 nullptr},
2222 {"0x10 starting a parameterised list key", "foo; \020a=1", 9, std::nullopt,
2223 nullptr},
2224 {"0x11 starting a parameterised list key", "foo; \021a=1", 9, std::nullopt,
2225 nullptr},
2226 {"0x12 starting a parameterised list key", "foo; \022a=1", 9, std::nullopt,
2227 nullptr},
2228 {"0x13 starting a parameterised list key", "foo; \023a=1", 9, std::nullopt,
2229 nullptr},
2230 {"0x14 starting a parameterised list key", "foo; \024a=1", 9, std::nullopt,
2231 nullptr},
2232 {"0x15 starting a parameterised list key", "foo; \025a=1", 9, std::nullopt,
2233 nullptr},
2234 {"0x16 starting a parameterised list key", "foo; \026a=1", 9, std::nullopt,
2235 nullptr},
2236 {"0x17 starting a parameterised list key", "foo; \027a=1", 9, std::nullopt,
2237 nullptr},
2238 {"0x18 starting a parameterised list key", "foo; \030a=1", 9, std::nullopt,
2239 nullptr},
2240 {"0x19 starting a parameterised list key", "foo; \031a=1", 9, std::nullopt,
2241 nullptr},
2242 {"0x1a starting a parameterised list key", "foo; \032a=1", 9, std::nullopt,
2243 nullptr},
2244 {"0x1b starting a parameterised list key", "foo; \033a=1", 9, std::nullopt,
2245 nullptr},
2246 {"0x1c starting a parameterised list key", "foo; \034a=1", 9, std::nullopt,
2247 nullptr},
2248 {"0x1d starting a parameterised list key", "foo; \035a=1", 9, std::nullopt,
2249 nullptr},
2250 {"0x1e starting a parameterised list key", "foo; \036a=1", 9, std::nullopt,
2251 nullptr},
2252 {"0x1f starting a parameterised list key", "foo; \037a=1", 9, std::nullopt,
2253 nullptr},
2254 {"0x20 starting a parameterised list key",
2255 "foo; a=1",
2256 9,
2257 {{{Item("foo", Item::kTokenType), {Param("a", 1)}}}},
2258 "foo;a=1"},
2259 {"0x21 starting a parameterised list key", "foo; !a=1", 9, std::nullopt,
2260 nullptr},
2261 {"0x22 starting a parameterised list key", "foo; \"a=1", 9, std::nullopt,
2262 nullptr},
2263 {"0x23 starting a parameterised list key", "foo; #a=1", 9, std::nullopt,
2264 nullptr},
2265 {"0x24 starting a parameterised list key", "foo; $a=1", 9, std::nullopt,
2266 nullptr},
2267 {"0x25 starting a parameterised list key", "foo; %a=1", 9, std::nullopt,
2268 nullptr},
2269 {"0x26 starting a parameterised list key", "foo; &a=1", 9, std::nullopt,
2270 nullptr},
2271 {"0x27 starting a parameterised list key", "foo; 'a=1", 9, std::nullopt,
2272 nullptr},
2273 {"0x28 starting a parameterised list key", "foo; (a=1", 9, std::nullopt,
2274 nullptr},
2275 {"0x29 starting a parameterised list key", "foo; )a=1", 9, std::nullopt,
2276 nullptr},
2277 {"0x2a starting a parameterised list key",
2278 "foo; *a=1",
2279 9,
2280 {{{Item("foo", Item::kTokenType), {Param("*a", 1)}}}},
2281 "foo;*a=1"},
2282 {"0x2b starting a parameterised list key", "foo; +a=1", 9, std::nullopt,
2283 nullptr},
2284 {"0x2c starting a parameterised list key", "foo; ,a=1", 9, std::nullopt,
2285 nullptr},
2286 {"0x2d starting a parameterised list key", "foo; -a=1", 9, std::nullopt,
2287 nullptr},
2288 {"0x2e starting a parameterised list key", "foo; .a=1", 9, std::nullopt,
2289 nullptr},
2290 {"0x2f starting a parameterised list key", "foo; /a=1", 9, std::nullopt,
2291 nullptr},
2292 {"0x30 starting a parameterised list key", "foo; 0a=1", 9, std::nullopt,
2293 nullptr},
2294 {"0x31 starting a parameterised list key", "foo; 1a=1", 9, std::nullopt,
2295 nullptr},
2296 {"0x32 starting a parameterised list key", "foo; 2a=1", 9, std::nullopt,
2297 nullptr},
2298 {"0x33 starting a parameterised list key", "foo; 3a=1", 9, std::nullopt,
2299 nullptr},
2300 {"0x34 starting a parameterised list key", "foo; 4a=1", 9, std::nullopt,
2301 nullptr},
2302 {"0x35 starting a parameterised list key", "foo; 5a=1", 9, std::nullopt,
2303 nullptr},
2304 {"0x36 starting a parameterised list key", "foo; 6a=1", 9, std::nullopt,
2305 nullptr},
2306 {"0x37 starting a parameterised list key", "foo; 7a=1", 9, std::nullopt,
2307 nullptr},
2308 {"0x38 starting a parameterised list key", "foo; 8a=1", 9, std::nullopt,
2309 nullptr},
2310 {"0x39 starting a parameterised list key", "foo; 9a=1", 9, std::nullopt,
2311 nullptr},
2312 {"0x3a starting a parameterised list key", "foo; :a=1", 9, std::nullopt,
2313 nullptr},
2314 {"0x3b starting a parameterised list key", "foo; ;a=1", 9, std::nullopt,
2315 nullptr},
2316 {"0x3c starting a parameterised list key", "foo; <a=1", 9, std::nullopt,
2317 nullptr},
2318 {"0x3d starting a parameterised list key", "foo; =a=1", 9, std::nullopt,
2319 nullptr},
2320 {"0x3e starting a parameterised list key", "foo; >a=1", 9, std::nullopt,
2321 nullptr},
2322 {"0x3f starting a parameterised list key", "foo; ?a=1", 9, std::nullopt,
2323 nullptr},
2324 {"0x40 starting a parameterised list key", "foo; @a=1", 9, std::nullopt,
2325 nullptr},
2326 {"0x41 starting a parameterised list key", "foo; Aa=1", 9, std::nullopt,
2327 nullptr},
2328 {"0x42 starting a parameterised list key", "foo; Ba=1", 9, std::nullopt,
2329 nullptr},
2330 {"0x43 starting a parameterised list key", "foo; Ca=1", 9, std::nullopt,
2331 nullptr},
2332 {"0x44 starting a parameterised list key", "foo; Da=1", 9, std::nullopt,
2333 nullptr},
2334 {"0x45 starting a parameterised list key", "foo; Ea=1", 9, std::nullopt,
2335 nullptr},
2336 {"0x46 starting a parameterised list key", "foo; Fa=1", 9, std::nullopt,
2337 nullptr},
2338 {"0x47 starting a parameterised list key", "foo; Ga=1", 9, std::nullopt,
2339 nullptr},
2340 {"0x48 starting a parameterised list key", "foo; Ha=1", 9, std::nullopt,
2341 nullptr},
2342 {"0x49 starting a parameterised list key", "foo; Ia=1", 9, std::nullopt,
2343 nullptr},
2344 {"0x4a starting a parameterised list key", "foo; Ja=1", 9, std::nullopt,
2345 nullptr},
2346 {"0x4b starting a parameterised list key", "foo; Ka=1", 9, std::nullopt,
2347 nullptr},
2348 {"0x4c starting a parameterised list key", "foo; La=1", 9, std::nullopt,
2349 nullptr},
2350 {"0x4d starting a parameterised list key", "foo; Ma=1", 9, std::nullopt,
2351 nullptr},
2352 {"0x4e starting a parameterised list key", "foo; Na=1", 9, std::nullopt,
2353 nullptr},
2354 {"0x4f starting a parameterised list key", "foo; Oa=1", 9, std::nullopt,
2355 nullptr},
2356 {"0x50 starting a parameterised list key", "foo; Pa=1", 9, std::nullopt,
2357 nullptr},
2358 {"0x51 starting a parameterised list key", "foo; Qa=1", 9, std::nullopt,
2359 nullptr},
2360 {"0x52 starting a parameterised list key", "foo; Ra=1", 9, std::nullopt,
2361 nullptr},
2362 {"0x53 starting a parameterised list key", "foo; Sa=1", 9, std::nullopt,
2363 nullptr},
2364 {"0x54 starting a parameterised list key", "foo; Ta=1", 9, std::nullopt,
2365 nullptr},
2366 {"0x55 starting a parameterised list key", "foo; Ua=1", 9, std::nullopt,
2367 nullptr},
2368 {"0x56 starting a parameterised list key", "foo; Va=1", 9, std::nullopt,
2369 nullptr},
2370 {"0x57 starting a parameterised list key", "foo; Wa=1", 9, std::nullopt,
2371 nullptr},
2372 {"0x58 starting a parameterised list key", "foo; Xa=1", 9, std::nullopt,
2373 nullptr},
2374 {"0x59 starting a parameterised list key", "foo; Ya=1", 9, std::nullopt,
2375 nullptr},
2376 {"0x5a starting a parameterised list key", "foo; Za=1", 9, std::nullopt,
2377 nullptr},
2378 {"0x5b starting a parameterised list key", "foo; [a=1", 9, std::nullopt,
2379 nullptr},
2380 {"0x5c starting a parameterised list key", "foo; \\a=1", 9, std::nullopt,
2381 nullptr},
2382 {"0x5d starting a parameterised list key", "foo; ]a=1", 9, std::nullopt,
2383 nullptr},
2384 {"0x5e starting a parameterised list key", "foo; ^a=1", 9, std::nullopt,
2385 nullptr},
2386 {"0x5f starting a parameterised list key", "foo; _a=1", 9, std::nullopt,
2387 nullptr},
2388 {"0x60 starting a parameterised list key", "foo; `a=1", 9, std::nullopt,
2389 nullptr},
2390 {"0x61 starting a parameterised list key",
2391 "foo; aa=1",
2392 9,
2393 {{{Item("foo", Item::kTokenType), {Param("aa", 1)}}}},
2394 "foo;aa=1"},
2395 {"0x62 starting a parameterised list key",
2396 "foo; ba=1",
2397 9,
2398 {{{Item("foo", Item::kTokenType), {Param("ba", 1)}}}},
2399 "foo;ba=1"},
2400 {"0x63 starting a parameterised list key",
2401 "foo; ca=1",
2402 9,
2403 {{{Item("foo", Item::kTokenType), {Param("ca", 1)}}}},
2404 "foo;ca=1"},
2405 {"0x64 starting a parameterised list key",
2406 "foo; da=1",
2407 9,
2408 {{{Item("foo", Item::kTokenType), {Param("da", 1)}}}},
2409 "foo;da=1"},
2410 {"0x65 starting a parameterised list key",
2411 "foo; ea=1",
2412 9,
2413 {{{Item("foo", Item::kTokenType), {Param("ea", 1)}}}},
2414 "foo;ea=1"},
2415 {"0x66 starting a parameterised list key",
2416 "foo; fa=1",
2417 9,
2418 {{{Item("foo", Item::kTokenType), {Param("fa", 1)}}}},
2419 "foo;fa=1"},
2420 {"0x67 starting a parameterised list key",
2421 "foo; ga=1",
2422 9,
2423 {{{Item("foo", Item::kTokenType), {Param("ga", 1)}}}},
2424 "foo;ga=1"},
2425 {"0x68 starting a parameterised list key",
2426 "foo; ha=1",
2427 9,
2428 {{{Item("foo", Item::kTokenType), {Param("ha", 1)}}}},
2429 "foo;ha=1"},
2430 {"0x69 starting a parameterised list key",
2431 "foo; ia=1",
2432 9,
2433 {{{Item("foo", Item::kTokenType), {Param("ia", 1)}}}},
2434 "foo;ia=1"},
2435 {"0x6a starting a parameterised list key",
2436 "foo; ja=1",
2437 9,
2438 {{{Item("foo", Item::kTokenType), {Param("ja", 1)}}}},
2439 "foo;ja=1"},
2440 {"0x6b starting a parameterised list key",
2441 "foo; ka=1",
2442 9,
2443 {{{Item("foo", Item::kTokenType), {Param("ka", 1)}}}},
2444 "foo;ka=1"},
2445 {"0x6c starting a parameterised list key",
2446 "foo; la=1",
2447 9,
2448 {{{Item("foo", Item::kTokenType), {Param("la", 1)}}}},
2449 "foo;la=1"},
2450 {"0x6d starting a parameterised list key",
2451 "foo; ma=1",
2452 9,
2453 {{{Item("foo", Item::kTokenType), {Param("ma", 1)}}}},
2454 "foo;ma=1"},
2455 {"0x6e starting a parameterised list key",
2456 "foo; na=1",
2457 9,
2458 {{{Item("foo", Item::kTokenType), {Param("na", 1)}}}},
2459 "foo;na=1"},
2460 {"0x6f starting a parameterised list key",
2461 "foo; oa=1",
2462 9,
2463 {{{Item("foo", Item::kTokenType), {Param("oa", 1)}}}},
2464 "foo;oa=1"},
2465 {"0x70 starting a parameterised list key",
2466 "foo; pa=1",
2467 9,
2468 {{{Item("foo", Item::kTokenType), {Param("pa", 1)}}}},
2469 "foo;pa=1"},
2470 {"0x71 starting a parameterised list key",
2471 "foo; qa=1",
2472 9,
2473 {{{Item("foo", Item::kTokenType), {Param("qa", 1)}}}},
2474 "foo;qa=1"},
2475 {"0x72 starting a parameterised list key",
2476 "foo; ra=1",
2477 9,
2478 {{{Item("foo", Item::kTokenType), {Param("ra", 1)}}}},
2479 "foo;ra=1"},
2480 {"0x73 starting a parameterised list key",
2481 "foo; sa=1",
2482 9,
2483 {{{Item("foo", Item::kTokenType), {Param("sa", 1)}}}},
2484 "foo;sa=1"},
2485 {"0x74 starting a parameterised list key",
2486 "foo; ta=1",
2487 9,
2488 {{{Item("foo", Item::kTokenType), {Param("ta", 1)}}}},
2489 "foo;ta=1"},
2490 {"0x75 starting a parameterised list key",
2491 "foo; ua=1",
2492 9,
2493 {{{Item("foo", Item::kTokenType), {Param("ua", 1)}}}},
2494 "foo;ua=1"},
2495 {"0x76 starting a parameterised list key",
2496 "foo; va=1",
2497 9,
2498 {{{Item("foo", Item::kTokenType), {Param("va", 1)}}}},
2499 "foo;va=1"},
2500 {"0x77 starting a parameterised list key",
2501 "foo; wa=1",
2502 9,
2503 {{{Item("foo", Item::kTokenType), {Param("wa", 1)}}}},
2504 "foo;wa=1"},
2505 {"0x78 starting a parameterised list key",
2506 "foo; xa=1",
2507 9,
2508 {{{Item("foo", Item::kTokenType), {Param("xa", 1)}}}},
2509 "foo;xa=1"},
2510 {"0x79 starting a parameterised list key",
2511 "foo; ya=1",
2512 9,
2513 {{{Item("foo", Item::kTokenType), {Param("ya", 1)}}}},
2514 "foo;ya=1"},
2515 {"0x7a starting a parameterised list key",
2516 "foo; za=1",
2517 9,
2518 {{{Item("foo", Item::kTokenType), {Param("za", 1)}}}},
2519 "foo;za=1"},
2520 {"0x7b starting a parameterised list key", "foo; {a=1", 9, std::nullopt,
2521 nullptr},
2522 {"0x7c starting a parameterised list key", "foo; |a=1", 9, std::nullopt,
2523 nullptr},
2524 {"0x7d starting a parameterised list key", "foo; }a=1", 9, std::nullopt,
2525 nullptr},
2526 {"0x7e starting a parameterised list key", "foo; ~a=1", 9, std::nullopt,
2527 nullptr},
2528 {"0x7f starting a parameterised list key", "foo; \177a=1", 9, std::nullopt,
2529 nullptr},
2530 // list.json
2531 {"basic list",
2532 "1, 42",
2533 5,
2534 {{{Integer(1), {}}, {Integer(42), {}}}},
2535 nullptr},
2536 {"empty list", "", 0, {List()}, nullptr},
2537 {"leading SP list",
2538 " 42, 43",
2539 8,
2540 {{{Integer(42), {}}, {Integer(43), {}}}},
2541 "42, 43"},
2542 {"single item list", "42", 2, {{{Integer(42), {}}}}, nullptr},
2543 {"no whitespace list",
2544 "1,42",
2545 4,
2546 {{{Integer(1), {}}, {Integer(42), {}}}},
2547 "1, 42"},
2548 {"extra whitespace list",
2549 "1 , 42",
2550 6,
2551 {{{Integer(1), {}}, {Integer(42), {}}}},
2552 "1, 42"},
2553 {"tab separated list",
2554 "1\t,\t42",
2555 6,
2556 {{{Integer(1), {}}, {Integer(42), {}}}},
2557 "1, 42"},
2558 {"two line list",
2559 "1, 42",
2560 5,
2561 {{{Integer(1), {}}, {Integer(42), {}}}},
2562 "1, 42"},
2563 {"trailing comma list", "1, 42,", 6, std::nullopt, nullptr},
2564 {"empty item list", "1,,42", 5, std::nullopt, nullptr},
2565 {"empty item list (multiple field lines)", "1, , 42", 7, std::nullopt,
2566 nullptr},
2567 // listlist.json
2568 {"basic list of lists",
2569 "(1 2), (42 43)",
2570 14,
2571 {{{{{Integer(1), {}}, {Integer(2), {}}}, {}},
2572 {{{Integer(42), {}}, {Integer(43), {}}}, {}}}},
2573 nullptr},
2574 {"single item list of lists",
2575 "(42)",
2576 4,
2577 {{{{{Integer(42), {}}}, {}}}},
2578 nullptr},
2579 {"empty item list of lists",
2580 "()",
2581 2,
2582 {{{std::vector<ParameterizedItem>(), {}}}},
2583 nullptr},
2584 {"empty middle item list of lists",
2585 "(1),(),(42)",
2586 11,
2587 {{{{{Integer(1), {}}}, {}},
2588 {std::vector<ParameterizedItem>(), {}},
2589 {{{Integer(42), {}}}, {}}}},
2590 "(1), (), (42)"},
2591 {"extra whitespace list of lists",
2592 "( 1 42 )",
2593 11,
2594 {{{{{Integer(1), {}}, {Integer(42), {}}}, {}}}},
2595 "(1 42)"},
2596 {"wrong whitespace list of lists", "(1\t 42)", 7, std::nullopt, nullptr},
2597 {"no trailing parenthesis list of lists", "(1 42", 5, std::nullopt,
2598 nullptr},
2599 {"no trailing parenthesis middle list of lists", "(1 2, (42 43)", 13,
2600 std::nullopt, nullptr},
2601 {"no spaces in inner-list", "(abc\"def\"?0123*dXZ3*xyz)", 24, std::nullopt,
2602 nullptr},
2603 {"no closing parenthesis", "(", 1, std::nullopt, nullptr},
2604 // param-list.json
2605 {"basic parameterised list",
2606 "abc_123;a=1;b=2; cdef_456, ghi;q=9;r=\"+w\"",
2607 41,
2608 {{{Item("abc_123", Item::kTokenType),
2609 {Param("a", 1), Param("b", 2), BooleanParam("cdef_456", true)}},
2610 {Item("ghi", Item::kTokenType), {Param("q", 9), Param("r", "+w")}}}},
2611 "abc_123;a=1;b=2;cdef_456, ghi;q=9;r=\"+w\""},
2612 {"single item parameterised list",
2613 "text/html;q=1.0",
2614 15,
2615 {{{Item("text/html", Item::kTokenType), {DoubleParam("q", 1.000000)}}}},
2616 nullptr},
2617 {"missing parameter value parameterised list",
2618 "text/html;a;q=1.0",
2619 17,
2620 {{{Item("text/html", Item::kTokenType),
2621 {BooleanParam("a", true), DoubleParam("q", 1.000000)}}}},
2622 nullptr},
2623 {"missing terminal parameter value parameterised list",
2624 "text/html;q=1.0;a",
2625 17,
2626 {{{Item("text/html", Item::kTokenType),
2627 {DoubleParam("q", 1.000000), BooleanParam("a", true)}}}},
2628 nullptr},
2629 {"no whitespace parameterised list",
2630 "text/html,text/plain;q=0.5",
2631 26,
2632 {{{Item("text/html", Item::kTokenType), {}},
2633 {Item("text/plain", Item::kTokenType), {DoubleParam("q", 0.500000)}}}},
2634 "text/html, text/plain;q=0.5"},
2635 {"whitespace before = parameterised list", "text/html, text/plain;q =0.5",
2636 28, std::nullopt, nullptr},
2637 {"whitespace after = parameterised list", "text/html, text/plain;q= 0.5",
2638 28, std::nullopt, nullptr},
2639 {"whitespace before ; parameterised list", "text/html, text/plain ;q=0.5",
2640 28, std::nullopt, nullptr},
2641 {"whitespace after ; parameterised list",
2642 "text/html, text/plain; q=0.5",
2643 28,
2644 {{{Item("text/html", Item::kTokenType), {}},
2645 {Item("text/plain", Item::kTokenType), {DoubleParam("q", 0.500000)}}}},
2646 "text/html, text/plain;q=0.5"},
2647 {"extra whitespace parameterised list",
2648 "text/html , text/plain; q=0.5; charset=utf-8",
2649 48,
2650 {{{Item("text/html", Item::kTokenType), {}},
2651 {Item("text/plain", Item::kTokenType),
2652 {DoubleParam("q", 0.500000), TokenParam("charset", "utf-8")}}}},
2653 "text/html, text/plain;q=0.5;charset=utf-8"},
2654 {"two lines parameterised list",
2655 "text/html, text/plain;q=0.5",
2656 27,
2657 {{{Item("text/html", Item::kTokenType), {}},
2658 {Item("text/plain", Item::kTokenType), {DoubleParam("q", 0.500000)}}}},
2659 "text/html, text/plain;q=0.5"},
2660 {"trailing comma parameterised list", "text/html,text/plain;q=0.5,", 27,
2661 std::nullopt, nullptr},
2662 {"empty item parameterised list", "text/html,,text/plain;q=0.5,", 28,
2663 std::nullopt, nullptr},
2664 // param-listlist.json
2665 {"parameterised inner list",
2666 "(abc_123);a=1;b=2, cdef_456",
2667 27,
2668 {{{{{Item("abc_123", Item::kTokenType), {}}},
2669 {Param("a", 1), Param("b", 2)}},
2670 {Item("cdef_456", Item::kTokenType), {}}}},
2671 nullptr},
2672 {"parameterised inner list item",
2673 "(abc_123;a=1;b=2;cdef_456)",
2674 26,
2675 {{{{{Item("abc_123", Item::kTokenType),
2676 {Param("a", 1), Param("b", 2), BooleanParam("cdef_456", true)}}},
2677 {}}}},
2678 nullptr},
2679 {"parameterised inner list with parameterised item",
2680 "(abc_123;a=1;b=2);cdef_456",
2681 26,
2682 {{{{{Item("abc_123", Item::kTokenType), {Param("a", 1), Param("b", 2)}}},
2683 {BooleanParam("cdef_456", true)}}}},
2684 nullptr},
2685 // token.json
2686 {"basic token - list",
2687 "a_b-c3/*",
2688 8,
2689 {{{Item("a_b-c3/*", Item::kTokenType), {}}}},
2690 nullptr},
2691 {"token with capitals - list",
2692 "fooBar",
2693 6,
2694 {{{Item("fooBar", Item::kTokenType), {}}}},
2695 nullptr},
2696 {"token starting with capitals - list",
2697 "FooBar",
2698 6,
2699 {{{Item("FooBar", Item::kTokenType), {}}}},
2700 nullptr},
2701 };
2702
2703 const struct DictionaryTestCase {
2704 const char* name;
2705 const char* raw;
2706 size_t raw_len;
2707 const std::optional<Dictionary>
2708 expected; // nullopt if parse error is expected.
2709 const char* canonical; // nullptr if parse error is expected, or if canonical
2710 // format is identical to raw.
2711 } dictionary_test_cases[] = {
2712 // dictionary.json
2713 {"basic dictionary",
2714 "en=\"Applepie\", da=:w4ZibGV0w6ZydGUK:",
2715 36,
2716 {Dictionary{
2717 {{"en", {Item("Applepie"), {}}},
2718 {"da",
2719 {Item("\303\206blet\303\246rte\n", Item::kByteSequenceType), {}}}}}},
2720 nullptr},
2721 {"empty dictionary", "", 0, {Dictionary{{}}}, nullptr},
2722 {"single item dictionary",
2723 "a=1",
2724 3,
2725 {Dictionary{{{"a", {Integer(1), {}}}}}},
2726 nullptr},
2727 {"list item dictionary",
2728 "a=(1 2)",
2729 7,
2730 {Dictionary{{{"a", {{{Integer(1), {}}, {Integer(2), {}}}, {}}}}}},
2731 nullptr},
2732 {"single list item dictionary",
2733 "a=(1)",
2734 5,
2735 {Dictionary{{{"a", {{{Integer(1), {}}}, {}}}}}},
2736 nullptr},
2737 {"empty list item dictionary",
2738 "a=()",
2739 4,
2740 {Dictionary{{{"a", {std::vector<ParameterizedItem>(), {}}}}}},
2741 nullptr},
2742 {"no whitespace dictionary",
2743 "a=1,b=2",
2744 7,
2745 {Dictionary{{{"a", {Integer(1), {}}}, {"b", {Integer(2), {}}}}}},
2746 "a=1, b=2"},
2747 {"extra whitespace dictionary",
2748 "a=1 , b=2",
2749 10,
2750 {Dictionary{{{"a", {Integer(1), {}}}, {"b", {Integer(2), {}}}}}},
2751 "a=1, b=2"},
2752 {"tab separated dictionary",
2753 "a=1\t,\tb=2",
2754 9,
2755 {Dictionary{{{"a", {Integer(1), {}}}, {"b", {Integer(2), {}}}}}},
2756 "a=1, b=2"},
2757 {"leading whitespace dictionary",
2758 " a=1 , b=2",
2759 15,
2760 {Dictionary{{{"a", {Integer(1), {}}}, {"b", {Integer(2), {}}}}}},
2761 "a=1, b=2"},
2762 {"whitespace before = dictionary", "a =1, b=2", 9, std::nullopt, nullptr},
2763 {"whitespace after = dictionary", "a=1, b= 2", 9, std::nullopt, nullptr},
2764 {"two lines dictionary",
2765 "a=1, b=2",
2766 8,
2767 {Dictionary{{{"a", {Integer(1), {}}}, {"b", {Integer(2), {}}}}}},
2768 "a=1, b=2"},
2769 {"missing value dictionary",
2770 "a=1, b, c=3",
2771 11,
2772 {Dictionary{{{"a", {Integer(1), {}}},
2773 {"b", {Item(true), {}}},
2774 {"c", {Integer(3), {}}}}}},
2775 nullptr},
2776 {"all missing value dictionary",
2777 "a, b, c",
2778 7,
2779 {Dictionary{{{"a", {Item(true), {}}},
2780 {"b", {Item(true), {}}},
2781 {"c", {Item(true), {}}}}}},
2782 nullptr},
2783 {"start missing value dictionary",
2784 "a, b=2",
2785 6,
2786 {Dictionary{{{"a", {Item(true), {}}}, {"b", {Integer(2), {}}}}}},
2787 nullptr},
2788 {"end missing value dictionary",
2789 "a=1, b",
2790 6,
2791 {Dictionary{{{"a", {Integer(1), {}}}, {"b", {Item(true), {}}}}}},
2792 nullptr},
2793 {"missing value with params dictionary",
2794 "a=1, b;foo=9, c=3",
2795 17,
2796 {Dictionary{{{"a", {Integer(1), {}}},
2797 {"b", {Item(true), {Param("foo", 9)}}},
2798 {"c", {Integer(3), {}}}}}},
2799 nullptr},
2800 {"explicit true value with params dictionary",
2801 "a=1, b=?1;foo=9, c=3",
2802 20,
2803 {Dictionary{{{"a", {Integer(1), {}}},
2804 {"b", {Item(true), {Param("foo", 9)}}},
2805 {"c", {Integer(3), {}}}}}},
2806 "a=1, b;foo=9, c=3"},
2807 {"trailing comma dictionary", "a=1, b=2,", 9, std::nullopt, nullptr},
2808 {"empty item dictionary", "a=1,,b=2,", 9, std::nullopt, nullptr},
2809 {"duplicate key dictionary",
2810 "a=1,b=2,a=3",
2811 11,
2812 {Dictionary{{{"a", {Integer(3), {}}}, {"b", {Integer(2), {}}}}}},
2813 "a=3, b=2"},
2814 {"numeric key dictionary", "a=1,1b=2,a=1", 12, std::nullopt, nullptr},
2815 {"uppercase key dictionary", "a=1,B=2,a=1", 11, std::nullopt, nullptr},
2816 {"bad key dictionary", "a=1,b!=2,a=1", 12, std::nullopt, nullptr},
2817 // examples.json
2818 {"Example-DictHeader",
2819 "en=\"Applepie\", da=:w4ZibGV0w6ZydGU=:",
2820 36,
2821 {Dictionary{
2822 {{"en", {Item("Applepie"), {}}},
2823 {"da",
2824 {Item("\303\206blet\303\246rte", Item::kByteSequenceType), {}}}}}},
2825 nullptr},
2826 {"Example-DictHeader (boolean values)",
2827 "a=?0, b, c; foo=bar",
2828 19,
2829 {Dictionary{{{"a", {Item(false), {}}},
2830 {"b", {Item(true), {}}},
2831 {"c", {Item(true), {TokenParam("foo", "bar")}}}}}},
2832 "a=?0, b, c;foo=bar"},
2833 {"Example-DictListHeader",
2834 "rating=1.5, feelings=(joy sadness)",
2835 34,
2836 {Dictionary{{{"rating", {Item(1.500000), {}}},
2837 {"feelings",
2838 {{{Item("joy", Item::kTokenType), {}},
2839 {Item("sadness", Item::kTokenType), {}}},
2840 {}}}}}},
2841 nullptr},
2842 {"Example-MixDict",
2843 "a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid",
2844 38,
2845 {Dictionary{{{"a", {{{Integer(1), {}}, {Integer(2), {}}}, {}}},
2846 {"b", {Integer(3), {}}},
2847 {"c", {Integer(4), {TokenParam("aa", "bb")}}},
2848 {"d",
2849 {{{Integer(5), {}}, {Integer(6), {}}},
2850 {BooleanParam("valid", true)}}}}}},
2851 "a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid"},
2852 {"Example-Hdr (dictionary on one line)",
2853 "foo=1, bar=2",
2854 12,
2855 {Dictionary{{{"foo", {Integer(1), {}}}, {"bar", {Integer(2), {}}}}}},
2856 nullptr},
2857 {"Example-Hdr (dictionary on two lines)",
2858 "foo=1, bar=2",
2859 12,
2860 {Dictionary{{{"foo", {Integer(1), {}}}, {"bar", {Integer(2), {}}}}}},
2861 "foo=1, bar=2"},
2862 // key-generated.json
2863 {"0x00 as a single-character dictionary key", "\000=1", 3, std::nullopt,
2864 nullptr},
2865 {"0x01 as a single-character dictionary key", "\001=1", 3, std::nullopt,
2866 nullptr},
2867 {"0x02 as a single-character dictionary key", "\002=1", 3, std::nullopt,
2868 nullptr},
2869 {"0x03 as a single-character dictionary key", "\003=1", 3, std::nullopt,
2870 nullptr},
2871 {"0x04 as a single-character dictionary key", "\004=1", 3, std::nullopt,
2872 nullptr},
2873 {"0x05 as a single-character dictionary key", "\005=1", 3, std::nullopt,
2874 nullptr},
2875 {"0x06 as a single-character dictionary key", "\006=1", 3, std::nullopt,
2876 nullptr},
2877 {"0x07 as a single-character dictionary key", "\a=1", 3, std::nullopt,
2878 nullptr},
2879 {"0x08 as a single-character dictionary key", "\b=1", 3, std::nullopt,
2880 nullptr},
2881 {"0x09 as a single-character dictionary key", "\t=1", 3, std::nullopt,
2882 nullptr},
2883 {"0x0a as a single-character dictionary key", "\n=1", 3, std::nullopt,
2884 nullptr},
2885 {"0x0b as a single-character dictionary key", "\v=1", 3, std::nullopt,
2886 nullptr},
2887 {"0x0c as a single-character dictionary key", "\f=1", 3, std::nullopt,
2888 nullptr},
2889 {"0x0d as a single-character dictionary key", "\r=1", 3, std::nullopt,
2890 nullptr},
2891 {"0x0e as a single-character dictionary key", "\016=1", 3, std::nullopt,
2892 nullptr},
2893 {"0x0f as a single-character dictionary key", "\017=1", 3, std::nullopt,
2894 nullptr},
2895 {"0x10 as a single-character dictionary key", "\020=1", 3, std::nullopt,
2896 nullptr},
2897 {"0x11 as a single-character dictionary key", "\021=1", 3, std::nullopt,
2898 nullptr},
2899 {"0x12 as a single-character dictionary key", "\022=1", 3, std::nullopt,
2900 nullptr},
2901 {"0x13 as a single-character dictionary key", "\023=1", 3, std::nullopt,
2902 nullptr},
2903 {"0x14 as a single-character dictionary key", "\024=1", 3, std::nullopt,
2904 nullptr},
2905 {"0x15 as a single-character dictionary key", "\025=1", 3, std::nullopt,
2906 nullptr},
2907 {"0x16 as a single-character dictionary key", "\026=1", 3, std::nullopt,
2908 nullptr},
2909 {"0x17 as a single-character dictionary key", "\027=1", 3, std::nullopt,
2910 nullptr},
2911 {"0x18 as a single-character dictionary key", "\030=1", 3, std::nullopt,
2912 nullptr},
2913 {"0x19 as a single-character dictionary key", "\031=1", 3, std::nullopt,
2914 nullptr},
2915 {"0x1a as a single-character dictionary key", "\032=1", 3, std::nullopt,
2916 nullptr},
2917 {"0x1b as a single-character dictionary key", "\033=1", 3, std::nullopt,
2918 nullptr},
2919 {"0x1c as a single-character dictionary key", "\034=1", 3, std::nullopt,
2920 nullptr},
2921 {"0x1d as a single-character dictionary key", "\035=1", 3, std::nullopt,
2922 nullptr},
2923 {"0x1e as a single-character dictionary key", "\036=1", 3, std::nullopt,
2924 nullptr},
2925 {"0x1f as a single-character dictionary key", "\037=1", 3, std::nullopt,
2926 nullptr},
2927 {"0x20 as a single-character dictionary key", "=1", 2, std::nullopt,
2928 nullptr},
2929 {"0x21 as a single-character dictionary key", "!=1", 3, std::nullopt,
2930 nullptr},
2931 {"0x22 as a single-character dictionary key", "\"=1", 3, std::nullopt,
2932 nullptr},
2933 {"0x23 as a single-character dictionary key", "#=1", 3, std::nullopt,
2934 nullptr},
2935 {"0x24 as a single-character dictionary key", "$=1", 3, std::nullopt,
2936 nullptr},
2937 {"0x25 as a single-character dictionary key", "%=1", 3, std::nullopt,
2938 nullptr},
2939 {"0x26 as a single-character dictionary key", "&=1", 3, std::nullopt,
2940 nullptr},
2941 {"0x27 as a single-character dictionary key", "'=1", 3, std::nullopt,
2942 nullptr},
2943 {"0x28 as a single-character dictionary key", "(=1", 3, std::nullopt,
2944 nullptr},
2945 {"0x29 as a single-character dictionary key", ")=1", 3, std::nullopt,
2946 nullptr},
2947 {"0x2a as a single-character dictionary key",
2948 "*=1",
2949 3,
2950 {Dictionary{{{"*", {Integer(1), {}}}}}},
2951 nullptr},
2952 {"0x2b as a single-character dictionary key", "+=1", 3, std::nullopt,
2953 nullptr},
2954 {"0x2c as a single-character dictionary key", ",=1", 3, std::nullopt,
2955 nullptr},
2956 {"0x2d as a single-character dictionary key", "-=1", 3, std::nullopt,
2957 nullptr},
2958 {"0x2e as a single-character dictionary key", ".=1", 3, std::nullopt,
2959 nullptr},
2960 {"0x2f as a single-character dictionary key", "/=1", 3, std::nullopt,
2961 nullptr},
2962 {"0x30 as a single-character dictionary key", "0=1", 3, std::nullopt,
2963 nullptr},
2964 {"0x31 as a single-character dictionary key", "1=1", 3, std::nullopt,
2965 nullptr},
2966 {"0x32 as a single-character dictionary key", "2=1", 3, std::nullopt,
2967 nullptr},
2968 {"0x33 as a single-character dictionary key", "3=1", 3, std::nullopt,
2969 nullptr},
2970 {"0x34 as a single-character dictionary key", "4=1", 3, std::nullopt,
2971 nullptr},
2972 {"0x35 as a single-character dictionary key", "5=1", 3, std::nullopt,
2973 nullptr},
2974 {"0x36 as a single-character dictionary key", "6=1", 3, std::nullopt,
2975 nullptr},
2976 {"0x37 as a single-character dictionary key", "7=1", 3, std::nullopt,
2977 nullptr},
2978 {"0x38 as a single-character dictionary key", "8=1", 3, std::nullopt,
2979 nullptr},
2980 {"0x39 as a single-character dictionary key", "9=1", 3, std::nullopt,
2981 nullptr},
2982 {"0x3a as a single-character dictionary key", ":=1", 3, std::nullopt,
2983 nullptr},
2984 {"0x3b as a single-character dictionary key", ";=1", 3, std::nullopt,
2985 nullptr},
2986 {"0x3c as a single-character dictionary key", "<=1", 3, std::nullopt,
2987 nullptr},
2988 {"0x3d as a single-character dictionary key", "==1", 3, std::nullopt,
2989 nullptr},
2990 {"0x3e as a single-character dictionary key", ">=1", 3, std::nullopt,
2991 nullptr},
2992 {"0x3f as a single-character dictionary key", "?=1", 3, std::nullopt,
2993 nullptr},
2994 {"0x40 as a single-character dictionary key", "@=1", 3, std::nullopt,
2995 nullptr},
2996 {"0x41 as a single-character dictionary key", "A=1", 3, std::nullopt,
2997 nullptr},
2998 {"0x42 as a single-character dictionary key", "B=1", 3, std::nullopt,
2999 nullptr},
3000 {"0x43 as a single-character dictionary key", "C=1", 3, std::nullopt,
3001 nullptr},
3002 {"0x44 as a single-character dictionary key", "D=1", 3, std::nullopt,
3003 nullptr},
3004 {"0x45 as a single-character dictionary key", "E=1", 3, std::nullopt,
3005 nullptr},
3006 {"0x46 as a single-character dictionary key", "F=1", 3, std::nullopt,
3007 nullptr},
3008 {"0x47 as a single-character dictionary key", "G=1", 3, std::nullopt,
3009 nullptr},
3010 {"0x48 as a single-character dictionary key", "H=1", 3, std::nullopt,
3011 nullptr},
3012 {"0x49 as a single-character dictionary key", "I=1", 3, std::nullopt,
3013 nullptr},
3014 {"0x4a as a single-character dictionary key", "J=1", 3, std::nullopt,
3015 nullptr},
3016 {"0x4b as a single-character dictionary key", "K=1", 3, std::nullopt,
3017 nullptr},
3018 {"0x4c as a single-character dictionary key", "L=1", 3, std::nullopt,
3019 nullptr},
3020 {"0x4d as a single-character dictionary key", "M=1", 3, std::nullopt,
3021 nullptr},
3022 {"0x4e as a single-character dictionary key", "N=1", 3, std::nullopt,
3023 nullptr},
3024 {"0x4f as a single-character dictionary key", "O=1", 3, std::nullopt,
3025 nullptr},
3026 {"0x50 as a single-character dictionary key", "P=1", 3, std::nullopt,
3027 nullptr},
3028 {"0x51 as a single-character dictionary key", "Q=1", 3, std::nullopt,
3029 nullptr},
3030 {"0x52 as a single-character dictionary key", "R=1", 3, std::nullopt,
3031 nullptr},
3032 {"0x53 as a single-character dictionary key", "S=1", 3, std::nullopt,
3033 nullptr},
3034 {"0x54 as a single-character dictionary key", "T=1", 3, std::nullopt,
3035 nullptr},
3036 {"0x55 as a single-character dictionary key", "U=1", 3, std::nullopt,
3037 nullptr},
3038 {"0x56 as a single-character dictionary key", "V=1", 3, std::nullopt,
3039 nullptr},
3040 {"0x57 as a single-character dictionary key", "W=1", 3, std::nullopt,
3041 nullptr},
3042 {"0x58 as a single-character dictionary key", "X=1", 3, std::nullopt,
3043 nullptr},
3044 {"0x59 as a single-character dictionary key", "Y=1", 3, std::nullopt,
3045 nullptr},
3046 {"0x5a as a single-character dictionary key", "Z=1", 3, std::nullopt,
3047 nullptr},
3048 {"0x5b as a single-character dictionary key", "[=1", 3, std::nullopt,
3049 nullptr},
3050 {"0x5c as a single-character dictionary key", "\\=1", 3, std::nullopt,
3051 nullptr},
3052 {"0x5d as a single-character dictionary key", "]=1", 3, std::nullopt,
3053 nullptr},
3054 {"0x5e as a single-character dictionary key", "^=1", 3, std::nullopt,
3055 nullptr},
3056 {"0x5f as a single-character dictionary key", "_=1", 3, std::nullopt,
3057 nullptr},
3058 {"0x60 as a single-character dictionary key", "`=1", 3, std::nullopt,
3059 nullptr},
3060 {"0x61 as a single-character dictionary key",
3061 "a=1",
3062 3,
3063 {Dictionary{{{"a", {Integer(1), {}}}}}},
3064 nullptr},
3065 {"0x62 as a single-character dictionary key",
3066 "b=1",
3067 3,
3068 {Dictionary{{{"b", {Integer(1), {}}}}}},
3069 nullptr},
3070 {"0x63 as a single-character dictionary key",
3071 "c=1",
3072 3,
3073 {Dictionary{{{"c", {Integer(1), {}}}}}},
3074 nullptr},
3075 {"0x64 as a single-character dictionary key",
3076 "d=1",
3077 3,
3078 {Dictionary{{{"d", {Integer(1), {}}}}}},
3079 nullptr},
3080 {"0x65 as a single-character dictionary key",
3081 "e=1",
3082 3,
3083 {Dictionary{{{"e", {Integer(1), {}}}}}},
3084 nullptr},
3085 {"0x66 as a single-character dictionary key",
3086 "f=1",
3087 3,
3088 {Dictionary{{{"f", {Integer(1), {}}}}}},
3089 nullptr},
3090 {"0x67 as a single-character dictionary key",
3091 "g=1",
3092 3,
3093 {Dictionary{{{"g", {Integer(1), {}}}}}},
3094 nullptr},
3095 {"0x68 as a single-character dictionary key",
3096 "h=1",
3097 3,
3098 {Dictionary{{{"h", {Integer(1), {}}}}}},
3099 nullptr},
3100 {"0x69 as a single-character dictionary key",
3101 "i=1",
3102 3,
3103 {Dictionary{{{"i", {Integer(1), {}}}}}},
3104 nullptr},
3105 {"0x6a as a single-character dictionary key",
3106 "j=1",
3107 3,
3108 {Dictionary{{{"j", {Integer(1), {}}}}}},
3109 nullptr},
3110 {"0x6b as a single-character dictionary key",
3111 "k=1",
3112 3,
3113 {Dictionary{{{"k", {Integer(1), {}}}}}},
3114 nullptr},
3115 {"0x6c as a single-character dictionary key",
3116 "l=1",
3117 3,
3118 {Dictionary{{{"l", {Integer(1), {}}}}}},
3119 nullptr},
3120 {"0x6d as a single-character dictionary key",
3121 "m=1",
3122 3,
3123 {Dictionary{{{"m", {Integer(1), {}}}}}},
3124 nullptr},
3125 {"0x6e as a single-character dictionary key",
3126 "n=1",
3127 3,
3128 {Dictionary{{{"n", {Integer(1), {}}}}}},
3129 nullptr},
3130 {"0x6f as a single-character dictionary key",
3131 "o=1",
3132 3,
3133 {Dictionary{{{"o", {Integer(1), {}}}}}},
3134 nullptr},
3135 {"0x70 as a single-character dictionary key",
3136 "p=1",
3137 3,
3138 {Dictionary{{{"p", {Integer(1), {}}}}}},
3139 nullptr},
3140 {"0x71 as a single-character dictionary key",
3141 "q=1",
3142 3,
3143 {Dictionary{{{"q", {Integer(1), {}}}}}},
3144 nullptr},
3145 {"0x72 as a single-character dictionary key",
3146 "r=1",
3147 3,
3148 {Dictionary{{{"r", {Integer(1), {}}}}}},
3149 nullptr},
3150 {"0x73 as a single-character dictionary key",
3151 "s=1",
3152 3,
3153 {Dictionary{{{"s", {Integer(1), {}}}}}},
3154 nullptr},
3155 {"0x74 as a single-character dictionary key",
3156 "t=1",
3157 3,
3158 {Dictionary{{{"t", {Integer(1), {}}}}}},
3159 nullptr},
3160 {"0x75 as a single-character dictionary key",
3161 "u=1",
3162 3,
3163 {Dictionary{{{"u", {Integer(1), {}}}}}},
3164 nullptr},
3165 {"0x76 as a single-character dictionary key",
3166 "v=1",
3167 3,
3168 {Dictionary{{{"v", {Integer(1), {}}}}}},
3169 nullptr},
3170 {"0x77 as a single-character dictionary key",
3171 "w=1",
3172 3,
3173 {Dictionary{{{"w", {Integer(1), {}}}}}},
3174 nullptr},
3175 {"0x78 as a single-character dictionary key",
3176 "x=1",
3177 3,
3178 {Dictionary{{{"x", {Integer(1), {}}}}}},
3179 nullptr},
3180 {"0x79 as a single-character dictionary key",
3181 "y=1",
3182 3,
3183 {Dictionary{{{"y", {Integer(1), {}}}}}},
3184 nullptr},
3185 {"0x7a as a single-character dictionary key",
3186 "z=1",
3187 3,
3188 {Dictionary{{{"z", {Integer(1), {}}}}}},
3189 nullptr},
3190 {"0x7b as a single-character dictionary key", "{=1", 3, std::nullopt,
3191 nullptr},
3192 {"0x7c as a single-character dictionary key", "|=1", 3, std::nullopt,
3193 nullptr},
3194 {"0x7d as a single-character dictionary key", "}=1", 3, std::nullopt,
3195 nullptr},
3196 {"0x7e as a single-character dictionary key", "~=1", 3, std::nullopt,
3197 nullptr},
3198 {"0x7f as a single-character dictionary key", "\177=1", 3, std::nullopt,
3199 nullptr},
3200 {"0x00 in dictionary key", "a\000a=1", 5, std::nullopt, nullptr},
3201 {"0x01 in dictionary key", "a\001a=1", 5, std::nullopt, nullptr},
3202 {"0x02 in dictionary key", "a\002a=1", 5, std::nullopt, nullptr},
3203 {"0x03 in dictionary key", "a\003a=1", 5, std::nullopt, nullptr},
3204 {"0x04 in dictionary key", "a\004a=1", 5, std::nullopt, nullptr},
3205 {"0x05 in dictionary key", "a\005a=1", 5, std::nullopt, nullptr},
3206 {"0x06 in dictionary key", "a\006a=1", 5, std::nullopt, nullptr},
3207 {"0x07 in dictionary key", "a\aa=1", 5, std::nullopt, nullptr},
3208 {"0x08 in dictionary key", "a\ba=1", 5, std::nullopt, nullptr},
3209 {"0x09 in dictionary key", "a\ta=1", 5, std::nullopt, nullptr},
3210 {"0x0a in dictionary key", "a\na=1", 5, std::nullopt, nullptr},
3211 {"0x0b in dictionary key", "a\va=1", 5, std::nullopt, nullptr},
3212 {"0x0c in dictionary key", "a\fa=1", 5, std::nullopt, nullptr},
3213 {"0x0d in dictionary key", "a\ra=1", 5, std::nullopt, nullptr},
3214 {"0x0e in dictionary key", "a\016a=1", 5, std::nullopt, nullptr},
3215 {"0x0f in dictionary key", "a\017a=1", 5, std::nullopt, nullptr},
3216 {"0x10 in dictionary key", "a\020a=1", 5, std::nullopt, nullptr},
3217 {"0x11 in dictionary key", "a\021a=1", 5, std::nullopt, nullptr},
3218 {"0x12 in dictionary key", "a\022a=1", 5, std::nullopt, nullptr},
3219 {"0x13 in dictionary key", "a\023a=1", 5, std::nullopt, nullptr},
3220 {"0x14 in dictionary key", "a\024a=1", 5, std::nullopt, nullptr},
3221 {"0x15 in dictionary key", "a\025a=1", 5, std::nullopt, nullptr},
3222 {"0x16 in dictionary key", "a\026a=1", 5, std::nullopt, nullptr},
3223 {"0x17 in dictionary key", "a\027a=1", 5, std::nullopt, nullptr},
3224 {"0x18 in dictionary key", "a\030a=1", 5, std::nullopt, nullptr},
3225 {"0x19 in dictionary key", "a\031a=1", 5, std::nullopt, nullptr},
3226 {"0x1a in dictionary key", "a\032a=1", 5, std::nullopt, nullptr},
3227 {"0x1b in dictionary key", "a\033a=1", 5, std::nullopt, nullptr},
3228 {"0x1c in dictionary key", "a\034a=1", 5, std::nullopt, nullptr},
3229 {"0x1d in dictionary key", "a\035a=1", 5, std::nullopt, nullptr},
3230 {"0x1e in dictionary key", "a\036a=1", 5, std::nullopt, nullptr},
3231 {"0x1f in dictionary key", "a\037a=1", 5, std::nullopt, nullptr},
3232 {"0x20 in dictionary key", "a a=1", 5, std::nullopt, nullptr},
3233 {"0x21 in dictionary key", "a!a=1", 5, std::nullopt, nullptr},
3234 {"0x22 in dictionary key", "a\"a=1", 5, std::nullopt, nullptr},
3235 {"0x23 in dictionary key", "a#a=1", 5, std::nullopt, nullptr},
3236 {"0x24 in dictionary key", "a$a=1", 5, std::nullopt, nullptr},
3237 {"0x25 in dictionary key", "a%a=1", 5, std::nullopt, nullptr},
3238 {"0x26 in dictionary key", "a&a=1", 5, std::nullopt, nullptr},
3239 {"0x27 in dictionary key", "a'a=1", 5, std::nullopt, nullptr},
3240 {"0x28 in dictionary key", "a(a=1", 5, std::nullopt, nullptr},
3241 {"0x29 in dictionary key", "a)a=1", 5, std::nullopt, nullptr},
3242 {"0x2a in dictionary key",
3243 "a*a=1",
3244 5,
3245 {Dictionary{{{"a*a", {Integer(1), {}}}}}},
3246 nullptr},
3247 {"0x2b in dictionary key", "a+a=1", 5, std::nullopt, nullptr},
3248 {"0x2c in dictionary key",
3249 "a,a=1",
3250 5,
3251 {Dictionary{{{"a", {Integer(1), {}}}}}},
3252 "a=1"},
3253 {"0x2d in dictionary key",
3254 "a-a=1",
3255 5,
3256 {Dictionary{{{"a-a", {Integer(1), {}}}}}},
3257 nullptr},
3258 {"0x2e in dictionary key",
3259 "a.a=1",
3260 5,
3261 {Dictionary{{{"a.a", {Integer(1), {}}}}}},
3262 nullptr},
3263 {"0x2f in dictionary key", "a/a=1", 5, std::nullopt, nullptr},
3264 {"0x30 in dictionary key",
3265 "a0a=1",
3266 5,
3267 {Dictionary{{{"a0a", {Integer(1), {}}}}}},
3268 nullptr},
3269 {"0x31 in dictionary key",
3270 "a1a=1",
3271 5,
3272 {Dictionary{{{"a1a", {Integer(1), {}}}}}},
3273 nullptr},
3274 {"0x32 in dictionary key",
3275 "a2a=1",
3276 5,
3277 {Dictionary{{{"a2a", {Integer(1), {}}}}}},
3278 nullptr},
3279 {"0x33 in dictionary key",
3280 "a3a=1",
3281 5,
3282 {Dictionary{{{"a3a", {Integer(1), {}}}}}},
3283 nullptr},
3284 {"0x34 in dictionary key",
3285 "a4a=1",
3286 5,
3287 {Dictionary{{{"a4a", {Integer(1), {}}}}}},
3288 nullptr},
3289 {"0x35 in dictionary key",
3290 "a5a=1",
3291 5,
3292 {Dictionary{{{"a5a", {Integer(1), {}}}}}},
3293 nullptr},
3294 {"0x36 in dictionary key",
3295 "a6a=1",
3296 5,
3297 {Dictionary{{{"a6a", {Integer(1), {}}}}}},
3298 nullptr},
3299 {"0x37 in dictionary key",
3300 "a7a=1",
3301 5,
3302 {Dictionary{{{"a7a", {Integer(1), {}}}}}},
3303 nullptr},
3304 {"0x38 in dictionary key",
3305 "a8a=1",
3306 5,
3307 {Dictionary{{{"a8a", {Integer(1), {}}}}}},
3308 nullptr},
3309 {"0x39 in dictionary key",
3310 "a9a=1",
3311 5,
3312 {Dictionary{{{"a9a", {Integer(1), {}}}}}},
3313 nullptr},
3314 {"0x3a in dictionary key", "a:a=1", 5, std::nullopt, nullptr},
3315 {"0x3b in dictionary key",
3316 "a;a=1",
3317 5,
3318 {Dictionary{{{"a", {Item(true), {Param("a", 1)}}}}}},
3319 nullptr},
3320 {"0x3c in dictionary key", "a<a=1", 5, std::nullopt, nullptr},
3321 {"0x3d in dictionary key", "a=a=1", 5, std::nullopt, nullptr},
3322 {"0x3e in dictionary key", "a>a=1", 5, std::nullopt, nullptr},
3323 {"0x3f in dictionary key", "a?a=1", 5, std::nullopt, nullptr},
3324 {"0x40 in dictionary key", "a@a=1", 5, std::nullopt, nullptr},
3325 {"0x41 in dictionary key", "aAa=1", 5, std::nullopt, nullptr},
3326 {"0x42 in dictionary key", "aBa=1", 5, std::nullopt, nullptr},
3327 {"0x43 in dictionary key", "aCa=1", 5, std::nullopt, nullptr},
3328 {"0x44 in dictionary key", "aDa=1", 5, std::nullopt, nullptr},
3329 {"0x45 in dictionary key", "aEa=1", 5, std::nullopt, nullptr},
3330 {"0x46 in dictionary key", "aFa=1", 5, std::nullopt, nullptr},
3331 {"0x47 in dictionary key", "aGa=1", 5, std::nullopt, nullptr},
3332 {"0x48 in dictionary key", "aHa=1", 5, std::nullopt, nullptr},
3333 {"0x49 in dictionary key", "aIa=1", 5, std::nullopt, nullptr},
3334 {"0x4a in dictionary key", "aJa=1", 5, std::nullopt, nullptr},
3335 {"0x4b in dictionary key", "aKa=1", 5, std::nullopt, nullptr},
3336 {"0x4c in dictionary key", "aLa=1", 5, std::nullopt, nullptr},
3337 {"0x4d in dictionary key", "aMa=1", 5, std::nullopt, nullptr},
3338 {"0x4e in dictionary key", "aNa=1", 5, std::nullopt, nullptr},
3339 {"0x4f in dictionary key", "aOa=1", 5, std::nullopt, nullptr},
3340 {"0x50 in dictionary key", "aPa=1", 5, std::nullopt, nullptr},
3341 {"0x51 in dictionary key", "aQa=1", 5, std::nullopt, nullptr},
3342 {"0x52 in dictionary key", "aRa=1", 5, std::nullopt, nullptr},
3343 {"0x53 in dictionary key", "aSa=1", 5, std::nullopt, nullptr},
3344 {"0x54 in dictionary key", "aTa=1", 5, std::nullopt, nullptr},
3345 {"0x55 in dictionary key", "aUa=1", 5, std::nullopt, nullptr},
3346 {"0x56 in dictionary key", "aVa=1", 5, std::nullopt, nullptr},
3347 {"0x57 in dictionary key", "aWa=1", 5, std::nullopt, nullptr},
3348 {"0x58 in dictionary key", "aXa=1", 5, std::nullopt, nullptr},
3349 {"0x59 in dictionary key", "aYa=1", 5, std::nullopt, nullptr},
3350 {"0x5a in dictionary key", "aZa=1", 5, std::nullopt, nullptr},
3351 {"0x5b in dictionary key", "a[a=1", 5, std::nullopt, nullptr},
3352 {"0x5c in dictionary key", "a\\a=1", 5, std::nullopt, nullptr},
3353 {"0x5d in dictionary key", "a]a=1", 5, std::nullopt, nullptr},
3354 {"0x5e in dictionary key", "a^a=1", 5, std::nullopt, nullptr},
3355 {"0x5f in dictionary key",
3356 "a_a=1",
3357 5,
3358 {Dictionary{{{"a_a", {Integer(1), {}}}}}},
3359 nullptr},
3360 {"0x60 in dictionary key", "a`a=1", 5, std::nullopt, nullptr},
3361 {"0x61 in dictionary key",
3362 "aaa=1",
3363 5,
3364 {Dictionary{{{"aaa", {Integer(1), {}}}}}},
3365 nullptr},
3366 {"0x62 in dictionary key",
3367 "aba=1",
3368 5,
3369 {Dictionary{{{"aba", {Integer(1), {}}}}}},
3370 nullptr},
3371 {"0x63 in dictionary key",
3372 "aca=1",
3373 5,
3374 {Dictionary{{{"aca", {Integer(1), {}}}}}},
3375 nullptr},
3376 {"0x64 in dictionary key",
3377 "ada=1",
3378 5,
3379 {Dictionary{{{"ada", {Integer(1), {}}}}}},
3380 nullptr},
3381 {"0x65 in dictionary key",
3382 "aea=1",
3383 5,
3384 {Dictionary{{{"aea", {Integer(1), {}}}}}},
3385 nullptr},
3386 {"0x66 in dictionary key",
3387 "afa=1",
3388 5,
3389 {Dictionary{{{"afa", {Integer(1), {}}}}}},
3390 nullptr},
3391 {"0x67 in dictionary key",
3392 "aga=1",
3393 5,
3394 {Dictionary{{{"aga", {Integer(1), {}}}}}},
3395 nullptr},
3396 {"0x68 in dictionary key",
3397 "aha=1",
3398 5,
3399 {Dictionary{{{"aha", {Integer(1), {}}}}}},
3400 nullptr},
3401 {"0x69 in dictionary key",
3402 "aia=1",
3403 5,
3404 {Dictionary{{{"aia", {Integer(1), {}}}}}},
3405 nullptr},
3406 {"0x6a in dictionary key",
3407 "aja=1",
3408 5,
3409 {Dictionary{{{"aja", {Integer(1), {}}}}}},
3410 nullptr},
3411 {"0x6b in dictionary key",
3412 "aka=1",
3413 5,
3414 {Dictionary{{{"aka", {Integer(1), {}}}}}},
3415 nullptr},
3416 {"0x6c in dictionary key",
3417 "ala=1",
3418 5,
3419 {Dictionary{{{"ala", {Integer(1), {}}}}}},
3420 nullptr},
3421 {"0x6d in dictionary key",
3422 "ama=1",
3423 5,
3424 {Dictionary{{{"ama", {Integer(1), {}}}}}},
3425 nullptr},
3426 {"0x6e in dictionary key",
3427 "ana=1",
3428 5,
3429 {Dictionary{{{"ana", {Integer(1), {}}}}}},
3430 nullptr},
3431 {"0x6f in dictionary key",
3432 "aoa=1",
3433 5,
3434 {Dictionary{{{"aoa", {Integer(1), {}}}}}},
3435 nullptr},
3436 {"0x70 in dictionary key",
3437 "apa=1",
3438 5,
3439 {Dictionary{{{"apa", {Integer(1), {}}}}}},
3440 nullptr},
3441 {"0x71 in dictionary key",
3442 "aqa=1",
3443 5,
3444 {Dictionary{{{"aqa", {Integer(1), {}}}}}},
3445 nullptr},
3446 {"0x72 in dictionary key",
3447 "ara=1",
3448 5,
3449 {Dictionary{{{"ara", {Integer(1), {}}}}}},
3450 nullptr},
3451 {"0x73 in dictionary key",
3452 "asa=1",
3453 5,
3454 {Dictionary{{{"asa", {Integer(1), {}}}}}},
3455 nullptr},
3456 {"0x74 in dictionary key",
3457 "ata=1",
3458 5,
3459 {Dictionary{{{"ata", {Integer(1), {}}}}}},
3460 nullptr},
3461 {"0x75 in dictionary key",
3462 "aua=1",
3463 5,
3464 {Dictionary{{{"aua", {Integer(1), {}}}}}},
3465 nullptr},
3466 {"0x76 in dictionary key",
3467 "ava=1",
3468 5,
3469 {Dictionary{{{"ava", {Integer(1), {}}}}}},
3470 nullptr},
3471 {"0x77 in dictionary key",
3472 "awa=1",
3473 5,
3474 {Dictionary{{{"awa", {Integer(1), {}}}}}},
3475 nullptr},
3476 {"0x78 in dictionary key",
3477 "axa=1",
3478 5,
3479 {Dictionary{{{"axa", {Integer(1), {}}}}}},
3480 nullptr},
3481 {"0x79 in dictionary key",
3482 "aya=1",
3483 5,
3484 {Dictionary{{{"aya", {Integer(1), {}}}}}},
3485 nullptr},
3486 {"0x7a in dictionary key",
3487 "aza=1",
3488 5,
3489 {Dictionary{{{"aza", {Integer(1), {}}}}}},
3490 nullptr},
3491 {"0x7b in dictionary key", "a{a=1", 5, std::nullopt, nullptr},
3492 {"0x7c in dictionary key", "a|a=1", 5, std::nullopt, nullptr},
3493 {"0x7d in dictionary key", "a}a=1", 5, std::nullopt, nullptr},
3494 {"0x7e in dictionary key", "a~a=1", 5, std::nullopt, nullptr},
3495 {"0x7f in dictionary key", "a\177a=1", 5, std::nullopt, nullptr},
3496 {"0x00 starting an dictionary key", "\000a=1", 4, std::nullopt, nullptr},
3497 {"0x01 starting an dictionary key", "\001a=1", 4, std::nullopt, nullptr},
3498 {"0x02 starting an dictionary key", "\002a=1", 4, std::nullopt, nullptr},
3499 {"0x03 starting an dictionary key", "\003a=1", 4, std::nullopt, nullptr},
3500 {"0x04 starting an dictionary key", "\004a=1", 4, std::nullopt, nullptr},
3501 {"0x05 starting an dictionary key", "\005a=1", 4, std::nullopt, nullptr},
3502 {"0x06 starting an dictionary key", "\006a=1", 4, std::nullopt, nullptr},
3503 {"0x07 starting an dictionary key", "\aa=1", 4, std::nullopt, nullptr},
3504 {"0x08 starting an dictionary key", "\ba=1", 4, std::nullopt, nullptr},
3505 {"0x09 starting an dictionary key", "\ta=1", 4, std::nullopt, nullptr},
3506 {"0x0a starting an dictionary key", "\na=1", 4, std::nullopt, nullptr},
3507 {"0x0b starting an dictionary key", "\va=1", 4, std::nullopt, nullptr},
3508 {"0x0c starting an dictionary key", "\fa=1", 4, std::nullopt, nullptr},
3509 {"0x0d starting an dictionary key", "\ra=1", 4, std::nullopt, nullptr},
3510 {"0x0e starting an dictionary key", "\016a=1", 4, std::nullopt, nullptr},
3511 {"0x0f starting an dictionary key", "\017a=1", 4, std::nullopt, nullptr},
3512 {"0x10 starting an dictionary key", "\020a=1", 4, std::nullopt, nullptr},
3513 {"0x11 starting an dictionary key", "\021a=1", 4, std::nullopt, nullptr},
3514 {"0x12 starting an dictionary key", "\022a=1", 4, std::nullopt, nullptr},
3515 {"0x13 starting an dictionary key", "\023a=1", 4, std::nullopt, nullptr},
3516 {"0x14 starting an dictionary key", "\024a=1", 4, std::nullopt, nullptr},
3517 {"0x15 starting an dictionary key", "\025a=1", 4, std::nullopt, nullptr},
3518 {"0x16 starting an dictionary key", "\026a=1", 4, std::nullopt, nullptr},
3519 {"0x17 starting an dictionary key", "\027a=1", 4, std::nullopt, nullptr},
3520 {"0x18 starting an dictionary key", "\030a=1", 4, std::nullopt, nullptr},
3521 {"0x19 starting an dictionary key", "\031a=1", 4, std::nullopt, nullptr},
3522 {"0x1a starting an dictionary key", "\032a=1", 4, std::nullopt, nullptr},
3523 {"0x1b starting an dictionary key", "\033a=1", 4, std::nullopt, nullptr},
3524 {"0x1c starting an dictionary key", "\034a=1", 4, std::nullopt, nullptr},
3525 {"0x1d starting an dictionary key", "\035a=1", 4, std::nullopt, nullptr},
3526 {"0x1e starting an dictionary key", "\036a=1", 4, std::nullopt, nullptr},
3527 {"0x1f starting an dictionary key", "\037a=1", 4, std::nullopt, nullptr},
3528 {"0x20 starting an dictionary key",
3529 " a=1",
3530 4,
3531 {Dictionary{{{"a", {Integer(1), {}}}}}},
3532 "a=1"},
3533 {"0x21 starting an dictionary key", "!a=1", 4, std::nullopt, nullptr},
3534 {"0x22 starting an dictionary key", "\"a=1", 4, std::nullopt, nullptr},
3535 {"0x23 starting an dictionary key", "#a=1", 4, std::nullopt, nullptr},
3536 {"0x24 starting an dictionary key", "$a=1", 4, std::nullopt, nullptr},
3537 {"0x25 starting an dictionary key", "%a=1", 4, std::nullopt, nullptr},
3538 {"0x26 starting an dictionary key", "&a=1", 4, std::nullopt, nullptr},
3539 {"0x27 starting an dictionary key", "'a=1", 4, std::nullopt, nullptr},
3540 {"0x28 starting an dictionary key", "(a=1", 4, std::nullopt, nullptr},
3541 {"0x29 starting an dictionary key", ")a=1", 4, std::nullopt, nullptr},
3542 {"0x2a starting an dictionary key",
3543 "*a=1",
3544 4,
3545 {Dictionary{{{"*a", {Integer(1), {}}}}}},
3546 nullptr},
3547 {"0x2b starting an dictionary key", "+a=1", 4, std::nullopt, nullptr},
3548 {"0x2c starting an dictionary key", ",a=1", 4, std::nullopt, nullptr},
3549 {"0x2d starting an dictionary key", "-a=1", 4, std::nullopt, nullptr},
3550 {"0x2e starting an dictionary key", ".a=1", 4, std::nullopt, nullptr},
3551 {"0x2f starting an dictionary key", "/a=1", 4, std::nullopt, nullptr},
3552 {"0x30 starting an dictionary key", "0a=1", 4, std::nullopt, nullptr},
3553 {"0x31 starting an dictionary key", "1a=1", 4, std::nullopt, nullptr},
3554 {"0x32 starting an dictionary key", "2a=1", 4, std::nullopt, nullptr},
3555 {"0x33 starting an dictionary key", "3a=1", 4, std::nullopt, nullptr},
3556 {"0x34 starting an dictionary key", "4a=1", 4, std::nullopt, nullptr},
3557 {"0x35 starting an dictionary key", "5a=1", 4, std::nullopt, nullptr},
3558 {"0x36 starting an dictionary key", "6a=1", 4, std::nullopt, nullptr},
3559 {"0x37 starting an dictionary key", "7a=1", 4, std::nullopt, nullptr},
3560 {"0x38 starting an dictionary key", "8a=1", 4, std::nullopt, nullptr},
3561 {"0x39 starting an dictionary key", "9a=1", 4, std::nullopt, nullptr},
3562 {"0x3a starting an dictionary key", ":a=1", 4, std::nullopt, nullptr},
3563 {"0x3b starting an dictionary key", ";a=1", 4, std::nullopt, nullptr},
3564 {"0x3c starting an dictionary key", "<a=1", 4, std::nullopt, nullptr},
3565 {"0x3d starting an dictionary key", "=a=1", 4, std::nullopt, nullptr},
3566 {"0x3e starting an dictionary key", ">a=1", 4, std::nullopt, nullptr},
3567 {"0x3f starting an dictionary key", "?a=1", 4, std::nullopt, nullptr},
3568 {"0x40 starting an dictionary key", "@a=1", 4, std::nullopt, nullptr},
3569 {"0x41 starting an dictionary key", "Aa=1", 4, std::nullopt, nullptr},
3570 {"0x42 starting an dictionary key", "Ba=1", 4, std::nullopt, nullptr},
3571 {"0x43 starting an dictionary key", "Ca=1", 4, std::nullopt, nullptr},
3572 {"0x44 starting an dictionary key", "Da=1", 4, std::nullopt, nullptr},
3573 {"0x45 starting an dictionary key", "Ea=1", 4, std::nullopt, nullptr},
3574 {"0x46 starting an dictionary key", "Fa=1", 4, std::nullopt, nullptr},
3575 {"0x47 starting an dictionary key", "Ga=1", 4, std::nullopt, nullptr},
3576 {"0x48 starting an dictionary key", "Ha=1", 4, std::nullopt, nullptr},
3577 {"0x49 starting an dictionary key", "Ia=1", 4, std::nullopt, nullptr},
3578 {"0x4a starting an dictionary key", "Ja=1", 4, std::nullopt, nullptr},
3579 {"0x4b starting an dictionary key", "Ka=1", 4, std::nullopt, nullptr},
3580 {"0x4c starting an dictionary key", "La=1", 4, std::nullopt, nullptr},
3581 {"0x4d starting an dictionary key", "Ma=1", 4, std::nullopt, nullptr},
3582 {"0x4e starting an dictionary key", "Na=1", 4, std::nullopt, nullptr},
3583 {"0x4f starting an dictionary key", "Oa=1", 4, std::nullopt, nullptr},
3584 {"0x50 starting an dictionary key", "Pa=1", 4, std::nullopt, nullptr},
3585 {"0x51 starting an dictionary key", "Qa=1", 4, std::nullopt, nullptr},
3586 {"0x52 starting an dictionary key", "Ra=1", 4, std::nullopt, nullptr},
3587 {"0x53 starting an dictionary key", "Sa=1", 4, std::nullopt, nullptr},
3588 {"0x54 starting an dictionary key", "Ta=1", 4, std::nullopt, nullptr},
3589 {"0x55 starting an dictionary key", "Ua=1", 4, std::nullopt, nullptr},
3590 {"0x56 starting an dictionary key", "Va=1", 4, std::nullopt, nullptr},
3591 {"0x57 starting an dictionary key", "Wa=1", 4, std::nullopt, nullptr},
3592 {"0x58 starting an dictionary key", "Xa=1", 4, std::nullopt, nullptr},
3593 {"0x59 starting an dictionary key", "Ya=1", 4, std::nullopt, nullptr},
3594 {"0x5a starting an dictionary key", "Za=1", 4, std::nullopt, nullptr},
3595 {"0x5b starting an dictionary key", "[a=1", 4, std::nullopt, nullptr},
3596 {"0x5c starting an dictionary key", "\\a=1", 4, std::nullopt, nullptr},
3597 {"0x5d starting an dictionary key", "]a=1", 4, std::nullopt, nullptr},
3598 {"0x5e starting an dictionary key", "^a=1", 4, std::nullopt, nullptr},
3599 {"0x5f starting an dictionary key", "_a=1", 4, std::nullopt, nullptr},
3600 {"0x60 starting an dictionary key", "`a=1", 4, std::nullopt, nullptr},
3601 {"0x61 starting an dictionary key",
3602 "aa=1",
3603 4,
3604 {Dictionary{{{"aa", {Integer(1), {}}}}}},
3605 nullptr},
3606 {"0x62 starting an dictionary key",
3607 "ba=1",
3608 4,
3609 {Dictionary{{{"ba", {Integer(1), {}}}}}},
3610 nullptr},
3611 {"0x63 starting an dictionary key",
3612 "ca=1",
3613 4,
3614 {Dictionary{{{"ca", {Integer(1), {}}}}}},
3615 nullptr},
3616 {"0x64 starting an dictionary key",
3617 "da=1",
3618 4,
3619 {Dictionary{{{"da", {Integer(1), {}}}}}},
3620 nullptr},
3621 {"0x65 starting an dictionary key",
3622 "ea=1",
3623 4,
3624 {Dictionary{{{"ea", {Integer(1), {}}}}}},
3625 nullptr},
3626 {"0x66 starting an dictionary key",
3627 "fa=1",
3628 4,
3629 {Dictionary{{{"fa", {Integer(1), {}}}}}},
3630 nullptr},
3631 {"0x67 starting an dictionary key",
3632 "ga=1",
3633 4,
3634 {Dictionary{{{"ga", {Integer(1), {}}}}}},
3635 nullptr},
3636 {"0x68 starting an dictionary key",
3637 "ha=1",
3638 4,
3639 {Dictionary{{{"ha", {Integer(1), {}}}}}},
3640 nullptr},
3641 {"0x69 starting an dictionary key",
3642 "ia=1",
3643 4,
3644 {Dictionary{{{"ia", {Integer(1), {}}}}}},
3645 nullptr},
3646 {"0x6a starting an dictionary key",
3647 "ja=1",
3648 4,
3649 {Dictionary{{{"ja", {Integer(1), {}}}}}},
3650 nullptr},
3651 {"0x6b starting an dictionary key",
3652 "ka=1",
3653 4,
3654 {Dictionary{{{"ka", {Integer(1), {}}}}}},
3655 nullptr},
3656 {"0x6c starting an dictionary key",
3657 "la=1",
3658 4,
3659 {Dictionary{{{"la", {Integer(1), {}}}}}},
3660 nullptr},
3661 {"0x6d starting an dictionary key",
3662 "ma=1",
3663 4,
3664 {Dictionary{{{"ma", {Integer(1), {}}}}}},
3665 nullptr},
3666 {"0x6e starting an dictionary key",
3667 "na=1",
3668 4,
3669 {Dictionary{{{"na", {Integer(1), {}}}}}},
3670 nullptr},
3671 {"0x6f starting an dictionary key",
3672 "oa=1",
3673 4,
3674 {Dictionary{{{"oa", {Integer(1), {}}}}}},
3675 nullptr},
3676 {"0x70 starting an dictionary key",
3677 "pa=1",
3678 4,
3679 {Dictionary{{{"pa", {Integer(1), {}}}}}},
3680 nullptr},
3681 {"0x71 starting an dictionary key",
3682 "qa=1",
3683 4,
3684 {Dictionary{{{"qa", {Integer(1), {}}}}}},
3685 nullptr},
3686 {"0x72 starting an dictionary key",
3687 "ra=1",
3688 4,
3689 {Dictionary{{{"ra", {Integer(1), {}}}}}},
3690 nullptr},
3691 {"0x73 starting an dictionary key",
3692 "sa=1",
3693 4,
3694 {Dictionary{{{"sa", {Integer(1), {}}}}}},
3695 nullptr},
3696 {"0x74 starting an dictionary key",
3697 "ta=1",
3698 4,
3699 {Dictionary{{{"ta", {Integer(1), {}}}}}},
3700 nullptr},
3701 {"0x75 starting an dictionary key",
3702 "ua=1",
3703 4,
3704 {Dictionary{{{"ua", {Integer(1), {}}}}}},
3705 nullptr},
3706 {"0x76 starting an dictionary key",
3707 "va=1",
3708 4,
3709 {Dictionary{{{"va", {Integer(1), {}}}}}},
3710 nullptr},
3711 {"0x77 starting an dictionary key",
3712 "wa=1",
3713 4,
3714 {Dictionary{{{"wa", {Integer(1), {}}}}}},
3715 nullptr},
3716 {"0x78 starting an dictionary key",
3717 "xa=1",
3718 4,
3719 {Dictionary{{{"xa", {Integer(1), {}}}}}},
3720 nullptr},
3721 {"0x79 starting an dictionary key",
3722 "ya=1",
3723 4,
3724 {Dictionary{{{"ya", {Integer(1), {}}}}}},
3725 nullptr},
3726 {"0x7a starting an dictionary key",
3727 "za=1",
3728 4,
3729 {Dictionary{{{"za", {Integer(1), {}}}}}},
3730 nullptr},
3731 {"0x7b starting an dictionary key", "{a=1", 4, std::nullopt, nullptr},
3732 {"0x7c starting an dictionary key", "|a=1", 4, std::nullopt, nullptr},
3733 {"0x7d starting an dictionary key", "}a=1", 4, std::nullopt, nullptr},
3734 {"0x7e starting an dictionary key", "~a=1", 4, std::nullopt, nullptr},
3735 {"0x7f starting an dictionary key", "\177a=1", 4, std::nullopt, nullptr},
3736 // param-dict.json
3737 {"basic parameterised dict",
3738 "abc=123;a=1;b=2, def=456, ghi=789;q=9;r=\"+w\"",
3739 44,
3740 {Dictionary{{{"abc", {Integer(123), {Param("a", 1), Param("b", 2)}}},
3741 {"def", {Integer(456), {}}},
3742 {"ghi", {Integer(789), {Param("q", 9), Param("r", "+w")}}}}}},
3743 nullptr},
3744 {"single item parameterised dict",
3745 "a=b; q=1.0",
3746 10,
3747 {Dictionary{
3748 {{"a", {Item("b", Item::kTokenType), {DoubleParam("q", 1.000000)}}}}}},
3749 "a=b;q=1.0"},
3750 {"list item parameterised dictionary",
3751 "a=(1 2); q=1.0",
3752 14,
3753 {Dictionary{{{"a",
3754 {{{Integer(1), {}}, {Integer(2), {}}},
3755 {DoubleParam("q", 1.000000)}}}}}},
3756 "a=(1 2);q=1.0"},
3757 {"missing parameter value parameterised dict",
3758 "a=3;c;d=5",
3759 9,
3760 {Dictionary{
3761 {{"a", {Integer(3), {BooleanParam("c", true), Param("d", 5)}}}}}},
3762 nullptr},
3763 {"terminal missing parameter value parameterised dict",
3764 "a=3;c=5;d",
3765 9,
3766 {Dictionary{
3767 {{"a", {Integer(3), {Param("c", 5), BooleanParam("d", true)}}}}}},
3768 nullptr},
3769 {"no whitespace parameterised dict",
3770 "a=b;c=1,d=e;f=2",
3771 15,
3772 {Dictionary{{{"a", {Item("b", Item::kTokenType), {Param("c", 1)}}},
3773 {"d", {Item("e", Item::kTokenType), {Param("f", 2)}}}}}},
3774 "a=b;c=1, d=e;f=2"},
3775 {"whitespace before = parameterised dict", "a=b;q =0.5", 10, std::nullopt,
3776 nullptr},
3777 {"whitespace after = parameterised dict", "a=b;q= 0.5", 10, std::nullopt,
3778 nullptr},
3779 {"whitespace before ; parameterised dict", "a=b ;q=0.5", 10, std::nullopt,
3780 nullptr},
3781 {"whitespace after ; parameterised dict",
3782 "a=b; q=0.5",
3783 10,
3784 {Dictionary{
3785 {{"a", {Item("b", Item::kTokenType), {DoubleParam("q", 0.500000)}}}}}},
3786 "a=b;q=0.5"},
3787 {"extra whitespace parameterised dict",
3788 "a=b; c=1 , d=e; f=2; g=3",
3789 27,
3790 {Dictionary{
3791 {{"a", {Item("b", Item::kTokenType), {Param("c", 1)}}},
3792 {"d",
3793 {Item("e", Item::kTokenType), {Param("f", 2), Param("g", 3)}}}}}},
3794 "a=b;c=1, d=e;f=2;g=3"},
3795 {"two lines parameterised list",
3796 "a=b;c=1, d=e;f=2",
3797 16,
3798 {Dictionary{{{"a", {Item("b", Item::kTokenType), {Param("c", 1)}}},
3799 {"d", {Item("e", Item::kTokenType), {Param("f", 2)}}}}}},
3800 "a=b;c=1, d=e;f=2"},
3801 {"trailing comma parameterised list", "a=b; q=1.0,", 11, std::nullopt,
3802 nullptr},
3803 {"empty item parameterised list", "a=b; q=1.0,,c=d", 15, std::nullopt,
3804 nullptr},
3805 };
3806
3807 } // namespace
3808
TEST(StructuredHeaderGeneratedTest,ParseItem)3809 TEST(StructuredHeaderGeneratedTest, ParseItem) {
3810 for (const auto& c : parameterized_item_test_cases) {
3811 if (c.raw) {
3812 SCOPED_TRACE(c.name);
3813 std::string raw{c.raw, c.raw_len};
3814 std::optional<ParameterizedItem> result = ParseItem(raw);
3815 EXPECT_EQ(result, c.expected);
3816 }
3817 }
3818 }
3819
TEST(StructuredHeaderGeneratedTest,ParseList)3820 TEST(StructuredHeaderGeneratedTest, ParseList) {
3821 for (const auto& c : list_test_cases) {
3822 if (c.raw) {
3823 SCOPED_TRACE(c.name);
3824 std::string raw{c.raw, c.raw_len};
3825 std::optional<List> result = ParseList(raw);
3826 EXPECT_EQ(result, c.expected);
3827 }
3828 }
3829 }
3830
TEST(StructuredHeaderGeneratedTest,ParseDictionary)3831 TEST(StructuredHeaderGeneratedTest, ParseDictionary) {
3832 for (const auto& c : dictionary_test_cases) {
3833 if (c.raw) {
3834 SCOPED_TRACE(c.name);
3835 std::string raw{c.raw, c.raw_len};
3836 std::optional<Dictionary> result = ParseDictionary(raw);
3837 EXPECT_EQ(result, c.expected);
3838 }
3839 }
3840 }
3841
TEST(StructuredHeaderGeneratedTest,SerializeItem)3842 TEST(StructuredHeaderGeneratedTest, SerializeItem) {
3843 for (const auto& c : parameterized_item_test_cases) {
3844 SCOPED_TRACE(c.name);
3845 if (c.expected) {
3846 std::optional<std::string> result = SerializeItem(*c.expected);
3847 if (c.raw || c.canonical) {
3848 EXPECT_TRUE(result.has_value());
3849 EXPECT_EQ(result.value(),
3850 std::string(c.canonical ? c.canonical : c.raw));
3851 } else {
3852 EXPECT_FALSE(result.has_value());
3853 }
3854 }
3855 }
3856 }
3857
TEST(StructuredHeaderGeneratedTest,SerializeList)3858 TEST(StructuredHeaderGeneratedTest, SerializeList) {
3859 for (const auto& c : list_test_cases) {
3860 SCOPED_TRACE(c.name);
3861 if (c.expected) {
3862 std::optional<std::string> result = SerializeList(*c.expected);
3863 if (c.raw || c.canonical) {
3864 EXPECT_TRUE(result.has_value());
3865 EXPECT_EQ(result.value(),
3866 std::string(c.canonical ? c.canonical : c.raw));
3867 } else {
3868 EXPECT_FALSE(result.has_value());
3869 }
3870 }
3871 }
3872 }
3873
TEST(StructuredHeaderGeneratedTest,SerializeDictionary)3874 TEST(StructuredHeaderGeneratedTest, SerializeDictionary) {
3875 for (const auto& c : dictionary_test_cases) {
3876 SCOPED_TRACE(c.name);
3877 if (c.expected) {
3878 std::optional<std::string> result = SerializeDictionary(*c.expected);
3879 if (c.raw || c.canonical) {
3880 EXPECT_TRUE(result.has_value());
3881 EXPECT_EQ(result.value(),
3882 std::string(c.canonical ? c.canonical : c.raw));
3883 } else {
3884 EXPECT_FALSE(result.has_value());
3885 }
3886 }
3887 }
3888 }
3889
3890 } // namespace structured_headers
3891 } // namespace quiche
3892