v2 / vlib / encoding / cbor / tests / cbor_wg / rfc8949_bad.edn
197 lines · 195 sloc · 5.45 KB · 468855eef1db0ff73c62be2d1bf176ffa0e1478e
Raw
1{
2 "title": "bad",
3 "description": "Inputs that should fail for RFC 8949",
4 "fail": true,
5 "tests": [
6 {
7 "description": "Missing the next byte for mt0 ai 24",
8 "encoded": h'18',
9 },
10 {
11 "description": "Missing the next 2 bytes for mt0 ai 25",
12 "encoded": h'19',
13 },
14 {
15 "description": "Missing the next 1 byte for mt0 ai 25",
16 "encoded": h'1900',
17 },
18 {
19 "description": "Missing the next 4 bytes for mt0 ai 26",
20 "encoded": h'1a',
21 },
22 {
23 "description": "Missing the next 3 bytes for mt0 ai 26",
24 "encoded": h'1a00',
25 },
26 {
27 "description": "Missing the next 2 bytes for mt0 ai 26",
28 "encoded": h'1a0000',
29 },
30 {
31 "description": "Missing the next byte for mt0 ai 26",
32 "encoded": h'1a000000',
33 },
34 {
35 "description": "Missing the next 4 bytes for mt0 ai 27",
36 "encoded": h'1b000000',
37 },
38 {
39 "description": "Invalid AI: 28",
40 "encoded": h'1c',
41 },
42 {
43 "description": "Invalid AI: 29",
44 "encoded": h'1d',
45 },
46 {
47 "description": "Invalid AI: 30",
48 "encoded": h'1e',
49 },
50 {
51 "description": "Invalid streaming AI: 28",
52 "encoded": h'fc',
53 },
54 {
55 "description": "Invalid streaming AI: 29",
56 "encoded": h'fd',
57 },
58 {
59 "description": "Invalid streaming AI: 30",
60 "encoded": h'fe',
61 },
62 {
63 "description": "bytes: Only 3 bytes, not 4",
64 "encoded": h'44010203',
65 },
66 {
67 "description": "bytes: Indeterminate bytestring with nothing",
68 "encoded": h'5f',
69 },
70 {
71 "description": "bytes: Indeterminate bytestring includes a non-bytes chunk",
72 "encoded": h'5f01ff',
73 },
74 {
75 "description": "utf8: Only 3 bytes, not 4",
76 "encoded": h'64494554',
77 },
78 {
79 "description": "utf8: Length 20 only has 4 bytes",
80 "encoded": h'7432303133',
81 },
82 {
83 "description": "utf8: Indeterminate string includes a non-string chunk",
84 "encoded": h'7f01ff',
85 },
86 {
87 "description": "utf8: no BREAK",
88 "encoded": h'7f657374726561646d696e',
89 },
90 {
91 "description": "utf8: invalid utf8",
92 "encoded": h'62c0ae',
93 },
94 {
95 "description": "array: missing item",
96 "encoded": h'81',
97 },
98 {
99 "description": "array: missing second item",
100 "encoded": h'8201',
101 },
102 {
103 "description": "array: nested missing item",
104 "encoded": h'8181818181',
105 },
106 {
107 "description": "array: deeply-nested missing item",
108 "encoded": h'8181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181',
109 },
110 {
111 "description": "array: invalid item",
112 "encoded": h'81FE',
113 },
114 {
115 "description": "array: indeterminate without end",
116 "encoded": h'9f',
117 },
118 {
119 "description": "array: indeterminate with an item, without end",
120 "encoded": h'9f01',
121 },
122 {
123 "description": "array: streamed containing invalid",
124 "encoded": h'9fFEff',
125 },
126 {
127 "description": "array: unexpected BREAK",
128 "encoded": h'91ff',
129 },
130 {
131 "description": "map: expected key",
132 "encoded": h'a1',
133 },
134 {
135 "description": "map: invalid key",
136 "encoded": h'a1fe01',
137 },
138 {
139 "description": "map: missing value",
140 "encoded": h'a16161',
141 },
142 {
143 "description": "map: invalid value",
144 "encoded": h'a16161fe',
145 },
146 {
147 "description": "map: 1 key expecting 2",
148 "encoded": h'a20102',
149 },
150 {
151 "description": "map: streaming no BREAK",
152 "encoded": h'bf',
153 },
154 {
155 "description": "map: streaming, odd number of items",
156 "encoded": h'bf000103ff',
157 },
158 {
159 "description": "map: streaming missing value",
160 "encoded": h'bf6161',
161 },
162 {
163 "description": "map: streaming with item, missing BREAK",
164 "encoded": h'bf616101',
165 },
166 {
167 "description": "map: streaming with invalid key",
168 "encoded": h'bfFE01',
169 },
170 {
171 "description": "map: streaming with invalid value",
172 "encoded": h'bf01FE',
173 },
174 {
175 "description": "map: unexpected BREAK in key",
176 "encoded": h'a1ff',
177 },
178 {
179 "description": "map: unexpected BREAK in value",
180 "encoded": h'a100ff',
181 },
182 {
183 "description": "unexpected BREAK",
184 "encoded": h'ff',
185 },
186 {
187 "description": "date: unexpected object instead of offset",
188 "encoded": h'c1a1616100',
189 },
190 {
191 "description": "date: unexpected object instead of string",
192 "encoded": h'c0a1616100',
193 },
194
195
196 ],
197}
198