Import serialization-only structured headers tests https://github.com/httpwg/structured-field-tests#structured-field-tests PiperOrigin-RevId: 943223257
diff --git a/quiche/common/structured_headers_generated_test.cc b/quiche/common/structured_headers_generated_test.cc index 8d55fd9..a6263e6 100644 --- a/quiche/common/structured_headers_generated_test.cc +++ b/quiche/common/structured_headers_generated_test.cc
@@ -17,7 +17,7 @@ // being automatically translated from the JSON source to C++ unit tests. Please // do not modify, as the contents will be overwritten when this is re-generated. -// Generated on 2026-06-18 from structured-field-tests.git @ +// Generated on 2026-06-26 from structured-field-tests.git @ // 1e280c3ed9ffe0ca5fdb1d97219dddc389007677. namespace quiche { @@ -7734,6 +7734,1403 @@ nullptr}, }; +const struct SerializationOnlyItemTestCase { + const char* name; + const ParameterizedItem expected; + const std::optional<std::string> canonical; +} serialization_only_item_test_cases[] = { + // serialisation-tests/number.json + {"too big positive integer - serialize", + {Integer(1000000000000000), {}}, + std::nullopt}, + {"too big negative integer - serialize", + {Integer(-1000000000000000), {}}, + std::nullopt}, + {"too big positive decimal - serialize", + {Item(1000000000000.1), {}}, + std::nullopt}, + {"too big negative decimal - serialize", + {Item(-1000000000000.1), {}}, + std::nullopt}, + {"round positive odd decimal - serialize", {Item(0.0015), {}}, "0.002"}, + {"round positive even decimal - serialize", {Item(0.0025), {}}, "0.002"}, + {"round negative odd decimal - serialize", {Item(-0.0015), {}}, "-0.002"}, + {"round negative even decimal - serialize", {Item(-0.0025), {}}, "-0.002"}, + {"decimal round up to integer part - serialize", + {Item(9.9995), {}}, + "10.0"}, + // serialisation-tests/string-generated.json + {"0x00 in string - serialise only", + {Item(std::string("\000", 1)), {}}, + std::nullopt}, + {"0x01 in string - serialise only", {Item("\001"), {}}, std::nullopt}, + {"0x02 in string - serialise only", {Item("\002"), {}}, std::nullopt}, + {"0x03 in string - serialise only", {Item("\003"), {}}, std::nullopt}, + {"0x04 in string - serialise only", {Item("\004"), {}}, std::nullopt}, + {"0x05 in string - serialise only", {Item("\005"), {}}, std::nullopt}, + {"0x06 in string - serialise only", {Item("\006"), {}}, std::nullopt}, + {"0x07 in string - serialise only", {Item("\007"), {}}, std::nullopt}, + {"0x08 in string - serialise only", {Item("\010"), {}}, std::nullopt}, + {"0x09 in string - serialise only", {Item("\t"), {}}, std::nullopt}, + {"0x0a in string - serialise only", {Item("\n"), {}}, std::nullopt}, + {"0x0b in string - serialise only", {Item("\013"), {}}, std::nullopt}, + {"0x0c in string - serialise only", {Item("\014"), {}}, std::nullopt}, + {"0x0d in string - serialise only", {Item("\r"), {}}, std::nullopt}, + {"0x0e in string - serialise only", {Item("\016"), {}}, std::nullopt}, + {"0x0f in string - serialise only", {Item("\017"), {}}, std::nullopt}, + {"0x10 in string - serialise only", {Item("\020"), {}}, std::nullopt}, + {"0x11 in string - serialise only", {Item("\021"), {}}, std::nullopt}, + {"0x12 in string - serialise only", {Item("\022"), {}}, std::nullopt}, + {"0x13 in string - serialise only", {Item("\023"), {}}, std::nullopt}, + {"0x14 in string - serialise only", {Item("\024"), {}}, std::nullopt}, + {"0x15 in string - serialise only", {Item("\025"), {}}, std::nullopt}, + {"0x16 in string - serialise only", {Item("\026"), {}}, std::nullopt}, + {"0x17 in string - serialise only", {Item("\027"), {}}, std::nullopt}, + {"0x18 in string - serialise only", {Item("\030"), {}}, std::nullopt}, + {"0x19 in string - serialise only", {Item("\031"), {}}, std::nullopt}, + {"0x1a in string - serialise only", {Item("\032"), {}}, std::nullopt}, + {"0x1b in string - serialise only", {Item("\033"), {}}, std::nullopt}, + {"0x1c in string - serialise only", {Item("\034"), {}}, std::nullopt}, + {"0x1d in string - serialise only", {Item("\035"), {}}, std::nullopt}, + {"0x1e in string - serialise only", {Item("\036"), {}}, std::nullopt}, + {"0x1f in string - serialise only", {Item("\037"), {}}, std::nullopt}, + {"0x7f in string - serialise only", {Item("\177"), {}}, std::nullopt}, + // serialisation-tests/token-generated.json + {"0x00 in token - serialise only", + {Item(std::string("a\000a", 3), Item::kTokenType), {}}, + std::nullopt}, + {"0x01 in token - serialise only", + {Item("a\001a", Item::kTokenType), {}}, + std::nullopt}, + {"0x02 in token - serialise only", + {Item("a\002a", Item::kTokenType), {}}, + std::nullopt}, + {"0x03 in token - serialise only", + {Item("a\003a", Item::kTokenType), {}}, + std::nullopt}, + {"0x04 in token - serialise only", + {Item("a\004a", Item::kTokenType), {}}, + std::nullopt}, + {"0x05 in token - serialise only", + {Item("a\005a", Item::kTokenType), {}}, + std::nullopt}, + {"0x06 in token - serialise only", + {Item("a\006a", Item::kTokenType), {}}, + std::nullopt}, + {"0x07 in token - serialise only", + {Item("a\007a", Item::kTokenType), {}}, + std::nullopt}, + {"0x08 in token - serialise only", + {Item("a\010a", Item::kTokenType), {}}, + std::nullopt}, + {"0x09 in token - serialise only", + {Item("a\ta", Item::kTokenType), {}}, + std::nullopt}, + {"0x0a in token - serialise only", + {Item("a\na", Item::kTokenType), {}}, + std::nullopt}, + {"0x0b in token - serialise only", + {Item("a\013a", Item::kTokenType), {}}, + std::nullopt}, + {"0x0c in token - serialise only", + {Item("a\014a", Item::kTokenType), {}}, + std::nullopt}, + {"0x0d in token - serialise only", + {Item("a\ra", Item::kTokenType), {}}, + std::nullopt}, + {"0x0e in token - serialise only", + {Item("a\016a", Item::kTokenType), {}}, + std::nullopt}, + {"0x0f in token - serialise only", + {Item("a\017a", Item::kTokenType), {}}, + std::nullopt}, + {"0x10 in token - serialise only", + {Item("a\020a", Item::kTokenType), {}}, + std::nullopt}, + {"0x11 in token - serialise only", + {Item("a\021a", Item::kTokenType), {}}, + std::nullopt}, + {"0x12 in token - serialise only", + {Item("a\022a", Item::kTokenType), {}}, + std::nullopt}, + {"0x13 in token - serialise only", + {Item("a\023a", Item::kTokenType), {}}, + std::nullopt}, + {"0x14 in token - serialise only", + {Item("a\024a", Item::kTokenType), {}}, + std::nullopt}, + {"0x15 in token - serialise only", + {Item("a\025a", Item::kTokenType), {}}, + std::nullopt}, + {"0x16 in token - serialise only", + {Item("a\026a", Item::kTokenType), {}}, + std::nullopt}, + {"0x17 in token - serialise only", + {Item("a\027a", Item::kTokenType), {}}, + std::nullopt}, + {"0x18 in token - serialise only", + {Item("a\030a", Item::kTokenType), {}}, + std::nullopt}, + {"0x19 in token - serialise only", + {Item("a\031a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1a in token - serialise only", + {Item("a\032a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1b in token - serialise only", + {Item("a\033a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1c in token - serialise only", + {Item("a\034a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1d in token - serialise only", + {Item("a\035a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1e in token - serialise only", + {Item("a\036a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1f in token - serialise only", + {Item("a\037a", Item::kTokenType), {}}, + std::nullopt}, + {"0x20 in token - serialise only", + {Item("a a", Item::kTokenType), {}}, + std::nullopt}, + {"0x22 in token - serialise only", + {Item("a\"a", Item::kTokenType), {}}, + std::nullopt}, + {"0x28 in token - serialise only", + {Item("a(a", Item::kTokenType), {}}, + std::nullopt}, + {"0x29 in token - serialise only", + {Item("a)a", Item::kTokenType), {}}, + std::nullopt}, + {"0x2c in token - serialise only", + {Item("a,a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3b in token - serialise only", + {Item("a;a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3c in token - serialise only", + {Item("a<a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3d in token - serialise only", + {Item("a=a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3e in token - serialise only", + {Item("a>a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3f in token - serialise only", + {Item("a?a", Item::kTokenType), {}}, + std::nullopt}, + {"0x40 in token - serialise only", + {Item("a@a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5b in token - serialise only", + {Item("a[a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5c in token - serialise only", + {Item("a\\a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5d in token - serialise only", + {Item("a]a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7b in token - serialise only", + {Item("a{a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7d in token - serialise only", + {Item("a}a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7f in token - serialise only", + {Item("a\177a", Item::kTokenType), {}}, + std::nullopt}, + {"0x00 starting a token - serialise only", + {Item(std::string("\000a", 2), Item::kTokenType), {}}, + std::nullopt}, + {"0x01 starting a token - serialise only", + {Item("\001a", Item::kTokenType), {}}, + std::nullopt}, + {"0x02 starting a token - serialise only", + {Item("\002a", Item::kTokenType), {}}, + std::nullopt}, + {"0x03 starting a token - serialise only", + {Item("\003a", Item::kTokenType), {}}, + std::nullopt}, + {"0x04 starting a token - serialise only", + {Item("\004a", Item::kTokenType), {}}, + std::nullopt}, + {"0x05 starting a token - serialise only", + {Item("\005a", Item::kTokenType), {}}, + std::nullopt}, + {"0x06 starting a token - serialise only", + {Item("\006a", Item::kTokenType), {}}, + std::nullopt}, + {"0x07 starting a token - serialise only", + {Item("\007a", Item::kTokenType), {}}, + std::nullopt}, + {"0x08 starting a token - serialise only", + {Item("\010a", Item::kTokenType), {}}, + std::nullopt}, + {"0x09 starting a token - serialise only", + {Item("\ta", Item::kTokenType), {}}, + std::nullopt}, + {"0x0a starting a token - serialise only", + {Item("\na", Item::kTokenType), {}}, + std::nullopt}, + {"0x0b starting a token - serialise only", + {Item("\013a", Item::kTokenType), {}}, + std::nullopt}, + {"0x0c starting a token - serialise only", + {Item("\014a", Item::kTokenType), {}}, + std::nullopt}, + {"0x0d starting a token - serialise only", + {Item("\ra", Item::kTokenType), {}}, + std::nullopt}, + {"0x0e starting a token - serialise only", + {Item("\016a", Item::kTokenType), {}}, + std::nullopt}, + {"0x0f starting a token - serialise only", + {Item("\017a", Item::kTokenType), {}}, + std::nullopt}, + {"0x10 starting a token - serialise only", + {Item("\020a", Item::kTokenType), {}}, + std::nullopt}, + {"0x11 starting a token - serialise only", + {Item("\021a", Item::kTokenType), {}}, + std::nullopt}, + {"0x12 starting a token - serialise only", + {Item("\022a", Item::kTokenType), {}}, + std::nullopt}, + {"0x13 starting a token - serialise only", + {Item("\023a", Item::kTokenType), {}}, + std::nullopt}, + {"0x14 starting a token - serialise only", + {Item("\024a", Item::kTokenType), {}}, + std::nullopt}, + {"0x15 starting a token - serialise only", + {Item("\025a", Item::kTokenType), {}}, + std::nullopt}, + {"0x16 starting a token - serialise only", + {Item("\026a", Item::kTokenType), {}}, + std::nullopt}, + {"0x17 starting a token - serialise only", + {Item("\027a", Item::kTokenType), {}}, + std::nullopt}, + {"0x18 starting a token - serialise only", + {Item("\030a", Item::kTokenType), {}}, + std::nullopt}, + {"0x19 starting a token - serialise only", + {Item("\031a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1a starting a token - serialise only", + {Item("\032a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1b starting a token - serialise only", + {Item("\033a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1c starting a token - serialise only", + {Item("\034a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1d starting a token - serialise only", + {Item("\035a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1e starting a token - serialise only", + {Item("\036a", Item::kTokenType), {}}, + std::nullopt}, + {"0x1f starting a token - serialise only", + {Item("\037a", Item::kTokenType), {}}, + std::nullopt}, + {"0x20 starting a token - serialise only", + {Item(" a", Item::kTokenType), {}}, + std::nullopt}, + {"0x21 starting a token - serialise only", + {Item("!a", Item::kTokenType), {}}, + std::nullopt}, + {"0x22 starting a token - serialise only", + {Item("\"a", Item::kTokenType), {}}, + std::nullopt}, + {"0x23 starting a token - serialise only", + {Item("#a", Item::kTokenType), {}}, + std::nullopt}, + {"0x24 starting a token - serialise only", + {Item("$a", Item::kTokenType), {}}, + std::nullopt}, + {"0x25 starting a token - serialise only", + {Item("%a", Item::kTokenType), {}}, + std::nullopt}, + {"0x26 starting a token - serialise only", + {Item("&a", Item::kTokenType), {}}, + std::nullopt}, + {"0x27 starting a token - serialise only", + {Item("'a", Item::kTokenType), {}}, + std::nullopt}, + {"0x28 starting a token - serialise only", + {Item("(a", Item::kTokenType), {}}, + std::nullopt}, + {"0x29 starting a token - serialise only", + {Item(")a", Item::kTokenType), {}}, + std::nullopt}, + {"0x2b starting a token - serialise only", + {Item("+a", Item::kTokenType), {}}, + std::nullopt}, + {"0x2c starting a token - serialise only", + {Item(",a", Item::kTokenType), {}}, + std::nullopt}, + {"0x2d starting a token - serialise only", + {Item("-a", Item::kTokenType), {}}, + std::nullopt}, + {"0x2e starting a token - serialise only", + {Item(".a", Item::kTokenType), {}}, + std::nullopt}, + {"0x2f starting a token - serialise only", + {Item("/a", Item::kTokenType), {}}, + std::nullopt}, + {"0x30 starting a token - serialise only", + {Item("0a", Item::kTokenType), {}}, + std::nullopt}, + {"0x31 starting a token - serialise only", + {Item("1a", Item::kTokenType), {}}, + std::nullopt}, + {"0x32 starting a token - serialise only", + {Item("2a", Item::kTokenType), {}}, + std::nullopt}, + {"0x33 starting a token - serialise only", + {Item("3a", Item::kTokenType), {}}, + std::nullopt}, + {"0x34 starting a token - serialise only", + {Item("4a", Item::kTokenType), {}}, + std::nullopt}, + {"0x35 starting a token - serialise only", + {Item("5a", Item::kTokenType), {}}, + std::nullopt}, + {"0x36 starting a token - serialise only", + {Item("6a", Item::kTokenType), {}}, + std::nullopt}, + {"0x37 starting a token - serialise only", + {Item("7a", Item::kTokenType), {}}, + std::nullopt}, + {"0x38 starting a token - serialise only", + {Item("8a", Item::kTokenType), {}}, + std::nullopt}, + {"0x39 starting a token - serialise only", + {Item("9a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3a starting a token - serialise only", + {Item(":a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3b starting a token - serialise only", + {Item(";a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3c starting a token - serialise only", + {Item("<a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3d starting a token - serialise only", + {Item("=a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3e starting a token - serialise only", + {Item(">a", Item::kTokenType), {}}, + std::nullopt}, + {"0x3f starting a token - serialise only", + {Item("?a", Item::kTokenType), {}}, + std::nullopt}, + {"0x40 starting a token - serialise only", + {Item("@a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5b starting a token - serialise only", + {Item("[a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5c starting a token - serialise only", + {Item("\\a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5d starting a token - serialise only", + {Item("]a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5e starting a token - serialise only", + {Item("^a", Item::kTokenType), {}}, + std::nullopt}, + {"0x5f starting a token - serialise only", + {Item("_a", Item::kTokenType), {}}, + std::nullopt}, + {"0x60 starting a token - serialise only", + {Item("`a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7b starting a token - serialise only", + {Item("{a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7c starting a token - serialise only", + {Item("|a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7d starting a token - serialise only", + {Item("}a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7e starting a token - serialise only", + {Item("~a", Item::kTokenType), {}}, + std::nullopt}, + {"0x7f starting a token - serialise only", + {Item("\177a", Item::kTokenType), {}}, + std::nullopt}, +}; + +const struct SerializationOnlyListTestCase { + const char* name; + const List expected; + const std::optional<std::string> canonical; +} serialization_only_list_test_cases[] = { + // serialisation-tests/key-generated.json + {"0x00 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param(std::string("a\000a", 3), 1)}}}, + std::nullopt}, + {"0x01 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\001a", 1)}}}, + std::nullopt}, + {"0x02 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\002a", 1)}}}, + std::nullopt}, + {"0x03 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\003a", 1)}}}, + std::nullopt}, + {"0x04 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\004a", 1)}}}, + std::nullopt}, + {"0x05 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\005a", 1)}}}, + std::nullopt}, + {"0x06 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\006a", 1)}}}, + std::nullopt}, + {"0x07 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\007a", 1)}}}, + std::nullopt}, + {"0x08 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\010a", 1)}}}, + std::nullopt}, + {"0x09 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\ta", 1)}}}, + std::nullopt}, + {"0x0a in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\na", 1)}}}, + std::nullopt}, + {"0x0b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\013a", 1)}}}, + std::nullopt}, + {"0x0c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\014a", 1)}}}, + std::nullopt}, + {"0x0d in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\ra", 1)}}}, + std::nullopt}, + {"0x0e in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\016a", 1)}}}, + std::nullopt}, + {"0x0f in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\017a", 1)}}}, + std::nullopt}, + {"0x10 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\020a", 1)}}}, + std::nullopt}, + {"0x11 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\021a", 1)}}}, + std::nullopt}, + {"0x12 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\022a", 1)}}}, + std::nullopt}, + {"0x13 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\023a", 1)}}}, + std::nullopt}, + {"0x14 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\024a", 1)}}}, + std::nullopt}, + {"0x15 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\025a", 1)}}}, + std::nullopt}, + {"0x16 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\026a", 1)}}}, + std::nullopt}, + {"0x17 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\027a", 1)}}}, + std::nullopt}, + {"0x18 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\030a", 1)}}}, + std::nullopt}, + {"0x19 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\031a", 1)}}}, + std::nullopt}, + {"0x1a in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\032a", 1)}}}, + std::nullopt}, + {"0x1b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\033a", 1)}}}, + std::nullopt}, + {"0x1c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\034a", 1)}}}, + std::nullopt}, + {"0x1d in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\035a", 1)}}}, + std::nullopt}, + {"0x1e in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\036a", 1)}}}, + std::nullopt}, + {"0x1f in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\037a", 1)}}}, + std::nullopt}, + {"0x20 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a a", 1)}}}, + std::nullopt}, + {"0x21 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a!a", 1)}}}, + std::nullopt}, + {"0x22 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\"a", 1)}}}, + std::nullopt}, + {"0x23 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a#a", 1)}}}, + std::nullopt}, + {"0x24 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a$a", 1)}}}, + std::nullopt}, + {"0x25 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a%a", 1)}}}, + std::nullopt}, + {"0x26 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a&a", 1)}}}, + std::nullopt}, + {"0x27 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a'a", 1)}}}, + std::nullopt}, + {"0x28 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a(a", 1)}}}, + std::nullopt}, + {"0x29 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a)a", 1)}}}, + std::nullopt}, + {"0x2b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a+a", 1)}}}, + std::nullopt}, + {"0x2c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a,a", 1)}}}, + std::nullopt}, + {"0x2f in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a/a", 1)}}}, + std::nullopt}, + {"0x3a in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a:a", 1)}}}, + std::nullopt}, + {"0x3b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a;a", 1)}}}, + std::nullopt}, + {"0x3c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a<a", 1)}}}, + std::nullopt}, + {"0x3d in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a=a", 1)}}}, + std::nullopt}, + {"0x3e in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a>a", 1)}}}, + std::nullopt}, + {"0x3f in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a?a", 1)}}}, + std::nullopt}, + {"0x40 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a@a", 1)}}}, + std::nullopt}, + {"0x41 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aAa", 1)}}}, + std::nullopt}, + {"0x42 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aBa", 1)}}}, + std::nullopt}, + {"0x43 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aCa", 1)}}}, + std::nullopt}, + {"0x44 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aDa", 1)}}}, + std::nullopt}, + {"0x45 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aEa", 1)}}}, + std::nullopt}, + {"0x46 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aFa", 1)}}}, + std::nullopt}, + {"0x47 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aGa", 1)}}}, + std::nullopt}, + {"0x48 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aHa", 1)}}}, + std::nullopt}, + {"0x49 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aIa", 1)}}}, + std::nullopt}, + {"0x4a in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aJa", 1)}}}, + std::nullopt}, + {"0x4b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aKa", 1)}}}, + std::nullopt}, + {"0x4c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aLa", 1)}}}, + std::nullopt}, + {"0x4d in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aMa", 1)}}}, + std::nullopt}, + {"0x4e in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aNa", 1)}}}, + std::nullopt}, + {"0x4f in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aOa", 1)}}}, + std::nullopt}, + {"0x50 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aPa", 1)}}}, + std::nullopt}, + {"0x51 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aQa", 1)}}}, + std::nullopt}, + {"0x52 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aRa", 1)}}}, + std::nullopt}, + {"0x53 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aSa", 1)}}}, + std::nullopt}, + {"0x54 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aTa", 1)}}}, + std::nullopt}, + {"0x55 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aUa", 1)}}}, + std::nullopt}, + {"0x56 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aVa", 1)}}}, + std::nullopt}, + {"0x57 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aWa", 1)}}}, + std::nullopt}, + {"0x58 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aXa", 1)}}}, + std::nullopt}, + {"0x59 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aYa", 1)}}}, + std::nullopt}, + {"0x5a in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("aZa", 1)}}}, + std::nullopt}, + {"0x5b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a[a", 1)}}}, + std::nullopt}, + {"0x5c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\\a", 1)}}}, + std::nullopt}, + {"0x5d in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a]a", 1)}}}, + std::nullopt}, + {"0x5e in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a^a", 1)}}}, + std::nullopt}, + {"0x60 in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a`a", 1)}}}, + std::nullopt}, + {"0x7b in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a{a", 1)}}}, + std::nullopt}, + {"0x7c in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a|a", 1)}}}, + std::nullopt}, + {"0x7d in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a}a", 1)}}}, + std::nullopt}, + {"0x7e in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a~a", 1)}}}, + std::nullopt}, + {"0x7f in parameterised list key - serialise only", + {{Item("foo", Item::kTokenType), {Param("a\177a", 1)}}}, + std::nullopt}, + {"0x00 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(std::string("\000a", 2), 1)}}}, + std::nullopt}, + {"0x01 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\001a", 1)}}}, + std::nullopt}, + {"0x02 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\002a", 1)}}}, + std::nullopt}, + {"0x03 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\003a", 1)}}}, + std::nullopt}, + {"0x04 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\004a", 1)}}}, + std::nullopt}, + {"0x05 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\005a", 1)}}}, + std::nullopt}, + {"0x06 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\006a", 1)}}}, + std::nullopt}, + {"0x07 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\007a", 1)}}}, + std::nullopt}, + {"0x08 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\010a", 1)}}}, + std::nullopt}, + {"0x09 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\ta", 1)}}}, + std::nullopt}, + {"0x0a starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\na", 1)}}}, + std::nullopt}, + {"0x0b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\013a", 1)}}}, + std::nullopt}, + {"0x0c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\014a", 1)}}}, + std::nullopt}, + {"0x0d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\ra", 1)}}}, + std::nullopt}, + {"0x0e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\016a", 1)}}}, + std::nullopt}, + {"0x0f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\017a", 1)}}}, + std::nullopt}, + {"0x10 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\020a", 1)}}}, + std::nullopt}, + {"0x11 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\021a", 1)}}}, + std::nullopt}, + {"0x12 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\022a", 1)}}}, + std::nullopt}, + {"0x13 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\023a", 1)}}}, + std::nullopt}, + {"0x14 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\024a", 1)}}}, + std::nullopt}, + {"0x15 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\025a", 1)}}}, + std::nullopt}, + {"0x16 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\026a", 1)}}}, + std::nullopt}, + {"0x17 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\027a", 1)}}}, + std::nullopt}, + {"0x18 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\030a", 1)}}}, + std::nullopt}, + {"0x19 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\031a", 1)}}}, + std::nullopt}, + {"0x1a starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\032a", 1)}}}, + std::nullopt}, + {"0x1b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\033a", 1)}}}, + std::nullopt}, + {"0x1c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\034a", 1)}}}, + std::nullopt}, + {"0x1d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\035a", 1)}}}, + std::nullopt}, + {"0x1e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\036a", 1)}}}, + std::nullopt}, + {"0x1f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\037a", 1)}}}, + std::nullopt}, + {"0x20 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(" a", 1)}}}, + std::nullopt}, + {"0x21 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("!a", 1)}}}, + std::nullopt}, + {"0x22 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\"a", 1)}}}, + std::nullopt}, + {"0x23 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("#a", 1)}}}, + std::nullopt}, + {"0x24 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("$a", 1)}}}, + std::nullopt}, + {"0x25 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("%a", 1)}}}, + std::nullopt}, + {"0x26 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("&a", 1)}}}, + std::nullopt}, + {"0x27 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("'a", 1)}}}, + std::nullopt}, + {"0x28 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("(a", 1)}}}, + std::nullopt}, + {"0x29 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(")a", 1)}}}, + std::nullopt}, + {"0x2b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("+a", 1)}}}, + std::nullopt}, + {"0x2c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(",a", 1)}}}, + std::nullopt}, + {"0x2d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("-a", 1)}}}, + std::nullopt}, + {"0x2e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(".a", 1)}}}, + std::nullopt}, + {"0x2f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("/a", 1)}}}, + std::nullopt}, + {"0x30 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("0a", 1)}}}, + std::nullopt}, + {"0x31 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("1a", 1)}}}, + std::nullopt}, + {"0x32 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("2a", 1)}}}, + std::nullopt}, + {"0x33 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("3a", 1)}}}, + std::nullopt}, + {"0x34 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("4a", 1)}}}, + std::nullopt}, + {"0x35 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("5a", 1)}}}, + std::nullopt}, + {"0x36 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("6a", 1)}}}, + std::nullopt}, + {"0x37 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("7a", 1)}}}, + std::nullopt}, + {"0x38 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("8a", 1)}}}, + std::nullopt}, + {"0x39 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("9a", 1)}}}, + std::nullopt}, + {"0x3a starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(":a", 1)}}}, + std::nullopt}, + {"0x3b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(";a", 1)}}}, + std::nullopt}, + {"0x3c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("<a", 1)}}}, + std::nullopt}, + {"0x3d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("=a", 1)}}}, + std::nullopt}, + {"0x3e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param(">a", 1)}}}, + std::nullopt}, + {"0x3f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("?a", 1)}}}, + std::nullopt}, + {"0x40 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("@a", 1)}}}, + std::nullopt}, + {"0x41 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Aa", 1)}}}, + std::nullopt}, + {"0x42 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ba", 1)}}}, + std::nullopt}, + {"0x43 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ca", 1)}}}, + std::nullopt}, + {"0x44 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Da", 1)}}}, + std::nullopt}, + {"0x45 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ea", 1)}}}, + std::nullopt}, + {"0x46 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Fa", 1)}}}, + std::nullopt}, + {"0x47 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ga", 1)}}}, + std::nullopt}, + {"0x48 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ha", 1)}}}, + std::nullopt}, + {"0x49 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ia", 1)}}}, + std::nullopt}, + {"0x4a starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ja", 1)}}}, + std::nullopt}, + {"0x4b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ka", 1)}}}, + std::nullopt}, + {"0x4c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("La", 1)}}}, + std::nullopt}, + {"0x4d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ma", 1)}}}, + std::nullopt}, + {"0x4e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Na", 1)}}}, + std::nullopt}, + {"0x4f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Oa", 1)}}}, + std::nullopt}, + {"0x50 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Pa", 1)}}}, + std::nullopt}, + {"0x51 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Qa", 1)}}}, + std::nullopt}, + {"0x52 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ra", 1)}}}, + std::nullopt}, + {"0x53 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Sa", 1)}}}, + std::nullopt}, + {"0x54 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ta", 1)}}}, + std::nullopt}, + {"0x55 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ua", 1)}}}, + std::nullopt}, + {"0x56 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Va", 1)}}}, + std::nullopt}, + {"0x57 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Wa", 1)}}}, + std::nullopt}, + {"0x58 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Xa", 1)}}}, + std::nullopt}, + {"0x59 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Ya", 1)}}}, + std::nullopt}, + {"0x5a starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("Za", 1)}}}, + std::nullopt}, + {"0x5b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("[a", 1)}}}, + std::nullopt}, + {"0x5c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\\a", 1)}}}, + std::nullopt}, + {"0x5d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("]a", 1)}}}, + std::nullopt}, + {"0x5e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("^a", 1)}}}, + std::nullopt}, + {"0x5f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("_a", 1)}}}, + std::nullopt}, + {"0x60 starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("`a", 1)}}}, + std::nullopt}, + {"0x7b starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("{a", 1)}}}, + std::nullopt}, + {"0x7c starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("|a", 1)}}}, + std::nullopt}, + {"0x7d starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("}a", 1)}}}, + std::nullopt}, + {"0x7e starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("~a", 1)}}}, + std::nullopt}, + {"0x7f starting a parameterised list key", + {{Item("foo", Item::kTokenType), {Param("\177a", 1)}}}, + std::nullopt}, +}; + +const struct SerializationOnlyDictionaryTestCase { + const char* name; + const Dictionary expected; + const std::optional<std::string> canonical; +} serialization_only_dictionary_test_cases[] = { + // serialisation-tests/key-generated.json + {"0x00 in dictionary key - serialise only", + Dictionary{{{std::string("a\000a", 3), {Integer(1), {}}}}}, std::nullopt}, + {"0x01 in dictionary key - serialise only", + Dictionary{{{"a\001a", {Integer(1), {}}}}}, std::nullopt}, + {"0x02 in dictionary key - serialise only", + Dictionary{{{"a\002a", {Integer(1), {}}}}}, std::nullopt}, + {"0x03 in dictionary key - serialise only", + Dictionary{{{"a\003a", {Integer(1), {}}}}}, std::nullopt}, + {"0x04 in dictionary key - serialise only", + Dictionary{{{"a\004a", {Integer(1), {}}}}}, std::nullopt}, + {"0x05 in dictionary key - serialise only", + Dictionary{{{"a\005a", {Integer(1), {}}}}}, std::nullopt}, + {"0x06 in dictionary key - serialise only", + Dictionary{{{"a\006a", {Integer(1), {}}}}}, std::nullopt}, + {"0x07 in dictionary key - serialise only", + Dictionary{{{"a\007a", {Integer(1), {}}}}}, std::nullopt}, + {"0x08 in dictionary key - serialise only", + Dictionary{{{"a\010a", {Integer(1), {}}}}}, std::nullopt}, + {"0x09 in dictionary key - serialise only", + Dictionary{{{"a\ta", {Integer(1), {}}}}}, std::nullopt}, + {"0x0a in dictionary key - serialise only", + Dictionary{{{"a\na", {Integer(1), {}}}}}, std::nullopt}, + {"0x0b in dictionary key - serialise only", + Dictionary{{{"a\013a", {Integer(1), {}}}}}, std::nullopt}, + {"0x0c in dictionary key - serialise only", + Dictionary{{{"a\014a", {Integer(1), {}}}}}, std::nullopt}, + {"0x0d in dictionary key - serialise only", + Dictionary{{{"a\ra", {Integer(1), {}}}}}, std::nullopt}, + {"0x0e in dictionary key - serialise only", + Dictionary{{{"a\016a", {Integer(1), {}}}}}, std::nullopt}, + {"0x0f in dictionary key - serialise only", + Dictionary{{{"a\017a", {Integer(1), {}}}}}, std::nullopt}, + {"0x10 in dictionary key - serialise only", + Dictionary{{{"a\020a", {Integer(1), {}}}}}, std::nullopt}, + {"0x11 in dictionary key - serialise only", + Dictionary{{{"a\021a", {Integer(1), {}}}}}, std::nullopt}, + {"0x12 in dictionary key - serialise only", + Dictionary{{{"a\022a", {Integer(1), {}}}}}, std::nullopt}, + {"0x13 in dictionary key - serialise only", + Dictionary{{{"a\023a", {Integer(1), {}}}}}, std::nullopt}, + {"0x14 in dictionary key - serialise only", + Dictionary{{{"a\024a", {Integer(1), {}}}}}, std::nullopt}, + {"0x15 in dictionary key - serialise only", + Dictionary{{{"a\025a", {Integer(1), {}}}}}, std::nullopt}, + {"0x16 in dictionary key - serialise only", + Dictionary{{{"a\026a", {Integer(1), {}}}}}, std::nullopt}, + {"0x17 in dictionary key - serialise only", + Dictionary{{{"a\027a", {Integer(1), {}}}}}, std::nullopt}, + {"0x18 in dictionary key - serialise only", + Dictionary{{{"a\030a", {Integer(1), {}}}}}, std::nullopt}, + {"0x19 in dictionary key - serialise only", + Dictionary{{{"a\031a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1a in dictionary key - serialise only", + Dictionary{{{"a\032a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1b in dictionary key - serialise only", + Dictionary{{{"a\033a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1c in dictionary key - serialise only", + Dictionary{{{"a\034a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1d in dictionary key - serialise only", + Dictionary{{{"a\035a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1e in dictionary key - serialise only", + Dictionary{{{"a\036a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1f in dictionary key - serialise only", + Dictionary{{{"a\037a", {Integer(1), {}}}}}, std::nullopt}, + {"0x20 in dictionary key - serialise only", + Dictionary{{{"a a", {Integer(1), {}}}}}, std::nullopt}, + {"0x21 in dictionary key - serialise only", + Dictionary{{{"a!a", {Integer(1), {}}}}}, std::nullopt}, + {"0x22 in dictionary key - serialise only", + Dictionary{{{"a\"a", {Integer(1), {}}}}}, std::nullopt}, + {"0x23 in dictionary key - serialise only", + Dictionary{{{"a#a", {Integer(1), {}}}}}, std::nullopt}, + {"0x24 in dictionary key - serialise only", + Dictionary{{{"a$a", {Integer(1), {}}}}}, std::nullopt}, + {"0x25 in dictionary key - serialise only", + Dictionary{{{"a%a", {Integer(1), {}}}}}, std::nullopt}, + {"0x26 in dictionary key - serialise only", + Dictionary{{{"a&a", {Integer(1), {}}}}}, std::nullopt}, + {"0x27 in dictionary key - serialise only", + Dictionary{{{"a'a", {Integer(1), {}}}}}, std::nullopt}, + {"0x28 in dictionary key - serialise only", + Dictionary{{{"a(a", {Integer(1), {}}}}}, std::nullopt}, + {"0x29 in dictionary key - serialise only", + Dictionary{{{"a)a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2b in dictionary key - serialise only", + Dictionary{{{"a+a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2c in dictionary key - serialise only", + Dictionary{{{"a,a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2f in dictionary key - serialise only", + Dictionary{{{"a/a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3a in dictionary key - serialise only", + Dictionary{{{"a:a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3b in dictionary key - serialise only", + Dictionary{{{"a;a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3c in dictionary key - serialise only", + Dictionary{{{"a<a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3d in dictionary key - serialise only", + Dictionary{{{"a=a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3e in dictionary key - serialise only", + Dictionary{{{"a>a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3f in dictionary key - serialise only", + Dictionary{{{"a?a", {Integer(1), {}}}}}, std::nullopt}, + {"0x40 in dictionary key - serialise only", + Dictionary{{{"a@a", {Integer(1), {}}}}}, std::nullopt}, + {"0x41 in dictionary key - serialise only", + Dictionary{{{"aAa", {Integer(1), {}}}}}, std::nullopt}, + {"0x42 in dictionary key - serialise only", + Dictionary{{{"aBa", {Integer(1), {}}}}}, std::nullopt}, + {"0x43 in dictionary key - serialise only", + Dictionary{{{"aCa", {Integer(1), {}}}}}, std::nullopt}, + {"0x44 in dictionary key - serialise only", + Dictionary{{{"aDa", {Integer(1), {}}}}}, std::nullopt}, + {"0x45 in dictionary key - serialise only", + Dictionary{{{"aEa", {Integer(1), {}}}}}, std::nullopt}, + {"0x46 in dictionary key - serialise only", + Dictionary{{{"aFa", {Integer(1), {}}}}}, std::nullopt}, + {"0x47 in dictionary key - serialise only", + Dictionary{{{"aGa", {Integer(1), {}}}}}, std::nullopt}, + {"0x48 in dictionary key - serialise only", + Dictionary{{{"aHa", {Integer(1), {}}}}}, std::nullopt}, + {"0x49 in dictionary key - serialise only", + Dictionary{{{"aIa", {Integer(1), {}}}}}, std::nullopt}, + {"0x4a in dictionary key - serialise only", + Dictionary{{{"aJa", {Integer(1), {}}}}}, std::nullopt}, + {"0x4b in dictionary key - serialise only", + Dictionary{{{"aKa", {Integer(1), {}}}}}, std::nullopt}, + {"0x4c in dictionary key - serialise only", + Dictionary{{{"aLa", {Integer(1), {}}}}}, std::nullopt}, + {"0x4d in dictionary key - serialise only", + Dictionary{{{"aMa", {Integer(1), {}}}}}, std::nullopt}, + {"0x4e in dictionary key - serialise only", + Dictionary{{{"aNa", {Integer(1), {}}}}}, std::nullopt}, + {"0x4f in dictionary key - serialise only", + Dictionary{{{"aOa", {Integer(1), {}}}}}, std::nullopt}, + {"0x50 in dictionary key - serialise only", + Dictionary{{{"aPa", {Integer(1), {}}}}}, std::nullopt}, + {"0x51 in dictionary key - serialise only", + Dictionary{{{"aQa", {Integer(1), {}}}}}, std::nullopt}, + {"0x52 in dictionary key - serialise only", + Dictionary{{{"aRa", {Integer(1), {}}}}}, std::nullopt}, + {"0x53 in dictionary key - serialise only", + Dictionary{{{"aSa", {Integer(1), {}}}}}, std::nullopt}, + {"0x54 in dictionary key - serialise only", + Dictionary{{{"aTa", {Integer(1), {}}}}}, std::nullopt}, + {"0x55 in dictionary key - serialise only", + Dictionary{{{"aUa", {Integer(1), {}}}}}, std::nullopt}, + {"0x56 in dictionary key - serialise only", + Dictionary{{{"aVa", {Integer(1), {}}}}}, std::nullopt}, + {"0x57 in dictionary key - serialise only", + Dictionary{{{"aWa", {Integer(1), {}}}}}, std::nullopt}, + {"0x58 in dictionary key - serialise only", + Dictionary{{{"aXa", {Integer(1), {}}}}}, std::nullopt}, + {"0x59 in dictionary key - serialise only", + Dictionary{{{"aYa", {Integer(1), {}}}}}, std::nullopt}, + {"0x5a in dictionary key - serialise only", + Dictionary{{{"aZa", {Integer(1), {}}}}}, std::nullopt}, + {"0x5b in dictionary key - serialise only", + Dictionary{{{"a[a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5c in dictionary key - serialise only", + Dictionary{{{"a\\a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5d in dictionary key - serialise only", + Dictionary{{{"a]a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5e in dictionary key - serialise only", + Dictionary{{{"a^a", {Integer(1), {}}}}}, std::nullopt}, + {"0x60 in dictionary key - serialise only", + Dictionary{{{"a`a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7b in dictionary key - serialise only", + Dictionary{{{"a{a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7c in dictionary key - serialise only", + Dictionary{{{"a|a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7d in dictionary key - serialise only", + Dictionary{{{"a}a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7e in dictionary key - serialise only", + Dictionary{{{"a~a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7f in dictionary key - serialise only", + Dictionary{{{"a\177a", {Integer(1), {}}}}}, std::nullopt}, + {"0x00 starting a dictionary key - serialise only", + Dictionary{{{std::string("\000a", 2), {Integer(1), {}}}}}, std::nullopt}, + {"0x01 starting a dictionary key - serialise only", + Dictionary{{{"\001a", {Integer(1), {}}}}}, std::nullopt}, + {"0x02 starting a dictionary key - serialise only", + Dictionary{{{"\002a", {Integer(1), {}}}}}, std::nullopt}, + {"0x03 starting a dictionary key - serialise only", + Dictionary{{{"\003a", {Integer(1), {}}}}}, std::nullopt}, + {"0x04 starting a dictionary key - serialise only", + Dictionary{{{"\004a", {Integer(1), {}}}}}, std::nullopt}, + {"0x05 starting a dictionary key - serialise only", + Dictionary{{{"\005a", {Integer(1), {}}}}}, std::nullopt}, + {"0x06 starting a dictionary key - serialise only", + Dictionary{{{"\006a", {Integer(1), {}}}}}, std::nullopt}, + {"0x07 starting a dictionary key - serialise only", + Dictionary{{{"\007a", {Integer(1), {}}}}}, std::nullopt}, + {"0x08 starting a dictionary key - serialise only", + Dictionary{{{"\010a", {Integer(1), {}}}}}, std::nullopt}, + {"0x09 starting a dictionary key - serialise only", + Dictionary{{{"\ta", {Integer(1), {}}}}}, std::nullopt}, + {"0x0a starting a dictionary key - serialise only", + Dictionary{{{"\na", {Integer(1), {}}}}}, std::nullopt}, + {"0x0b starting a dictionary key - serialise only", + Dictionary{{{"\013a", {Integer(1), {}}}}}, std::nullopt}, + {"0x0c starting a dictionary key - serialise only", + Dictionary{{{"\014a", {Integer(1), {}}}}}, std::nullopt}, + {"0x0d starting a dictionary key - serialise only", + Dictionary{{{"\ra", {Integer(1), {}}}}}, std::nullopt}, + {"0x0e starting a dictionary key - serialise only", + Dictionary{{{"\016a", {Integer(1), {}}}}}, std::nullopt}, + {"0x0f starting a dictionary key - serialise only", + Dictionary{{{"\017a", {Integer(1), {}}}}}, std::nullopt}, + {"0x10 starting a dictionary key - serialise only", + Dictionary{{{"\020a", {Integer(1), {}}}}}, std::nullopt}, + {"0x11 starting a dictionary key - serialise only", + Dictionary{{{"\021a", {Integer(1), {}}}}}, std::nullopt}, + {"0x12 starting a dictionary key - serialise only", + Dictionary{{{"\022a", {Integer(1), {}}}}}, std::nullopt}, + {"0x13 starting a dictionary key - serialise only", + Dictionary{{{"\023a", {Integer(1), {}}}}}, std::nullopt}, + {"0x14 starting a dictionary key - serialise only", + Dictionary{{{"\024a", {Integer(1), {}}}}}, std::nullopt}, + {"0x15 starting a dictionary key - serialise only", + Dictionary{{{"\025a", {Integer(1), {}}}}}, std::nullopt}, + {"0x16 starting a dictionary key - serialise only", + Dictionary{{{"\026a", {Integer(1), {}}}}}, std::nullopt}, + {"0x17 starting a dictionary key - serialise only", + Dictionary{{{"\027a", {Integer(1), {}}}}}, std::nullopt}, + {"0x18 starting a dictionary key - serialise only", + Dictionary{{{"\030a", {Integer(1), {}}}}}, std::nullopt}, + {"0x19 starting a dictionary key - serialise only", + Dictionary{{{"\031a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1a starting a dictionary key - serialise only", + Dictionary{{{"\032a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1b starting a dictionary key - serialise only", + Dictionary{{{"\033a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1c starting a dictionary key - serialise only", + Dictionary{{{"\034a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1d starting a dictionary key - serialise only", + Dictionary{{{"\035a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1e starting a dictionary key - serialise only", + Dictionary{{{"\036a", {Integer(1), {}}}}}, std::nullopt}, + {"0x1f starting a dictionary key - serialise only", + Dictionary{{{"\037a", {Integer(1), {}}}}}, std::nullopt}, + {"0x20 starting a dictionary key - serialise only", + Dictionary{{{" a", {Integer(1), {}}}}}, std::nullopt}, + {"0x21 starting a dictionary key - serialise only", + Dictionary{{{"!a", {Integer(1), {}}}}}, std::nullopt}, + {"0x22 starting a dictionary key - serialise only", + Dictionary{{{"\"a", {Integer(1), {}}}}}, std::nullopt}, + {"0x23 starting a dictionary key - serialise only", + Dictionary{{{"#a", {Integer(1), {}}}}}, std::nullopt}, + {"0x24 starting a dictionary key - serialise only", + Dictionary{{{"$a", {Integer(1), {}}}}}, std::nullopt}, + {"0x25 starting a dictionary key - serialise only", + Dictionary{{{"%a", {Integer(1), {}}}}}, std::nullopt}, + {"0x26 starting a dictionary key - serialise only", + Dictionary{{{"&a", {Integer(1), {}}}}}, std::nullopt}, + {"0x27 starting a dictionary key - serialise only", + Dictionary{{{"'a", {Integer(1), {}}}}}, std::nullopt}, + {"0x28 starting a dictionary key - serialise only", + Dictionary{{{"(a", {Integer(1), {}}}}}, std::nullopt}, + {"0x29 starting a dictionary key - serialise only", + Dictionary{{{")a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2b starting a dictionary key - serialise only", + Dictionary{{{"+a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2c starting a dictionary key - serialise only", + Dictionary{{{",a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2d starting a dictionary key - serialise only", + Dictionary{{{"-a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2e starting a dictionary key - serialise only", + Dictionary{{{".a", {Integer(1), {}}}}}, std::nullopt}, + {"0x2f starting a dictionary key - serialise only", + Dictionary{{{"/a", {Integer(1), {}}}}}, std::nullopt}, + {"0x30 starting a dictionary key - serialise only", + Dictionary{{{"0a", {Integer(1), {}}}}}, std::nullopt}, + {"0x31 starting a dictionary key - serialise only", + Dictionary{{{"1a", {Integer(1), {}}}}}, std::nullopt}, + {"0x32 starting a dictionary key - serialise only", + Dictionary{{{"2a", {Integer(1), {}}}}}, std::nullopt}, + {"0x33 starting a dictionary key - serialise only", + Dictionary{{{"3a", {Integer(1), {}}}}}, std::nullopt}, + {"0x34 starting a dictionary key - serialise only", + Dictionary{{{"4a", {Integer(1), {}}}}}, std::nullopt}, + {"0x35 starting a dictionary key - serialise only", + Dictionary{{{"5a", {Integer(1), {}}}}}, std::nullopt}, + {"0x36 starting a dictionary key - serialise only", + Dictionary{{{"6a", {Integer(1), {}}}}}, std::nullopt}, + {"0x37 starting a dictionary key - serialise only", + Dictionary{{{"7a", {Integer(1), {}}}}}, std::nullopt}, + {"0x38 starting a dictionary key - serialise only", + Dictionary{{{"8a", {Integer(1), {}}}}}, std::nullopt}, + {"0x39 starting a dictionary key - serialise only", + Dictionary{{{"9a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3a starting a dictionary key - serialise only", + Dictionary{{{":a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3b starting a dictionary key - serialise only", + Dictionary{{{";a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3c starting a dictionary key - serialise only", + Dictionary{{{"<a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3d starting a dictionary key - serialise only", + Dictionary{{{"=a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3e starting a dictionary key - serialise only", + Dictionary{{{">a", {Integer(1), {}}}}}, std::nullopt}, + {"0x3f starting a dictionary key - serialise only", + Dictionary{{{"?a", {Integer(1), {}}}}}, std::nullopt}, + {"0x40 starting a dictionary key - serialise only", + Dictionary{{{"@a", {Integer(1), {}}}}}, std::nullopt}, + {"0x41 starting a dictionary key - serialise only", + Dictionary{{{"Aa", {Integer(1), {}}}}}, std::nullopt}, + {"0x42 starting a dictionary key - serialise only", + Dictionary{{{"Ba", {Integer(1), {}}}}}, std::nullopt}, + {"0x43 starting a dictionary key - serialise only", + Dictionary{{{"Ca", {Integer(1), {}}}}}, std::nullopt}, + {"0x44 starting a dictionary key - serialise only", + Dictionary{{{"Da", {Integer(1), {}}}}}, std::nullopt}, + {"0x45 starting a dictionary key - serialise only", + Dictionary{{{"Ea", {Integer(1), {}}}}}, std::nullopt}, + {"0x46 starting a dictionary key - serialise only", + Dictionary{{{"Fa", {Integer(1), {}}}}}, std::nullopt}, + {"0x47 starting a dictionary key - serialise only", + Dictionary{{{"Ga", {Integer(1), {}}}}}, std::nullopt}, + {"0x48 starting a dictionary key - serialise only", + Dictionary{{{"Ha", {Integer(1), {}}}}}, std::nullopt}, + {"0x49 starting a dictionary key - serialise only", + Dictionary{{{"Ia", {Integer(1), {}}}}}, std::nullopt}, + {"0x4a starting a dictionary key - serialise only", + Dictionary{{{"Ja", {Integer(1), {}}}}}, std::nullopt}, + {"0x4b starting a dictionary key - serialise only", + Dictionary{{{"Ka", {Integer(1), {}}}}}, std::nullopt}, + {"0x4c starting a dictionary key - serialise only", + Dictionary{{{"La", {Integer(1), {}}}}}, std::nullopt}, + {"0x4d starting a dictionary key - serialise only", + Dictionary{{{"Ma", {Integer(1), {}}}}}, std::nullopt}, + {"0x4e starting a dictionary key - serialise only", + Dictionary{{{"Na", {Integer(1), {}}}}}, std::nullopt}, + {"0x4f starting a dictionary key - serialise only", + Dictionary{{{"Oa", {Integer(1), {}}}}}, std::nullopt}, + {"0x50 starting a dictionary key - serialise only", + Dictionary{{{"Pa", {Integer(1), {}}}}}, std::nullopt}, + {"0x51 starting a dictionary key - serialise only", + Dictionary{{{"Qa", {Integer(1), {}}}}}, std::nullopt}, + {"0x52 starting a dictionary key - serialise only", + Dictionary{{{"Ra", {Integer(1), {}}}}}, std::nullopt}, + {"0x53 starting a dictionary key - serialise only", + Dictionary{{{"Sa", {Integer(1), {}}}}}, std::nullopt}, + {"0x54 starting a dictionary key - serialise only", + Dictionary{{{"Ta", {Integer(1), {}}}}}, std::nullopt}, + {"0x55 starting a dictionary key - serialise only", + Dictionary{{{"Ua", {Integer(1), {}}}}}, std::nullopt}, + {"0x56 starting a dictionary key - serialise only", + Dictionary{{{"Va", {Integer(1), {}}}}}, std::nullopt}, + {"0x57 starting a dictionary key - serialise only", + Dictionary{{{"Wa", {Integer(1), {}}}}}, std::nullopt}, + {"0x58 starting a dictionary key - serialise only", + Dictionary{{{"Xa", {Integer(1), {}}}}}, std::nullopt}, + {"0x59 starting a dictionary key - serialise only", + Dictionary{{{"Ya", {Integer(1), {}}}}}, std::nullopt}, + {"0x5a starting a dictionary key - serialise only", + Dictionary{{{"Za", {Integer(1), {}}}}}, std::nullopt}, + {"0x5b starting a dictionary key - serialise only", + Dictionary{{{"[a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5c starting a dictionary key - serialise only", + Dictionary{{{"\\a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5d starting a dictionary key - serialise only", + Dictionary{{{"]a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5e starting a dictionary key - serialise only", + Dictionary{{{"^a", {Integer(1), {}}}}}, std::nullopt}, + {"0x5f starting a dictionary key - serialise only", + Dictionary{{{"_a", {Integer(1), {}}}}}, std::nullopt}, + {"0x60 starting a dictionary key - serialise only", + Dictionary{{{"`a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7b starting a dictionary key - serialise only", + Dictionary{{{"{a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7c starting a dictionary key - serialise only", + Dictionary{{{"|a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7d starting a dictionary key - serialise only", + Dictionary{{{"}a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7e starting a dictionary key - serialise only", + Dictionary{{{"~a", {Integer(1), {}}}}}, std::nullopt}, + {"0x7f starting a dictionary key - serialise only", + Dictionary{{{"\177a", {Integer(1), {}}}}}, std::nullopt}, +}; + } // namespace TEST(StructuredHeaderGeneratedTest, ParseItem) { @@ -7859,5 +9256,29 @@ } } +TEST(StructuredHeaderGeneratedTest, SerializationOnlyItem) { + for (const auto& c : serialization_only_item_test_cases) { + SCOPED_TRACE(c.name); + std::optional<std::string> result = SerializeItem(c.expected); + EXPECT_EQ(result, c.canonical); + } +} + +TEST(StructuredHeaderGeneratedTest, SerializationOnlyList) { + for (const auto& c : serialization_only_list_test_cases) { + SCOPED_TRACE(c.name); + std::optional<std::string> result = SerializeList(c.expected); + EXPECT_EQ(result, c.canonical); + } +} + +TEST(StructuredHeaderGeneratedTest, SerializationOnlyDictionary) { + for (const auto& c : serialization_only_dictionary_test_cases) { + SCOPED_TRACE(c.name); + std::optional<std::string> result = SerializeDictionary(c.expected); + EXPECT_EQ(result, c.canonical); + } +} + } // namespace structured_headers } // namespace quiche