make sure all decode test input is static const
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index f78ee8d..fbc292f 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -62,6 +62,57 @@
}
#endif /* PRINT_FUNCTIONS_FOR_DEBUGGING */
+/*
+ [
+ -9223372036854775808,
+ -4294967297,
+ -4294967296,
+ -4294967295,
+ -4294967294,
+ -2147483648,
+ -2147483647,
+ -65538,
+ -65537,
+ -65536,
+ -65535,
+ -65534,
+ -257,
+ -256,
+ -255,
+ -254,
+ -25,
+ -24,
+ -23,
+ -1,
+ 0,
+ 0,
+ 1,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 254,
+ 255,
+ 256,
+ 257,
+ 65534,
+ 65535,
+ 65536,
+ 65537,
+ 65538,
+ 2147483647,
+ 2147483647,
+ 2147483648,
+ 2147483649,
+ 4294967294,
+ 4294967295,
+ 4294967296,
+ 4294967297,
+ 9223372036854775807,
+ 18446744073709551615
+ ]
+ */
static const uint8_t spExpectedEncodedInts[] = {
0x98, 0x2f, 0x3b, 0x7f, 0xff, 0xff, 0xff, 0xff,
@@ -419,8 +470,10 @@
}
-// One less than the smallest negative integer allowed in C. Decoding
-// this should fail.
+/* One less than the smallest negative integer allowed in C. Decoding
+ this should fail.
+ -9223372036854775809
+ */
static const uint8_t spTooSmallNegative[] = {
0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
@@ -514,56 +567,64 @@
Some basic CBOR with map and array used in a lot of tests.
The map labels are all strings
- {"first integer": 42,
- "an array of two strings": [
- "string1", "string2"
- ],
- "map in a map": {
- "bytes 1": h'78787878',
- "bytes 2": h'79797979',
- "another int": 98,
- "text 2": "lies, damn lies and statistics"
+ {
+ "first integer": 42,
+ "an array of two strings": [
+ "string1", "string2"
+ ],
+ "map in a map": {
+ "bytes 1": h'78787878',
+ "bytes 2": h'79797979',
+ "another int": 98,
+ "text 2": "lies, damn lies and statistics"
+ }
}
- }
*/
static const uint8_t pValidMapEncoded[] = {
- 0xa3, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x69, 0x6e,
- 0x74, 0x65, 0x67, 0x65, 0x72, 0x18, 0x2a, 0x77, 0x61, 0x6e,
- 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x6f, 0x66, 0x20,
- 0x74, 0x77, 0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
- 0x73, 0x82, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x31,
- 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x32, 0x6c, 0x6d,
- 0x61, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61,
- 0x70, 0xa4, 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x31,
- 0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62, 0x79, 0x74, 0x65,
- 0x73, 0x20, 0x32, 0x44, 0x79, 0x79, 0x79, 0x79, 0x6b, 0x61,
- 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74,
- 0x18, 0x62, 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32, 0x78,
- 0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x64, 0x61, 0x6d,
- 0x6e, 0x20, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64,
- 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63,
- 0x73 };
+ 0xa3, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20,
+ 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x18,
+ 0x2a, 0x77, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72,
+ 0x61, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x77,
+ 0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x73, 0x82, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x31, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x32, 0x6c, 0x6d, 0x61, 0x70, 0x20, 0x69,
+ 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x70, 0xa4,
+ 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x31,
+ 0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62, 0x79,
+ 0x74, 0x65, 0x73, 0x20, 0x32, 0x44, 0x79, 0x79,
+ 0x79, 0x79, 0x6b, 0x61, 0x6e, 0x6f, 0x74, 0x68,
+ 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74, 0x18, 0x62,
+ 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32, 0x78,
+ 0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x64,
+ 0x61, 0x6d, 0x6e, 0x20, 0x6c, 0x69, 0x65, 0x73,
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x61,
+ 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73 };
#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
// Same as above, but with indefinite lengths.
static const uint8_t pValidMapIndefEncoded[] = {
-0xbf, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x69, 0x6e,
-0x74, 0x65, 0x67, 0x65, 0x72, 0x18, 0x2a, 0x77, 0x61, 0x6e,
-0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x6f, 0x66, 0x20,
-0x74, 0x77, 0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
-0x73, 0x9f, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x31,
-0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x32, 0xff, 0x6c, 0x6d,
-0x61, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61,
-0x70, 0xbf, 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x31,
-0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62, 0x79, 0x74, 0x65,
-0x73, 0x20, 0x32, 0x44, 0x79, 0x79, 0x79, 0x79, 0x6b, 0x61,
-0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74,
-0x18, 0x62, 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32, 0x78,
-0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x64, 0x61, 0x6d,
-0x6e, 0x20, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64,
-0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63,
-0x73, 0xff, 0xff};
+ 0xbf, 0x6d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20,
+ 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x18,
+ 0x2a, 0x77, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72,
+ 0x61, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x77,
+ 0x6f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x73, 0x9f, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x31, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x32, 0xff, 0x6c, 0x6d, 0x61, 0x70, 0x20,
+ 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x70,
+ 0xbf, 0x67, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20,
+ 0x31, 0x44, 0x78, 0x78, 0x78, 0x78, 0x67, 0x62,
+ 0x79, 0x74, 0x65, 0x73, 0x20, 0x32, 0x44, 0x79,
+ 0x79, 0x79, 0x79, 0x6b, 0x61, 0x6e, 0x6f, 0x74,
+ 0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x74, 0x18,
+ 0x62, 0x66, 0x74, 0x65, 0x78, 0x74, 0x20, 0x32,
+ 0x78, 0x1e, 0x6c, 0x69, 0x65, 0x73, 0x2c, 0x20,
+ 0x64, 0x61, 0x6d, 0x6e, 0x20, 0x6c, 0x69, 0x65,
+ 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74,
+ 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73,
+ 0xff, 0xff};
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
@@ -677,12 +738,13 @@
]
]
*/
-static uint8_t sEmpties[] = {0x83, 0x00, 0x80, 0x84, 0x80, 0x81, 0x00, 0xa0,
- 0xa3, 0x01, 0xa0, 0x02, 0xa0, 0x03, 0x80};
+static uint8_t sEmpties[] = {
+ 0x83, 0x00, 0x80, 0x84, 0x80, 0x81, 0x00, 0xa0,
+ 0xa3, 0x01, 0xa0, 0x02, 0xa0, 0x03, 0x80};
#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
/* Same as above, but with indefinte lengths */
-static uint8_t sEmptiesIndef[] = {
+static const uint8_t sEmptiesIndef[] = {
0x9F,
0x00,
0x9F,
@@ -856,9 +918,10 @@
return 0;
}
-
-static uint8_t spDeepArrays[] = {0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
- 0x81, 0x81, 0x81, 0x80};
+/* [[[[[[[[[[]]]]]]]]]] */
+static const uint8_t spDeepArrays[] = {
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x80};
int32_t ParseDeepArrayTest()
{
@@ -884,11 +947,14 @@
return(nReturn);
}
-// Big enough to test nesting to the depth of 24
-static uint8_t spTooDeepArrays[] = {0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
- 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
- 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
- 0x81, 0x81, 0x81, 0x80};
+/* Big enough to test nesting to the depth of 24
+ [[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]
+ */
+static const uint8_t spTooDeepArrays[] = {
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x80};
int32_t ParseTooDeepArrayTest()
{
@@ -1557,9 +1623,11 @@
}
-static uint8_t spSimpleValues[] = {0x8a, 0xf4, 0xf5, 0xf6, 0xf7, 0xff,
- 0xe0, 0xf3, 0xf8, 0x00, 0xf8, 0x13,
- 0xf8, 0x1f, 0xf8, 0x20, 0xf8, 0xff};
+/* The simple-values including some not well formed */
+static const uint8_t spSimpleValues[] = {
+ 0x8a, 0xf4, 0xf5, 0xf6, 0xf7, 0xff, 0xe0, 0xf3,
+ 0xf8, 0x00, 0xf8, 0x13, 0xf8, 0x1f, 0xf8, 0x20,
+ 0xf8, 0xff};
int32_t ParseSimpleTest()
{
@@ -1684,9 +1752,9 @@
};
-static int32_t ProcessFailures(struct FailInput *pFailInputs, size_t nNumFails)
+static int32_t ProcessFailures(const struct FailInput *pFailInputs, size_t nNumFails)
{
- for(struct FailInput *pF = pFailInputs; pF < pFailInputs + nNumFails; pF++) {
+ for(const struct FailInput *pF = pFailInputs; pF < pFailInputs + nNumFails; pF++) {
QCBORDecodeContext DCtx;
QCBORError uCBORError;
@@ -1730,7 +1798,7 @@
}
-struct FailInput Failures[] = {
+static const struct FailInput Failures[] = {
// Most of this is copied from not_well_formed.h. Here the error code
// returned is also checked.
@@ -2219,7 +2287,7 @@
}
-static uint8_t spDateTestInput[] = {
+static const uint8_t spDateTestInput[] = {
0xc0, // tag for string date
0x6a, '1','9','8','5','-','0','4','-','1','2', // Date string
@@ -2735,7 +2803,7 @@
// Input for one of the tagging tests
-static uint8_t spTagInput[] = {
+static const uint8_t spTagInput[] = {
0xd9, 0xd9, 0xf7, // CBOR magic number
0x81, // Array of one
0xd8, 0x04, // non-preferred serialization of tag 4, decimal fraction
@@ -2797,7 +2865,7 @@
DB 9192939495969798 # tag(10489608748473423768)
80 # array(0)
*/
-static uint8_t spEncodedLargeTag[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95,
+static const uint8_t spEncodedLargeTag[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95,
0x96, 0x97, 0x98, 0x80};
/*
@@ -2807,7 +2875,7 @@
C7 # tag(7)
80 # array(0)
*/
-static uint8_t spLotsOfTags[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
+static const uint8_t spLotsOfTags[] = {0xdb, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
0x97, 0x98, 0xd8, 0x88, 0xc6, 0xc7, 0x80};
/*
@@ -2832,7 +2900,7 @@
})
})))
*/
-static uint8_t spCSRWithTags[] = {
+static const uint8_t spCSRWithTags[] = {
0xd9, 0xd9, 0xf7, 0xd9, 0xd9, 0xf7, 0xd9, 0xd9, 0xf7, 0xa2,
0xc6, 0xc7, 0x36,
0xdb, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0xc7, 0xa2,
@@ -2869,7 +2937,7 @@
0xc8, 0x22};
-static uint8_t spSpiffyTagInput[] = {
+static const uint8_t spSpiffyTagInput[] = {
0x85, // Open array
0xc0, // tag for string date
@@ -3367,7 +3435,7 @@
-static uint8_t spBigNumInput[] = {
+static const uint8_t spBigNumInput[] = {
0x83,
0xC2, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -3381,8 +3449,10 @@
0x38, 0x3F,
0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-static uint8_t spBigNum[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+/* The expected big num */
+static const uint8_t spBigNum[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00};
int32_t BignumParseTest()
@@ -3529,7 +3599,6 @@
/*
-// cbor.me decoded output
{
-23: {
-20: {
@@ -3550,10 +3619,8 @@
-5: -3
}
}
- */
-
-
-static uint8_t spCSRInput[] = {
+*/
+static const uint8_t spCSRInput[] = {
0xa2, 0x36, 0xa2, 0x33, 0xa5, 0x31, 0x6c, 0x4f,
0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x30, 0x63, 0x53, 0x53, 0x47,
@@ -3564,6 +3631,20 @@
0x29, 0x4a, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x35, 0xa1, 0x24, 0x22};
+// Same map as above, but using indefinite lengths
+static const uint8_t spCSRInputIndefLen[] = {
+ 0xbf, 0x36, 0xbf, 0x33, 0xbf, 0x31, 0x6c, 0x4f,
+ 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x30, 0x63, 0x53, 0x53, 0x47,
+ 0x2e, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x75, 0x73,
+ 0x69, 0x6f, 0x6e, 0x2f, 0x69, 0x53, 0x61, 0x6e,
+ 0x20, 0x44, 0x69, 0x65, 0x67, 0x6f, 0x2d, 0x62,
+ 0x55, 0x53, 0xff, 0x32, 0xbf, 0x2a, 0xbf, 0x28,
+ 0x26, 0xff, 0x29, 0x4a, 0x01, 0x02, 0x03, 0x04,
+ 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0xff, 0xff,
+ 0x35, 0xbf, 0x24, 0x22, 0xff, 0xff};
+
+
int32_t NestedMapTest()
{
QCBORDecodeContext DCtx;
@@ -3604,18 +3685,6 @@
}
-// Same map as above, but using indefinite lengths
-static uint8_t spCSRInputIndefLen[] = {
- 0xbf, 0x36, 0xbf, 0x33, 0xbf, 0x31, 0x6c, 0x4f,
- 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x30, 0x63, 0x53, 0x53, 0x47,
- 0x2e, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x75, 0x73,
- 0x69, 0x6f, 0x6e, 0x2f, 0x69, 0x53, 0x61, 0x6e,
- 0x20, 0x44, 0x69, 0x65, 0x67, 0x6f, 0x2d, 0x62,
- 0x55, 0x53, 0xff, 0x32, 0xbf, 0x2a, 0xbf, 0x28,
- 0x26, 0xff, 0x29, 0x4a, 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0xff, 0xff,
- 0x35, 0xbf, 0x24, 0x22, 0xff, 0xff};
int32_t NestedMapTestIndefLen()
{
@@ -4392,9 +4461,8 @@
5([-9223372036854775807, -4759477275222530853137])
5([ 9223372036854775806, -4759477275222530853137])
5([ 9223372036854775806, 9223372036854775806])]
- ]
+ ]
*/
-
static const uint8_t spExpectedExponentsAndMantissas[] = {
0x88,
0xC4, 0x82, 0x20,
@@ -4638,7 +4706,7 @@
}
-static struct FailInput ExponentAndMantissaFailures[] = {
+static const struct FailInput ExponentAndMantissaFailures[] = {
// Exponent > INT64_MAX
{ {(uint8_t[]){0xC4, 0x82, 0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x1B, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -4802,34 +4870,39 @@
}
/*
- {
- -75008: h'05083399',
- 88: [
- ],
- 100100: {
- "sub1": {
- 10: [
- 0
- ],
- -75009: h'A46823990001',
- 100100: {
- "json": "{ \"ueid\", \"xyz\"}",
- "subsub": {
- 100002: h'141813191001'
+ {
+ -75008: h'05083399',
+ 88: [],
+ 100100: {
+ "sub1": {
+ 10: [
+ 0
+ ],
+ -75009: h'A46823990001',
+ 100100: {
+ "json": "{ \"ueid\", \"xyz\"}",
+ "subsub": {
+ 100002: h'141813191001'
+ }
+ }
}
- }
- }
+ }
}
- }
*/
static const uint8_t spNestedCBOR[] = {
-0xa3, 0x3a, 0x00, 0x01, 0x24, 0xff, 0x44, 0x05, 0x08, 0x33, 0x99, 0x18, 0x58, 0x80, 0x1a, 0x00,
-0x01, 0x87, 0x04, 0xa1, 0x64, 0x73, 0x75, 0x62, 0x31, 0xa3, 0x0a, 0x81, 0x00, 0x3a, 0x00, 0x01,
-0x25, 0x00, 0x46, 0xa4, 0x68, 0x23, 0x99, 0x00, 0x01, 0x1a, 0x00, 0x01, 0x87, 0x04, 0xa2, 0x64,
-0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x7b, 0x20, 0x22, 0x75, 0x65, 0x69, 0x64, 0x22, 0x2c, 0x20, 0x22,
-0x78, 0x79, 0x7a, 0x22, 0x7d, 0x66, 0x73, 0x75, 0x62, 0x73, 0x75, 0x62, 0xa1, 0x1a, 0x00, 0x01,
-0x86, 0xa2, 0x46, 0x14, 0x18, 0x13, 0x19, 0x10, 0x01
+ 0xa3, 0x3a, 0x00, 0x01, 0x24, 0xff, 0x44, 0x05,
+ 0x08, 0x33, 0x99, 0x18, 0x58, 0x80, 0x1a, 0x00,
+ 0x01, 0x87, 0x04, 0xa1, 0x64, 0x73, 0x75, 0x62,
+ 0x31, 0xa3, 0x0a, 0x81, 0x00, 0x3a, 0x00, 0x01,
+ 0x25, 0x00, 0x46, 0xa4, 0x68, 0x23, 0x99, 0x00,
+ 0x01, 0x1a, 0x00, 0x01, 0x87, 0x04, 0xa2, 0x64,
+ 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x7b, 0x20, 0x22,
+ 0x75, 0x65, 0x69, 0x64, 0x22, 0x2c, 0x20, 0x22,
+ 0x78, 0x79, 0x7a, 0x22, 0x7d, 0x66, 0x73, 0x75,
+ 0x62, 0x73, 0x75, 0x62, 0xa1, 0x1a, 0x00, 0x01,
+ 0x86, 0xa2, 0x46, 0x14, 0x18, 0x13, 0x19, 0x10,
+ 0x01
};
/* Get item in multi-level nesting in spNestedCBOR */
@@ -4971,11 +5044,12 @@
/*
- [23,
- 6000,
- h'67616C6163746963',
- h'686176656E20746F6B656E'
- ]
+ [
+ 23,
+ 6000,
+ h'67616C6163746963',
+ h'686176656E20746F6B656E'
+ ]
*/
static const uint8_t spSimpleArray[] = {
0x84,
@@ -4984,17 +5058,17 @@
0x48, 0x67, 0x61, 0x6C, 0x61, 0x63, 0x74, 0x69, 0x63,
0x4B, 0x68, 0x61, 0x76, 0x65, 0x6E, 0x20, 0x74, 0x6F, 0x6B, 0x65, 0x6E};
+/* [h'', {}, [], 0] */
static const uint8_t spArrayOfEmpty[] = {0x84, 0x40, 0xa0, 0x80, 0x00};
-
+/* {} */
static const uint8_t spEmptyMap[] = {0xa0};
#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
+/* {} */
static const uint8_t spEmptyInDefinteLengthMap[] = {0xbf, 0xff};
-
-
/*
{
0: [],
@@ -5013,13 +5087,13 @@
[],
[]
]
- }
+ }
*/
-
static const uint8_t spMapOfEmpty[] = {
- 0xa6, 0x00, 0x80, 0x09, 0x82, 0x80, 0x80, 0x08, 0xa3, 0x01,
- 0x80, 0x02, 0xa0, 0x03, 0x80, 0x04, 0xa0, 0x05, 0x9f, 0xff,
- 0x06, 0x9f, 0x80, 0x9f, 0xff, 0xff};
+ 0xa6, 0x00, 0x80, 0x09, 0x82, 0x80, 0x80, 0x08,
+ 0xa3, 0x01, 0x80, 0x02, 0xa0, 0x03, 0x80, 0x04,
+ 0xa0, 0x05, 0x9f, 0xff, 0x06, 0x9f, 0x80, 0x9f,
+ 0xff, 0xff};
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
@@ -5031,11 +5105,13 @@
Integer overflow
Date overflow
- {1: 224(225(226(227(4(0))))),
- 2: 1(h''),
- 3: -18446744073709551616,
- 4: 1(1.0e+300),
- 5: 0, 8: 8}
+ {
+ 1: 224(225(226(227(4(0))))),
+ 2: 1(h''),
+ 3: -18446744073709551616,
+ 4: 1(1.0e+300),
+ 5: 0, 8: 8
+ }
*/
static const uint8_t spRecoverableMapErrors[] = {
0xa7,
@@ -5048,23 +5124,23 @@
0x08, 0x08,
};
-// Bad break
+/* Bad break */
static const uint8_t spUnRecoverableMapError1[] = {
0xa2, 0xff, 0x01, 0x00, 0x02, 0x00
};
#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
-// No more items
+/* No more items */
static const uint8_t spUnRecoverableMapError2[] = {
0xbf, 0x02, 0xbf, 0xff, 0x01, 0x00, 0x02, 0x00
};
-// Hit end because string is too long
+/* Hit end because string is too long */
static const uint8_t spUnRecoverableMapError3[] = {
0xbf, 0x02, 0x69, 0x64, 0x64, 0xff
};
-// Hit end because string is too long
+/* Hit end because string is too long */
static const uint8_t spUnRecoverableMapError4[] = {
0xbf,
0x02, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
@@ -6367,6 +6443,7 @@
return Encoded;
}
+/* h'FF' */
static const uint8_t spBreakInByteString[] = {
0x41, 0xff
};
@@ -6723,10 +6800,10 @@
/*
- [
- "aaaaaaaaaa",
- {}
- ]
+ [
+ "aaaaaaaaaa",
+ {}
+ ]
*/
static const uint8_t spTooLarge1[] = {
0x9f,
@@ -6736,11 +6813,11 @@
};
/*
- [
- {
- 0: "aaaaaaaaaa"
- }
- ]
+ [
+ {
+ 0: "aaaaaaaaaa"
+ }
+ ]
*/
static const uint8_t spTooLarge2[] = {
0x9f,
@@ -6751,11 +6828,11 @@
};
/*
- h'A1006A61616161616161616161'
+ h'A1006A61616161616161616161'
- {
- 0: "aaaaaaaaaa"
- }
+ {
+ 0: "aaaaaaaaaa"
+ }
*/
static const uint8_t spTooLarge3[] = {
0x4d,