xref: /freebsd/contrib/libcbor/test/cbor_stream_decode_test.c (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
1 /*
2  * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
3  *
4  * libcbor is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7 
8 #include <setjmp.h>
9 #include <stdarg.h>
10 #include <stddef.h>
11 
12 #include <cmocka.h>
13 
14 #include "assertions.h"
15 #include "cbor.h"
16 #include "stream_expectations.h"
17 
18 static void test_no_data(void **state) {
19   assert_decoder_result_nedata(1, decode(NULL, 0));
20 }
21 
22 unsigned char embedded_uint8_data[] = {0x00, 0x01, 0x05, 0x17};
23 static void test_uint8_embedded_decoding(void **state) {
24   assert_uint8_eq(0);
25   assert_decoder_result(1, CBOR_DECODER_FINISHED,
26                         decode(embedded_uint8_data, 1));
27 
28   assert_uint8_eq(1);
29   assert_decoder_result(1, CBOR_DECODER_FINISHED,
30                         decode(embedded_uint8_data + 1, 1));
31 
32   assert_uint8_eq(5);
33   assert_decoder_result(1, CBOR_DECODER_FINISHED,
34                         decode(embedded_uint8_data + 2, 1));
35 
36   assert_uint8_eq(23);
37   assert_decoder_result(1, CBOR_DECODER_FINISHED,
38                         decode(embedded_uint8_data + 3, 1));
39 }
40 
41 unsigned char uint8_data[] = {0x18, 0x83, 0x18, 0xFF};
42 static void test_uint8_decoding(void **state) {
43   assert_uint8_eq(0x83);
44   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(uint8_data, 2));
45 
46   assert_uint8_eq(0xFF);
47   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(uint8_data + 2, 2));
48 
49   assert_minimum_input_size(2, uint8_data);
50 }
51 
52 unsigned char uint16_data[] = {0x19, 0x01, 0xf4};
53 static void test_uint16_decoding(void **state) {
54   assert_uint16_eq(500);
55   assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(uint16_data, 3));
56 
57   assert_minimum_input_size(3, uint16_data);
58 }
59 
60 unsigned char uint32_data[] = {0x1a, 0xa5, 0xf7, 0x02, 0xb3};
61 static void test_uint32_decoding(void **state) {
62   assert_uint32_eq((uint32_t)2784428723UL);
63   assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(uint32_data, 5));
64 
65   assert_minimum_input_size(5, uint32_data);
66 }
67 
68 unsigned char uint64_data[] = {0x1b, 0xa5, 0xf7, 0x02, 0xb3,
69                                0xa5, 0xf7, 0x02, 0xb3};
70 static void test_uint64_decoding(void **state) {
71   assert_uint64_eq(11959030306112471731ULL);
72   assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(uint64_data, 9));
73 
74   assert_minimum_input_size(9, uint64_data);
75 }
76 
77 unsigned char embedded_negint8_data[] = {0x20, 0x21, 0x25, 0x37};
78 static void test_negint8_embedded_decoding(void **state) {
79   assert_negint8_eq(0);
80   assert_decoder_result(1, CBOR_DECODER_FINISHED,
81                         decode(embedded_negint8_data, 1));
82 
83   assert_negint8_eq(1);
84   assert_decoder_result(1, CBOR_DECODER_FINISHED,
85                         decode(embedded_negint8_data + 1, 1));
86 
87   assert_negint8_eq(5);
88   assert_decoder_result(1, CBOR_DECODER_FINISHED,
89                         decode(embedded_negint8_data + 2, 1));
90 
91   assert_negint8_eq(23);
92   assert_decoder_result(1, CBOR_DECODER_FINISHED,
93                         decode(embedded_negint8_data + 3, 1));
94 }
95 
96 unsigned char negint8_data[] = {0x38, 0x83, 0x38, 0xFF};
97 static void test_negint8_decoding(void **state) {
98   assert_negint8_eq(0x83);
99   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(negint8_data, 2));
100 
101   assert_negint8_eq(0xFF);
102   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(negint8_data + 2, 2));
103 
104   assert_minimum_input_size(2, negint8_data);
105 }
106 
107 unsigned char negint16_data[] = {0x39, 0x01, 0xf4};
108 static void test_negint16_decoding(void **state) {
109   assert_negint16_eq(500);
110   assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(negint16_data, 3));
111 
112   assert_minimum_input_size(3, negint16_data);
113 }
114 
115 unsigned char negint32_data[] = {0x3a, 0xa5, 0xf7, 0x02, 0xb3};
116 static void test_negint32_decoding(void **state) {
117   assert_negint32_eq((uint32_t)2784428723UL);
118   assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(negint32_data, 5));
119 
120   assert_minimum_input_size(5, negint32_data);
121 }
122 
123 unsigned char negint64_data[] = {0x3b, 0xa5, 0xf7, 0x02, 0xb3,
124                                  0xa5, 0xf7, 0x02, 0xb3};
125 static void test_negint64_decoding(void **state) {
126   assert_negint64_eq(11959030306112471731ULL);
127   assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(negint64_data, 9));
128 
129   assert_minimum_input_size(9, negint64_data);
130 }
131 
132 unsigned char bstring_embedded_int8_data[] = {0x41, 0xFF};
133 static void test_bstring_embedded_int8_decoding(void **state) {
134   assert_bstring_mem_eq(bstring_embedded_int8_data + 1, 1);
135   assert_decoder_result(2, CBOR_DECODER_FINISHED,
136                         decode(bstring_embedded_int8_data, 2));
137 
138   assert_minimum_input_size(2, bstring_embedded_int8_data);
139 }
140 
141 // TODO: Add tests with actual bstring/string chunks
142 
143 unsigned char bstring_int8_data[] = {0x58, 0x00};
144 static void test_bstring_int8_decoding(void **state) {
145   assert_bstring_mem_eq(bstring_int8_data + 2, 0);
146   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(bstring_int8_data, 2));
147 
148   assert_minimum_input_size(2, bstring_int8_data);
149 }
150 
151 unsigned char bstring_int16_data[] = {0x59, 0x01, 0x5C /*, [348 bytes] */};
152 static void test_bstring_int16_decoding(void **state) {
153   assert_bstring_mem_eq(bstring_int16_data + 3, 348);
154   assert_decoder_result(3 + 348, CBOR_DECODER_FINISHED,
155                         decode(bstring_int16_data, 3 + 348));
156 
157   assert_minimum_input_size(3, bstring_int16_data);
158   assert_decoder_result_nedata(3 + 348, decode(bstring_int16_data, 3));
159 }
160 
161 unsigned char bstring_int32_data[] = {0x5A, 0x00, 0x10, 0x10,
162                                       0x10 /*, [1052688 bytes] */};
163 static void test_bstring_int32_decoding(void **state) {
164   assert_bstring_mem_eq(bstring_int32_data + 5, 1052688);
165   assert_decoder_result(5 + 1052688, CBOR_DECODER_FINISHED,
166                         decode(bstring_int32_data, 5 + 1052688));
167 
168   assert_minimum_input_size(5, bstring_int32_data);
169   assert_decoder_result_nedata(5 + 1052688, decode(bstring_int32_data, 5));
170 }
171 
172 #ifdef EIGHT_BYTE_SIZE_T
173 unsigned char bstring_int64_data[] = {
174     0x5B, 0x00, 0x00, 0x00, 0x01,
175     0x00, 0x00, 0x00, 0x00 /*, [4294967296 bytes] */};
176 static void test_bstring_int64_decoding(void **state) {
177   assert_bstring_mem_eq(bstring_int64_data + 9, 4294967296);
178   assert_decoder_result(9 + 4294967296, CBOR_DECODER_FINISHED,
179                         decode(bstring_int64_data, 9 + 4294967296));
180 
181   assert_minimum_input_size(9, bstring_int64_data);
182   assert_decoder_result_nedata(9 + 4294967296, decode(bstring_int64_data, 9));
183 }
184 #endif
185 
186 unsigned char bstring_indef_1_data[] = {0x5F, 0x40 /* Empty byte string */,
187                                         0xFF};
188 static void test_bstring_indef_decoding_1(void **state) {
189   assert_bstring_indef_start();
190   assert_decoder_result(1, CBOR_DECODER_FINISHED,
191                         decode(bstring_indef_1_data, 3));
192 
193   assert_bstring_mem_eq(bstring_indef_1_data + 2, 0);
194   assert_decoder_result(1, CBOR_DECODER_FINISHED,
195                         decode(bstring_indef_1_data + 1, 2));
196 
197   assert_indef_break();
198   assert_decoder_result(1, CBOR_DECODER_FINISHED,
199                         decode(bstring_indef_1_data + 2, 1));
200 }
201 
202 unsigned char bstring_indef_2_data[] = {0x5F, 0xFF};
203 static void test_bstring_indef_decoding_2(void **state) {
204   assert_bstring_indef_start();
205   assert_decoder_result(1, CBOR_DECODER_FINISHED,
206                         decode(bstring_indef_2_data, 2));
207 
208   assert_indef_break();
209   assert_decoder_result(1, CBOR_DECODER_FINISHED,
210                         decode(bstring_indef_2_data + 1, 1));
211 }
212 
213 // TODO: Comment formatting seems weird
214 unsigned char bstring_indef_3_data[] = {
215     0x5F, 0x40 /* Empty byte string */,      0x58,
216     0x01, 0xFF /* 1B 1 char bytes string */, 0xFF};
217 static void test_bstring_indef_decoding_3(void **state) {
218   assert_bstring_indef_start();
219   assert_decoder_result(1, CBOR_DECODER_FINISHED,
220                         decode(bstring_indef_3_data, 6));
221 
222   assert_bstring_mem_eq(bstring_indef_3_data + 2, 0);
223   assert_decoder_result(1, CBOR_DECODER_FINISHED,
224                         decode(bstring_indef_3_data + 1, 5));
225 
226   assert_bstring_mem_eq(bstring_indef_3_data + 4, 1);
227   assert_decoder_result(3, CBOR_DECODER_FINISHED,
228                         decode(bstring_indef_3_data + 2, 4));
229 
230   assert_indef_break();
231   assert_decoder_result(1, CBOR_DECODER_FINISHED,
232                         decode(bstring_indef_3_data + 5, 1));
233 }
234 
235 unsigned char array_embedded_int8_data[] = {0x80};
236 static void test_array_embedded_int8_decoding(void **state) {
237   assert_array_start(0);
238   assert_decoder_result(1, CBOR_DECODER_FINISHED,
239                         decode(array_embedded_int8_data, 1));
240 }
241 
242 unsigned char array_int8_data[] = {0x98, 0x02, 0x00, 0x01};
243 static void test_array_int8_decoding(void **state) {
244   assert_array_start(2);
245   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(array_int8_data, 4));
246 
247   assert_uint8_eq(0);
248   assert_decoder_result(1, CBOR_DECODER_FINISHED,
249                         decode(array_int8_data + 2, 2));
250 
251   assert_uint8_eq(1);
252   assert_decoder_result(1, CBOR_DECODER_FINISHED,
253                         decode(array_int8_data + 3, 1));
254 
255   assert_minimum_input_size(2, array_int8_data);
256 }
257 
258 unsigned char array_int16_data[] = {0x99, 0x00, 0x02, 0x00, 0x01};
259 static void test_array_int16_decoding(void **state) {
260   assert_array_start(2);
261   assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(array_int16_data, 5));
262 
263   assert_uint8_eq(0);
264   assert_decoder_result(1, CBOR_DECODER_FINISHED,
265                         decode(array_int16_data + 3, 2));
266 
267   assert_uint8_eq(1);
268   assert_decoder_result(1, CBOR_DECODER_FINISHED,
269                         decode(array_int16_data + 4, 1));
270 
271   assert_minimum_input_size(3, array_int16_data);
272 }
273 
274 unsigned char array_int32_data[] = {0x9A, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01};
275 static void test_array_int32_decoding(void **state) {
276   assert_array_start(2);
277   assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(array_int32_data, 7));
278 
279   assert_uint8_eq(0);
280   assert_decoder_result(1, CBOR_DECODER_FINISHED,
281                         decode(array_int32_data + 5, 2));
282 
283   assert_uint8_eq(1);
284   assert_decoder_result(1, CBOR_DECODER_FINISHED,
285                         decode(array_int32_data + 6, 1));
286 
287   assert_minimum_input_size(5, array_int32_data);
288 }
289 
290 unsigned char array_int64_data[] = {0x9B, 0x00, 0x00, 0x00, 0x00, 0x00,
291                                     0x00, 0x00, 0x02, 0x00, 0x01};
292 static void test_array_int64_decoding(void **state) {
293   assert_array_start(2);
294   assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(array_int64_data, 11));
295 
296   assert_uint8_eq(0);
297   assert_decoder_result(1, CBOR_DECODER_FINISHED,
298                         decode(array_int64_data + 9, 2));
299 
300   assert_uint8_eq(1);
301   assert_decoder_result(1, CBOR_DECODER_FINISHED,
302                         decode(array_int64_data + 10, 1));
303 
304   assert_minimum_input_size(9, array_int64_data);
305 }
306 
307 unsigned char array_of_arrays_data[] = {0x82, 0x80, 0x80};
308 static void test_array_of_arrays_decoding(void **state) {
309   assert_array_start(2);
310   assert_decoder_result(1, CBOR_DECODER_FINISHED,
311                         decode(array_of_arrays_data, 3));
312 
313   assert_array_start(0);
314   assert_decoder_result(1, CBOR_DECODER_FINISHED,
315                         decode(array_of_arrays_data + 1, 2));
316 
317   assert_array_start(0);
318   assert_decoder_result(1, CBOR_DECODER_FINISHED,
319                         decode(array_of_arrays_data + 2, 1));
320 }
321 
322 unsigned char indef_array_data_1[] = {0x9F, 0x00, 0x18, 0xFF, 0x9F, 0xFF, 0xFF};
323 static void test_indef_array_decoding_1(void **state) {
324   assert_indef_array_start();
325   assert_decoder_result(1, CBOR_DECODER_FINISHED,
326                         decode(indef_array_data_1, 7));
327 
328   assert_uint8_eq(0);
329   assert_decoder_result(1, CBOR_DECODER_FINISHED,
330                         decode(indef_array_data_1 + 1, 6));
331 
332   assert_uint8_eq(255);
333   assert_decoder_result(2, CBOR_DECODER_FINISHED,
334                         decode(indef_array_data_1 + 2, 4));
335 
336   assert_indef_array_start();
337   assert_decoder_result(1, CBOR_DECODER_FINISHED,
338                         decode(indef_array_data_1 + 4, 3));
339 
340   assert_indef_break();
341   assert_decoder_result(1, CBOR_DECODER_FINISHED,
342                         decode(indef_array_data_1 + 5, 2));
343 
344   assert_indef_break();
345   assert_decoder_result(1, CBOR_DECODER_FINISHED,
346                         decode(indef_array_data_1 + 6, 1));
347 }
348 
349 unsigned char map_embedded_int8_data[] = {0xa1, 0x01, 0x00};
350 static void test_map_embedded_int8_decoding(void **state) {
351   assert_map_start(1);
352   assert_decoder_result(1, CBOR_DECODER_FINISHED,
353                         decode(map_embedded_int8_data, 3));
354 
355   assert_uint8_eq(1);
356   assert_decoder_result(1, CBOR_DECODER_FINISHED,
357                         decode(map_embedded_int8_data + 1, 2));
358 
359   assert_uint8_eq(0);
360   assert_decoder_result(1, CBOR_DECODER_FINISHED,
361                         decode(map_embedded_int8_data + 2, 1));
362 }
363 
364 unsigned char map_int8_data[] = {0xB8, 0x01, 0x00, 0x01};
365 static void test_map_int8_decoding(void **state) {
366   assert_map_start(1);
367   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(map_int8_data, 4));
368 
369   assert_uint8_eq(0);
370   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(map_int8_data + 2, 2));
371 
372   assert_uint8_eq(1);
373   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(map_int8_data + 3, 1));
374 
375   assert_minimum_input_size(2, map_int8_data);
376 }
377 
378 unsigned char map_int16_data[] = {0xB9, 0x00, 0x01, 0x00, 0x01};
379 static void test_map_int16_decoding(void **state) {
380   assert_map_start(1);
381   assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(map_int16_data, 5));
382 
383   assert_uint8_eq(0);
384   assert_decoder_result(1, CBOR_DECODER_FINISHED,
385                         decode(map_int16_data + 3, 2));
386 
387   assert_uint8_eq(1);
388   assert_decoder_result(1, CBOR_DECODER_FINISHED,
389                         decode(map_int16_data + 4, 1));
390 
391   assert_minimum_input_size(3, map_int16_data);
392 }
393 
394 unsigned char map_int32_data[] = {0xBA, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01};
395 static void test_map_int32_decoding(void **state) {
396   assert_map_start(1);
397   assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(map_int32_data, 7));
398 
399   assert_uint8_eq(0);
400   assert_decoder_result(1, CBOR_DECODER_FINISHED,
401                         decode(map_int32_data + 5, 2));
402 
403   assert_uint8_eq(1);
404   assert_decoder_result(1, CBOR_DECODER_FINISHED,
405                         decode(map_int32_data + 6, 1));
406 
407   assert_minimum_input_size(5, map_int32_data);
408 }
409 
410 unsigned char map_int64_data[] = {0xBB, 0x00, 0x00, 0x00, 0x00, 0x00,
411                                   0x00, 0x00, 0x01, 0x00, 0x01};
412 static void test_map_int64_decoding(void **state) {
413   assert_map_start(1);
414   assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(map_int64_data, 11));
415 
416   assert_uint8_eq(0);
417   assert_decoder_result(1, CBOR_DECODER_FINISHED,
418                         decode(map_int64_data + 9, 2));
419 
420   assert_uint8_eq(1);
421   assert_decoder_result(1, CBOR_DECODER_FINISHED,
422                         decode(map_int64_data + 10, 1));
423 
424   assert_minimum_input_size(9, map_int64_data);
425 }
426 
427 unsigned char indef_map_data_1[] = {0xBF, 0x00, 0x18, 0xFF, 0xFF};
428 static void test_indef_map_decoding_1(void **state) {
429   assert_indef_map_start();
430   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(indef_map_data_1, 5));
431 
432   assert_uint8_eq(0);
433   assert_decoder_result(1, CBOR_DECODER_FINISHED,
434                         decode(indef_map_data_1 + 1, 4));
435 
436   assert_uint8_eq(255);
437   assert_decoder_result(2, CBOR_DECODER_FINISHED,
438                         decode(indef_map_data_1 + 2, 3));
439 
440   assert_indef_break();
441   assert_decoder_result(1, CBOR_DECODER_FINISHED,
442                         decode(indef_map_data_1 + 4, 1));
443 }
444 
445 unsigned char embedded_tag_data[] = {0xC1};
446 static void test_embedded_tag_decoding(void **state) {
447   assert_tag_eq(1);
448   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(embedded_tag_data, 1));
449 }
450 
451 unsigned char int8_tag_data[] = {0xD8, 0xFE};
452 static void test_int8_tag_decoding(void **state) {
453   assert_tag_eq(254);
454   assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(int8_tag_data, 2));
455 
456   assert_minimum_input_size(2, int8_tag_data);
457 }
458 
459 unsigned char int16_tag_data[] = {0xD9, 0xFE, 0xFD};
460 static void test_int16_tag_decoding(void **state) {
461   assert_tag_eq(65277);
462   assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(int16_tag_data, 3));
463 
464   assert_minimum_input_size(3, int16_tag_data);
465 }
466 
467 unsigned char int32_tag_data[] = {0xDA, 0xFE, 0xFD, 0xFC, 0xFB};
468 static void test_int32_tag_decoding(void **state) {
469   assert_tag_eq(4278058235ULL);
470   assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(int32_tag_data, 5));
471 
472   assert_minimum_input_size(5, int32_tag_data);
473 }
474 
475 unsigned char int64_tag_data[] = {0xDB, 0xFE, 0xFD, 0xFC, 0xFB,
476                                   0xFA, 0xF9, 0xF8, 0xF7};
477 static void test_int64_tag_decoding(void **state) {
478   assert_tag_eq(18374120213919168759ULL);
479   assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(int64_tag_data, 9));
480 
481   assert_minimum_input_size(9, int64_tag_data);
482 }
483 
484 unsigned char bad_tag_data[] = {0xC6};
485 static void test_bad_tag_decoding(void **state) {
486   assert_decoder_result(0, CBOR_DECODER_ERROR, decode(bad_tag_data, 1));
487 }
488 
489 unsigned char float2_data[] = {0xF9, 0x7B, 0xFF};
490 static void test_float2_decoding(void **state) {
491   assert_half(65504.0f);
492   assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(float2_data, 3));
493 
494   assert_minimum_input_size(3, float2_data);
495 }
496 
497 unsigned char float4_data[] = {0xFA, 0x47, 0xC3, 0x50, 0x00};
498 static void test_float4_decoding(void **state) {
499   assert_float(100000.0f);
500   assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(float4_data, 5));
501 
502   assert_minimum_input_size(5, float4_data);
503 }
504 
505 unsigned char float8_data[] = {0xFB, 0xC0, 0x10, 0x66, 0x66,
506                                0x66, 0x66, 0x66, 0x66};
507 static void test_float8_decoding(void **state) {
508   assert_double(-4.1);
509   assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(float8_data, 9));
510 
511   assert_minimum_input_size(0, float8_data);
512 }
513 
514 unsigned char false_data[] = {0xF4};
515 static void test_false_decoding(void **state) {
516   assert_bool(false);
517   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(false_data, 1));
518 }
519 
520 unsigned char true_data[] = {0xF5};
521 static void test_true_decoding(void **state) {
522   assert_bool(true);
523   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(true_data, 1));
524 }
525 
526 unsigned char null_data[] = {0xF6};
527 static void test_null_decoding(void **state) {
528   assert_nil();
529   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(null_data, 1));
530 }
531 
532 unsigned char undef_data[] = {0xF7};
533 static void test_undef_decoding(void **state) {
534   assert_undef();
535   assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(undef_data, 1));
536 }
537 
538 #define stream_test(f) cmocka_unit_test_teardown(f, clear_stream_assertions)
539 
540 int main(void) {
541   set_decoder(&cbor_stream_decode);
542   const struct CMUnitTest tests[] = {
543       stream_test(test_no_data),
544 
545       stream_test(test_uint8_embedded_decoding),
546       stream_test(test_uint8_decoding),
547       stream_test(test_uint16_decoding),
548       stream_test(test_uint32_decoding),
549       stream_test(test_uint64_decoding),
550 
551       stream_test(test_negint8_embedded_decoding),
552       stream_test(test_negint8_decoding),
553       stream_test(test_negint16_decoding),
554       stream_test(test_negint32_decoding),
555       stream_test(test_negint64_decoding),
556 
557       stream_test(test_bstring_embedded_int8_decoding),
558       stream_test(test_bstring_int8_decoding),
559       stream_test(test_bstring_int16_decoding),
560       stream_test(test_bstring_int32_decoding),
561 #ifdef EIGHT_BYTE_SIZE_T
562       stream_test(test_bstring_int64_decoding),
563 #endif
564       stream_test(test_bstring_indef_decoding_1),
565       stream_test(test_bstring_indef_decoding_2),
566       stream_test(test_bstring_indef_decoding_3),
567 
568       stream_test(test_array_embedded_int8_decoding),
569       stream_test(test_array_int8_decoding),
570       stream_test(test_array_int16_decoding),
571       stream_test(test_array_int32_decoding),
572       stream_test(test_array_int64_decoding),
573       stream_test(test_array_of_arrays_decoding),
574       stream_test(test_indef_array_decoding_1),
575 
576       stream_test(test_map_embedded_int8_decoding),
577       stream_test(test_map_int8_decoding),
578       stream_test(test_map_int16_decoding),
579       stream_test(test_map_int32_decoding),
580       stream_test(test_map_int64_decoding),
581       stream_test(test_indef_map_decoding_1),
582 
583       stream_test(test_embedded_tag_decoding),
584       stream_test(test_int8_tag_decoding),
585       stream_test(test_int16_tag_decoding),
586       stream_test(test_int32_tag_decoding),
587       stream_test(test_int64_tag_decoding),
588       stream_test(test_bad_tag_decoding),
589 
590       stream_test(test_float2_decoding),
591       stream_test(test_float4_decoding),
592       stream_test(test_float8_decoding),
593 
594       stream_test(test_false_decoding),
595       stream_test(test_true_decoding),
596       stream_test(test_null_decoding),
597       stream_test(test_undef_decoding)};
598   return cmocka_run_group_tests(tests, NULL, NULL);
599 }
600