Merge from master
diff --git a/test/UsefulBuf_Tests.c b/test/UsefulBuf_Tests.c
index 0524b4d..0235466 100644
--- a/test/UsefulBuf_Tests.c
+++ b/test/UsefulBuf_Tests.c
@@ -1,35 +1,35 @@
-/*==============================================================================
- Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2024, Laurence Lundblade.
- Copyright (c) 2021, Arm Limited.
- All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors, nor the name "Laurence Lundblade" may be used to
- endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- =============================================================================*/
+/* ==========================================================================
+ * Copyright (c) 2016-2018, The Linux Foundation.
+ * Copyright (c) 2018-2024, Laurence Lundblade.
+ * Copyright (c) 2021, Arm Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors, nor the name "Laurence Lundblade" may be used to
+ * endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ========================================================================= */
#include "UsefulBuf.h"
@@ -146,13 +146,12 @@
/*
- Append test utility.
- pUOB is the buffer to append too
- num is the amount to append
- expected is the expected return code, 0 or 1
-
- returns 0 if test passed
-
+ * Append test utility.
+ * pUOB is the buffer to append too
+ * num is the amount to append
+ * expected is the expected return code, 0 or 1
+ *
+ * returns 0 if test passed
*/
static int AppendTest(UsefulOutBuf *pUOB, size_t num, int expected)
{
@@ -175,7 +174,7 @@
/*
- Same as append, but takes a position param too
+ * Same as append, but takes a position param too
*/
static int InsertTest(UsefulOutBuf *pUOB, size_t num, size_t pos, int expected)
{
@@ -196,15 +195,14 @@
/*
- Boundary conditions to test
- - around 0
- - around the buffer size
- - around MAX size_t
-
-
- Test these for the buffer size and the cursor, the insert amount, the
- append amount and the insert position
-
+ * Boundary conditions to test
+ * - around 0
+ * - around the buffer size
+ * - around MAX size_t
+ *
+ *
+ * Test these for the buffer size and the cursor, the insert amount, the
+ * append amount and the insert position
*/
const char *UOBTest_BoundaryConditionsTest(void)
@@ -280,19 +278,34 @@
if(!UsefulOutBuf_GetError(&UOB)) {
return "lengths near max size";
}
+ UsefulBufC O = UsefulOutBuf_OutUBuf(&UOB);
+ if(!UsefulBuf_IsNULLC(O)) {
+ return "OutUBuf in error should have returned NULL";
+ }
UsefulOutBuf_Init(&UOB, (UsefulBuf){NULL, 100});
if(!UsefulOutBuf_IsBufferNULL(&UOB)) {
return "NULL check failed";
}
+ UsefulOutBuf_Init(&UOB, outbuf);
+ UOB.magic = 99; // corrupt the UOB
+ O = UsefulOutBuf_OutUBuf(&UOB);
+ if(!UsefulBuf_IsNULLC(O)) {
+ return "OutUBuf on corrupted should have returned NULL";
+ }
+
+ MakeUsefulBufOnStack(Tmp, 20);
+ O = UsefulOutBuf_CopyOut(&UOB, Tmp);
+ if(!UsefulBuf_IsNULLC(O)) {
+ return "CopyOut on corrupted should have returned NULL";
+ }
+
return NULL;
}
-
-
// Test function to get size and magic number check
const char *TestBasicSanity(void)
@@ -640,6 +653,10 @@
return "Failed to find 3";
}
+ if(SIZE_MAX != UsefulBuf_FindBytes(Expected, ExpectedLonger)) {
+ return "Failed to find 4";
+ }
+
const uint8_t pB[] = {0x01, 0x02, 0x03};
UsefulBufC Boo = UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pB);
@@ -704,7 +721,7 @@
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
const float f = (float)314.15;
const double d = 2.1e10;
-#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
UsefulOutBuf_AppendUint32(&UOB, u32); // Also tests UsefulOutBuf_InsertUint64 and UsefulOutBuf_GetEndPosition
@@ -714,7 +731,7 @@
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
UsefulOutBuf_AppendFloat(&UOB, f); // Also tests UsefulOutBuf_InsertFloat
UsefulOutBuf_AppendDouble(&UOB, d); // Also tests UsefulOutBuf_InsertDouble
-#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
const UsefulBufC O = UsefulOutBuf_OutUBuf(&UOB);
if(UsefulBuf_IsNULLC(O))
@@ -755,6 +772,16 @@
}
#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+ if(UsefulInputBuf_GetUint16(&UIB) != 0) {
+ return "Didn't catch off end with GetUint16";
+ }
+ if(UsefulInputBuf_GetUint32(&UIB) !=0 ) {
+ return "Didn't catch off end with GetUint32";
+ }
+ if(UsefulInputBuf_GetUint64(&UIB) !=0 ) {
+ return "Didn't catch off end with GetUint64";
+ }
+
// Reset and go again for a few more tests
UsefulInputBuf_Init(&UIB, O);
@@ -789,7 +816,7 @@
if(UsefulInputBuf_BytesAvailable(&UIB, 12)){
return "Wrong number of bytes available II";
}
-#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
UsefulInputBuf_Seek(&UIB, 0);
@@ -830,6 +857,37 @@
return "OffsetToPointer SIZE_MAX fail";
}
+ UsefulInputBuf_Init(&UIB, Boo);
+ UIB.magic = 88;
+ size_t uUnc = UsefulInputBuf_BytesUnconsumed(&UIB);
+ if(uUnc != 0) {
+ return "Didn't detect corrupted UsefulInputBuf";
+ }
+
+ UsefulInputBuf_Init(&UIB, Boo);
+ UIB.cursor = 500;
+ uUnc = UsefulInputBuf_BytesUnconsumed(&UIB);
+ if(uUnc != 0) {
+ return "Didn't detect bad UsefulInputBuf cursor";
+ }
+
+ if(!UsefulBuf_IsNULLC(UsefulInputBuf_GetUsefulBuf(&UIB, 5000))) {
+ return "Didn't detect off-end request of UsefulInputBuf";
+ }
+
+ if(!UsefulInputBuf_GetError(&UIB)) {
+ return "UIB Error state not reported";
+ }
+
+ UsefulInputBuf_Init(&UIB, Boo);
+ if(UsefulInputBuf_GetBufferLength(&UIB) != Boo.len) {
+ return "UIB length wrong";
+ }
+ UsefulInputBuf_SetBufferLength(&UIB, 1);
+ if(UsefulInputBuf_GetBufferLength(&UIB) != 1) {
+ return "UIB SetBufferLength failed";
+ }
+
return NULL;
}
@@ -855,7 +913,7 @@
return NULL;
}
-#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
const char *UBAdvanceTest(void)
@@ -901,6 +959,34 @@
return "Advance off end didn't set error";
}
+ // Try to advance in error state
+ UsefulOutBuf_Reset(&UOB);
+ UsefulOutBuf_Advance(&UOB, 1);
+ Place = UsefulOutBuf_GetOutPlace(&UOB);
+ UsefulOutBuf_Advance(&UOB, 1000);
+ UsefulOutBuf_Advance(&UOB, 1);
+ UsefulBuf Place2;
+ Place2 = UsefulOutBuf_GetOutPlace(&UOB);
+ if(memcmp(&Place, &Place2, sizeof(Place))) {
+ return "Advance didn't noop in error state";
+ }
+
+ UsefulOutBuf_Reset(&UOB);
+ UOB.data_len = UOB.UB.len + 1; // React in and corrupt
+ UsefulOutBuf_Advance(&UOB, 1);
+ if(!UsefulOutBuf_GetError(&UOB)) {
+ return "didn't detect corrupted UOB";
+ }
+
+ UsefulOutBuf BadUOB;
+ memset(&BadUOB, 'x', sizeof(BadUOB));
+ BadUOB.err = 0;
+ UsefulOutBuf_Advance(&BadUOB, 1);
+ if(!UsefulOutBuf_GetError(&BadUOB)) {
+ return "didn't detect bad UOB";
+ }
+
+
return NULL;
}
diff --git a/test/UsefulBuf_Tests.h b/test/UsefulBuf_Tests.h
index e00aa37..c0317e8 100644
--- a/test/UsefulBuf_Tests.h
+++ b/test/UsefulBuf_Tests.h
@@ -1,35 +1,35 @@
-/*==============================================================================
- Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2023, Laurence Lundblade.
- Copyright (c) 2021, Arm Limited.
- All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors, nor the name "Laurence Lundblade" may be used to
- endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- ==============================================================================*/
+/* ==========================================================================
+ * Copyright (c) 2016-2018, The Linux Foundation.
+ * Copyright (c) 2018, Laurence Lundblade.
+ * Copyright (c) 2021, Arm Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors, nor the name "Laurence Lundblade" may be used to
+ * endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ========================================================================= */
#ifndef UsefulBuf_UsefulBuf_Tests_h
#define UsefulBuf_UsefulBuf_Tests_h
@@ -48,7 +48,7 @@
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
const char * UBUTest_CopyUtil(void);
-#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
const char * UBAdvanceTest(void);
diff --git a/test/not_well_formed_cbor.h b/test/not_well_formed_cbor.h
index e505887..5a213ef 100644
--- a/test/not_well_formed_cbor.h
+++ b/test/not_well_formed_cbor.h
@@ -159,9 +159,10 @@
{(uint8_t[]){0xa1, 0xff, 0x00}, 3},
// Array of length 1 with 2nd member value replaced by a break
{(uint8_t[]){0xa1, 0x00, 0xff}, 3},
- // Map of length 2 with 2nd member replaced by a break
- {(uint8_t[]){0xa2, 0x00, 0x00, 0xff}, 4},
-
+ // Map of length 2 with 2nd entry label replaced by a break
+ {(uint8_t[]){0xa2, 0x00, 0x00, 0xff, 0x00}, 5},
+ // Map of length 2 with 2nd entry value replaced by a break
+ {(uint8_t[]){0xa2, 0x00, 0x00, 0x00, 0xff}, 5},
// Breaks must not occur on their own out of an indefinite length
// data item
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 3108fcb..6b97768 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -1135,6 +1135,7 @@
#endif
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
/*
Decode and thoroughly check a moderately complex
set of maps. Can be run in QCBOR_DECODE_MODE_NORMAL or in
@@ -1262,7 +1263,7 @@
return 0;
}
-
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
/* This test requires indef strings, HW float and preferred float,... */
#if !defined(QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS) && \
@@ -2085,6 +2086,7 @@
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
/*
Fully or partially decode pValidMapEncoded. When
@@ -2292,7 +2294,6 @@
-
int32_t ParseMapTest(void)
{
// Parse a moderatly complex map structure very thoroughly
@@ -2320,6 +2321,7 @@
return nResult;
}
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
/* The simple-values including some not well formed */
@@ -2328,79 +2330,156 @@
0xf8, 0x00, 0xf8, 0x13, 0xf8, 0x1f, 0xf8, 0x20,
0xf8, 0xff};
-int32_t ParseSimpleTest(void)
+/* A map of good simple values, plus one well-formed integer */
+static const uint8_t spGoodSimpleValues[] = {
+ 0xa9, 0x01, 0xf4, 0x02, 0xf5, 0x03, 0xf6, 0x04, 0xf7,
+ 0x05, 0xe0, 0x06, 0xf3, 0x07, 0xf8, 0x20, 0x61, 0x40,
+ 0xf8, 0xff, 0x0f, 0x0f};
+
+int32_t SimpleValueDecodeTests(void)
{
QCBORDecodeContext DCtx;
- QCBORItem Item;
- QCBORError nCBORError;
-
+ QCBORItem Item;
+ QCBORError uErr;
QCBORDecode_Init(&DCtx,
UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spSimpleValues),
QCBOR_DECODE_MODE_NORMAL);
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_ARRAY ||
Item.val.uCount != 10)
- return -1;
+ return 1;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_FALSE)
- return -1;
+ return 2;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_TRUE)
- return -1;
+ return 3;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_NULL)
- return -1;
+ return 4;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_UNDEF)
- return -1;
+ return 5;
// A break
if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_BAD_BREAK)
- return -1;
+ return 6;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_UKNOWN_SIMPLE || Item.val.uSimple != 0)
- return -1;
+ return 7;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_UKNOWN_SIMPLE || Item.val.uSimple != 19)
- return -1;
+ return 8;
if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_BAD_TYPE_7)
- return -1;
+ return 9;
if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_BAD_TYPE_7)
- return -1;
+ return 10;
if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_BAD_TYPE_7)
- return -1;
+ return 11;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_UKNOWN_SIMPLE || Item.val.uSimple != 32)
- return -1;
+ return 12;
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return (int32_t)nCBORError;
+ if((uErr = QCBORDecode_GetNext(&DCtx, &Item)))
+ return (int32_t)uErr;
if(Item.uDataType != QCBOR_TYPE_UKNOWN_SIMPLE || Item.val.uSimple != 255)
- return -1;
+ return 13;
+
+
+ QCBORDecode_Init(&DCtx,
+ UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spGoodSimpleValues),
+ QCBOR_DECODE_MODE_NORMAL);
+
+ uint8_t uSimple;
+
+ QCBORDecode_EnterMap(&DCtx, &Item);
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != CBOR_SIMPLEV_FALSE) {
+ return 20;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != CBOR_SIMPLEV_TRUE) {
+ return 21;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != CBOR_SIMPLEV_NULL) {
+ return 22;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != CBOR_SIMPLEV_UNDEF) {
+ return 23;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != 0) {
+ return 24;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != 19) {
+ return 25;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != 32) {
+ return 26;
+ }
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != 255) {
+ return 27;
+ }
+ QCBORDecode_VGetNext(&DCtx, &Item);
+ QCBORDecode_GetSimple(&DCtx, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) != QCBOR_ERR_NO_MORE_ITEMS) {
+ return 28;
+ }
+
+ QCBORDecode_Rewind(&DCtx);
+
+ QCBORDecode_GetSimpleInMapN(&DCtx, 6, &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != 19) {
+ return 30;
+ }
+
+ QCBORDecode_GetSimpleInMapSZ(&DCtx, "@", &uSimple);
+ if(QCBORDecode_GetError(&DCtx) || uSimple != 255) {
+ return 31;
+ }
+
+ QCBORDecode_GetSimpleInMapN(&DCtx, 99, &uSimple);
+ if(QCBORDecode_GetAndResetError(&DCtx) != QCBOR_ERR_LABEL_NOT_FOUND) {
+ return 32;
+ }
+
+ QCBORDecode_GetSimpleInMapSZ(&DCtx, "xx", &uSimple);
+ if(QCBORDecode_GetAndResetError(&DCtx) != QCBOR_ERR_LABEL_NOT_FOUND) {
+ return 33;
+ }
+
+ QCBORDecode_GetSimpleInMapN(&DCtx, 15, &uSimple);
+ if(QCBORDecode_GetAndResetError(&DCtx) != QCBOR_ERR_UNEXPECTED_TYPE) {
+ return 34;
+ }
return 0;
-
}
@@ -2414,10 +2493,6 @@
const struct someBinaryBytes *pBytes = &paNotWellFormedCBOR[nIterate];
const UsefulBufC Input = (UsefulBufC){pBytes->p, pBytes->n};
- if(nIterate == 86) {
- nIterate = 86;
- }
-
// Set up decoder context. String allocator needed for indefinite
// string test cases
QCBORDecodeContext DCtx;
@@ -2844,9 +2919,14 @@
{"\xa1\x00\xff", 3},
QCBOR_ERR_BAD_BREAK
},
- { "Map of length 2 with 2nd member replaced by a break",
+ { "Map of length 2 with 2nd entry label replaced by a break",
QCBOR_DECODE_MODE_NORMAL,
- {"\xa2\x00\x00\xff", 4},
+ {"\xa2\x00\x00\xff\x00", 5},
+ QCBOR_ERR_BAD_BREAK
+ },
+ { "Map of length 2 with 2nd entry value replaced by a break",
+ QCBOR_DECODE_MODE_NORMAL,
+ {"\xa2\x00\x00\x01\xff", 5},
QCBOR_ERR_BAD_BREAK
},
@@ -4455,12 +4535,14 @@
* These are showing the big numbers converted to integers.
* The tag numbers are not shown.
*
- * [ 18446744073709551616,
- * -18446744073709551617,
- * {"BN+": 18446744073709551616,
- * 64: 18446744073709551616,
- * "BN-": -18446744073709551617,
- * -64: -18446744073709551617
+ * [
+ * 18446744073709551616,
+ * -18446744073709551617,
+ * {
+ * -64: -18446744073709551617,
+ * 64: 18446744073709551616,
+ * "BN+": 18446744073709551616,
+ * "BN-": -18446744073709551617
* }
* ]
*/
@@ -4470,14 +4552,15 @@
0xC2, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA4,
- 0x63, 0x42, 0x4E, 0x2B,
- 0xC2, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x38, 0x3F,
+ 0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x40,
0xC2, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x63, 0x42, 0x4E, 0x2D,
- 0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x38, 0x3F,
- 0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ 0x63, 0x42, 0x4E, 0x2B,
+ 0xC2, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x63, 0x42, 0x4E, 0x2D,
+ 0xC3, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
#ifndef QCBOR_DISABLE_TAGS
/* The expected big num */
@@ -4530,11 +4613,12 @@
}
if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return -9;
- if(Item.uDataType != QCBOR_TYPE_POSBIGNUM ||
- Item.uLabelType != QCBOR_TYPE_TEXT_STRING ||
+ return -15;
+ if(Item.uDataType != QCBOR_TYPE_NEGBIGNUM ||
+ Item.uLabelType != QCBOR_TYPE_INT64 ||
+ Item.label.int64 != -64 ||
UsefulBuf_Compare(Item.val.bigNum, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBigNum))){
- return -10;
+ return -16;
}
if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
@@ -4546,6 +4630,15 @@
return -12;
}
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
+ if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+ return -9;
+ if(Item.uDataType != QCBOR_TYPE_POSBIGNUM ||
+ Item.uLabelType != QCBOR_TYPE_TEXT_STRING ||
+ UsefulBuf_Compare(Item.val.bigNum, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBigNum))){
+ return -10;
+ }
+
if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
return -13;
if(Item.uDataType != QCBOR_TYPE_NEGBIGNUM ||
@@ -4554,14 +4647,9 @@
return -14;
}
- if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
- return -15;
- if(Item.uDataType != QCBOR_TYPE_NEGBIGNUM ||
- Item.uLabelType != QCBOR_TYPE_INT64 ||
- Item.label.int64 != -64 ||
- UsefulBuf_Compare(Item.val.bigNum, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBigNum))){
- return -16;
- }
+
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
+
#else
if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_TAGS_DISABLED) {
@@ -4573,7 +4661,6 @@
}
-
static int32_t CheckItemWithIntLabel(QCBORDecodeContext *pCtx,
uint8_t uDataType,
uint8_t uNestingLevel,
@@ -4587,15 +4674,13 @@
if((nCBORError = QCBORDecode_GetNext(pCtx, &Item))) return -1;
if(Item.uDataType != uDataType) return -1;
if(uNestingLevel > 0) {
- if(Item.uLabelType != QCBOR_TYPE_INT64 &&
- Item.uLabelType != QCBOR_TYPE_UINT64) {
+ if(Item.uLabelType != QCBOR_TYPE_INT64) {
return -1;
}
- if(Item.uLabelType == QCBOR_TYPE_INT64) {
- if(Item.label.int64 != nLabel) return -1;
- } else {
- if(Item.label.uint64 != (uint64_t)nLabel) return -1;
+ if(Item.label.int64 != nLabel) {
+ return -1;
}
+
}
if(Item.uNestingLevel != uNestingLevel) return -1;
if(Item.uNextNestLevel != uNextNest) return -1;
@@ -4606,7 +4691,6 @@
return 0;
}
-
// Same code checks definite and indefinite length versions of the map
static int32_t CheckCSRMaps(QCBORDecodeContext *pDC)
{
@@ -5009,6 +5093,7 @@
// missing end of string
};
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
static const uint8_t spIndefiniteLenStringLabel[] = {
0xa1, // Array of length one
0x7f, // text string marked with indefinite length
@@ -5017,6 +5102,7 @@
0xff, // ending break
0x01 // integer being labeled.
};
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
/**
Make an indefinite length string
@@ -5225,6 +5311,7 @@
return -29;
}
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
// --- label is an indefinite length string ------
QCBORDecode_Init(&DC, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spIndefiniteLenStringLabel), QCBOR_DECODE_MODE_NORMAL);
@@ -5250,6 +5337,7 @@
if(QCBORDecode_Finish(&DC)) {
return -34;
}
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
return 0;
}
@@ -5277,6 +5365,7 @@
return -2;
}
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
// Next parse, save pointers to a few strings, destroy original and
// see all is OK.
UsefulBuf_MAKE_STACK_UB(CopyOfStorage, sizeof(pValidMapEncoded) + QCBOR_DECODE_MIN_MEM_POOL_SIZE);
@@ -5308,7 +5397,9 @@
Item1.val.int64 != 42 ||
Item1.uDataAlloc != 0 ||
Item1.uLabelAlloc == 0 ||
- UsefulBufCompareToSZ(Item1.label.string, "first integer")) {
+ UsefulBufCompareToSZ(Item1.label.string, "first integer") ||
+ Item1.label.string.ptr < Pool.ptr ||
+ Item1.label.string.ptr > (const void *)((const uint8_t *)Pool.ptr + Pool.len)) {
return -4;
}
@@ -5357,6 +5448,7 @@
if(nCBORError != QCBOR_ERR_STRING_ALLOCATE) {
return -10;
}
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
return 0;
}
@@ -6731,7 +6823,6 @@
int32_t EnterMapTest(void)
{
QCBORItem Item1;
- QCBORItem ArrayItem;
QCBORDecodeContext DCtx;
int32_t nReturn;
QCBORError uErr;
@@ -6780,13 +6871,17 @@
return 3011;
}
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
(void)pValidMapIndefEncoded;
nReturn = SpiffyDecodeBasicMap(UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapIndefEncoded));
if(nReturn) {
return nReturn + 20000;
}
-#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
+#endif /* ! QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
+ QCBORItem ArrayItem;
nReturn = SpiffyDecodeBasicMap(UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapEncoded));
if(nReturn) {
@@ -6868,20 +6963,25 @@
if(QCBORDecode_GetNext(&DCtx, &Item1) != QCBOR_ERR_NO_MORE_ITEMS) {
return 2007;
}
+#endif /* !QCBOR_DISABLE_NON_INTEGER_LABELS */
QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spSimpleArray), 0);
QCBORDecode_EnterArray(&DCtx, NULL);
int64_t nDecodedInt2;
+
+ UsefulBufC String;
+ QCBORDecode_GetTextStringInMapN(&DCtx, 88, &String);
+ uErr = QCBORDecode_GetAndResetError(&DCtx);
+ if(uErr != QCBOR_ERR_MAP_NOT_ENTERED){
+ return 2009;
+ }
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
QCBORDecode_GetInt64InMapSZ(&DCtx, "another int", &nDecodedInt2);
uErr = QCBORDecode_GetAndResetError(&DCtx);
if(uErr != QCBOR_ERR_MAP_NOT_ENTERED){
return 2008;
}
- UsefulBufC String;
- QCBORDecode_GetTextStringInMapN(&DCtx, 88, &String);
- if(uErr != QCBOR_ERR_MAP_NOT_ENTERED){
- return 2009;
- }
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spEmptyMap), 0);
@@ -7002,6 +7102,7 @@
}
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapEncoded), 0);
QCBORDecode_VGetNextConsume(&DCtx, &Item1);
if(Item1.uDataType != QCBOR_TYPE_MAP) {
@@ -7050,6 +7151,7 @@
if(QCBORDecode_GetError(&DCtx)) {
return 2410;
}
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
nReturn = DecodeNestedIterate();
@@ -8611,6 +8713,7 @@
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
/*
* An array of an integer and an array. The second array contains
* a bstr-wrapped map.
@@ -8671,11 +8774,11 @@
0x73,
0xff, 0xff
};
-#endif
-
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
static const uint8_t pWithEmptyMap[] = {0x82, 0x18, 0x64, 0xa0};
+
#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
static const uint8_t pWithEmptyMapInDef[] = {0x9f, 0x18, 0x64, 0xbf, 0xff, 0xff};
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
@@ -8701,13 +8804,17 @@
};
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+#endif
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
int32_t PeekAndRewindTest(void)
{
QCBORItem Item;
QCBORError nCBORError;
QCBORDecodeContext DCtx;
+ // Improvement: rework this test to use only integer labels.
+
QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapEncoded), 0);
if((nCBORError = QCBORDecode_PeekNext(&DCtx, &Item))) {
@@ -9316,7 +9423,7 @@
}
*/
-#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
+#endif /* ! QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
// Rewind an indefnite length byte-string wrapped sequence
@@ -9324,7 +9431,7 @@
return 0;
}
-
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
static const uint8_t spBooleansInMap[] =
@@ -9704,6 +9811,7 @@
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
static const uint8_t spExpectedArray2s[] = {
0x82, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x31, 0x67, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
@@ -9753,13 +9861,13 @@
};
#endif /* !QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
-
#ifndef QCBOR_DISABLE_TAGS
/* An exp / mant tag in two nested arrays */
static const uint8_t spExpMant[] = {0x81, 0x81, 0xC4, 0x82, 0x20, 0x03};
#endif /* !QCBOR_DISABLE_TAGS */
+#endif
-
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
int32_t GetMapAndArrayTest(void)
{
QCBORDecodeContext DCtx;
@@ -9767,7 +9875,7 @@
QCBORItem Item;
UsefulBufC ReturnedEncodedCBOR;
-
+ // Improvement: rework so it can run with QCBOR_DISABLE_NON_INTEGER_LABELS
QCBORDecode_Init(&DCtx,
UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pValidMapEncoded),
0);
@@ -10024,10 +10132,11 @@
if(uPosition != QCBORDecode_Tell(&DCtx)) {
return 102;
}
-#endif /* !QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+#endif /* ! QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
return 0;
}
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
int32_t
@@ -10108,6 +10217,41 @@
return -23;
}
+ /* Test error strings */
+ const char *szErrString;
+
+ szErrString = qcbor_err_to_str(QCBOR_ERR_ARRAY_DECODE_TOO_LONG);
+ if(szErrString == NULL) {
+ return -100;
+ }
+ if(strcmp(szErrString, "QCBOR_ERR_ARRAY_DECODE_TOO_LONG")) {
+ return -101;
+ }
+
+ szErrString = qcbor_err_to_str(QCBOR_SUCCESS);
+ if(szErrString == NULL) {
+ return -102;
+ }
+ if(strcmp(szErrString, "QCBOR_SUCCESS")) {
+ return -103;
+ }
+
+ szErrString = qcbor_err_to_str(100);
+ if(szErrString == NULL) {
+ return -104;
+ }
+ if(strcmp(szErrString, "Unidentified QCBOR error")) {
+ return -105;
+ }
+
+ szErrString = qcbor_err_to_str(200);
+ if(szErrString == NULL) {
+ return -106;
+ }
+ if(strcmp(szErrString, "USER_DEFINED_200")) {
+ return -107;
+ }
+
return 0;
}
@@ -10120,6 +10264,7 @@
int nIndex;
int64_t nDecodedInt;
+ // Improvement: rewrite so this can run with only integer labels
static const uint32_t aPos[] =
{0, 1, 17, 42, 50, 58, 72, 85, 98, 112, UINT32_MAX};
QCBORDecode_Init(&DCtx,
diff --git a/test/qcbor_decode_tests.h b/test/qcbor_decode_tests.h
index e3fe1b6..4c4c0a6 100644
--- a/test/qcbor_decode_tests.h
+++ b/test/qcbor_decode_tests.h
@@ -126,7 +126,7 @@
/*
Test parsing of some simple values like true, false, null...
*/
-int32_t ParseSimpleTest(void);
+int32_t SimpleValueDecodeTests(void);
/*
diff --git a/test/run_tests.c b/test/run_tests.c
index a94aa47..e24506a 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -67,48 +67,58 @@
static test_entry s_tests[] = {
- TEST_ENTRY(ErrorHandlingTests),
- TEST_ENTRY(OpenCloseBytesTest),
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
TEST_ENTRY(GetMapAndArrayTest),
TEST_ENTRY(TellTests),
+ TEST_ENTRY(ParseMapAsArrayTest),
+ TEST_ENTRY(SpiffyDateDecodeTest),
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
+ TEST_ENTRY(ErrorHandlingTests),
+ TEST_ENTRY(OpenCloseBytesTest),
TEST_ENTRY(EnterBstrTest),
TEST_ENTRY(IntegerConvertTest),
TEST_ENTRY(EnterMapTest),
TEST_ENTRY(QCBORHeadTest),
TEST_ENTRY(EmptyMapsAndArraysTest),
TEST_ENTRY(NotWellFormedTests),
- TEST_ENTRY(ParseMapAsArrayTest),
+
#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
TEST_ENTRY(IndefiniteLengthNestTest),
TEST_ENTRY(IndefiniteLengthArrayMapTest),
TEST_ENTRY(NestedMapTestIndefLen),
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
- TEST_ENTRY(ParseSimpleTest),
+
+ TEST_ENTRY(SimpleValueDecodeTests),
TEST_ENTRY(DecodeFailureTests),
TEST_ENTRY(EncodeRawTest),
TEST_ENTRY(RTICResultsTest),
TEST_ENTRY(MapEncodeTest),
TEST_ENTRY(ArrayNestingTest1),
TEST_ENTRY(ArrayNestingTest2),
+
#ifndef QCBOR_DISABLE_ENCODE_USAGE_GUARDS
TEST_ENTRY(ArrayNestingTest3),
#endif /* QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
+
TEST_ENTRY(EncodeDateTest),
TEST_ENTRY(SimpleValuesTest1),
TEST_ENTRY(IntegerValuesTest1),
TEST_ENTRY(AllAddMethodsTest),
TEST_ENTRY(ParseTooDeepArrayTest),
TEST_ENTRY(ComprehensiveInputTest),
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
TEST_ENTRY(ParseMapTest),
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
TEST_ENTRY(BasicEncodeTest),
TEST_ENTRY(NestedMapTest),
TEST_ENTRY(BignumParseTest),
+
#ifndef QCBOR_DISABLE_TAGS
TEST_ENTRY(OptTagParseTest),
TEST_ENTRY(DateParseTest),
TEST_ENTRY(DecodeTaggedTypeTests),
#endif /* QCBOR_DISABLE_TAGS */
- TEST_ENTRY(SpiffyDateDecodeTest),
+
TEST_ENTRY(ShortBufferParseTest2),
TEST_ENTRY(ShortBufferParseTest),
TEST_ENTRY(ParseDeepArrayTest),
@@ -118,9 +128,12 @@
TEST_ENTRY(AllocAllStringsTest),
TEST_ENTRY(MemPoolTest),
TEST_ENTRY(IndefiniteLengthStringTest),
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
TEST_ENTRY(SpiffyIndefiniteLengthStringsTests),
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
TEST_ENTRY(SetUpAllocatorTest),
TEST_ENTRY(CBORTestIssue134),
+
#endif /* #ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
#ifndef USEFULBUF_DISABLE_ALL_FLOAT
#ifndef QCBOR_DISABLE_PREFERRED_FLOAT
@@ -131,19 +144,29 @@
TEST_ENTRY(GeneralFloatEncodeTests),
TEST_ENTRY(GeneralFloatDecodeTests),
#endif /* USEFULBUF_DISABLE_ALL_FLOAT */
+
TEST_ENTRY(BstrWrapTest),
TEST_ENTRY(BstrWrapErrorTest),
TEST_ENTRY(BstrWrapNestTest),
TEST_ENTRY(CoseSign1TBSTest),
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
TEST_ENTRY(StringDecoderModeFailTest),
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
TEST_ENTRY_DISABLED(BigComprehensiveInputTest),
TEST_ENTRY_DISABLED(TooLargeInputTest),
TEST_ENTRY(EncodeErrorTests),
+#ifndef QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS
TEST_ENTRY(SimpleValuesIndefiniteLengthTest1),
+#endif
TEST_ENTRY(EncodeLengthThirtyoneTest),
TEST_ENTRY(CBORSequenceDecodeTests),
TEST_ENTRY(IntToTests),
+#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
TEST_ENTRY(PeekAndRewindTest),
+#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
+
+
+
#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
TEST_ENTRY(ExponentAndMantissaDecodeTests),
#ifndef QCBOR_DISABLE_TAGS