tag typed tests; fix ordering of args for some tagged type decode functions
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 40004d0..dc4c949 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -5200,3 +5200,72 @@
return (int32_t)uErr;
}
+
+
+
+
+static const uint8_t spTaggedTypes[] = {
+ 0xa2,
+ 0x00, 0xc0, 0x61, 0x50,
+ 0x01, 0x61, 0x50,
+
+
+
+
+};
+
+int32_t DecodeTaggedTypeTests()
+{
+ QCBORDecodeContext DC;
+ QCBORError uErr;
+
+ QCBORDecode_Init(&DC, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spTaggedTypes), 0);
+
+ UsefulBufC String;
+ //bool bNeg;
+
+ QCBORDecode_EnterMap(&DC);
+ QCBORDecode_GetDateStringInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 0, &String);
+ QCBORDecode_GetDateStringInMapN(&DC, QCBOR_TAG_REQUIREMENT_OPTIONAL_TAG, 0, &String);
+ if(QCBORDecode_GetError(&DC) != QCBOR_SUCCESS) {
+ return 1;
+ }
+ QCBORDecode_GetDateStringInMapN(&DC, QCBOR_TAG_REQUIREMENT_NO_TAG, 0, &String);
+ if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_UNEXPECTED_TYPE) {
+ return 2;
+ }
+ QCBORDecode_GetDateStringInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 1, &String);
+ if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_UNEXPECTED_TYPE) {
+ return 3;
+ }
+ QCBORDecode_GetDateStringInMapN(&DC, QCBOR_TAG_REQUIREMENT_OPTIONAL_TAG, 1, &String);
+ QCBORDecode_GetDateStringInMapN(&DC, QCBOR_TAG_REQUIREMENT_NO_TAG, 1, &String);
+ if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
+ return 4;
+ }
+
+ /*
+ QCBORDecode_GetBignumInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 10, &String, &bNeg);
+
+ QCBORDecode_GetURIInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 20, &String);
+
+ QCBORDecode_GetB64InMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 30, &String);
+
+ QCBORDecode_GetB64URLInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 40, &String);
+
+ QCBORDecode_GetRegexInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 50, &String);
+
+ QCBORDecode_GetMIMEMessageInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 60, &String, &bNeg);
+
+ QCBORDecode_GetBinaryUUIDInMapN(&DC, QCBOR_TAG_REQUIREMENT_MATCH_TAG, 70, &String);
+
+ */
+ QCBORDecode_ExitMap(&DC);
+
+ uErr = QCBORDecode_Finish(&DC);
+ if(uErr != QCBOR_SUCCESS) {
+ return 100;
+ }
+
+ return 0;
+}
diff --git a/test/qcbor_decode_tests.h b/test/qcbor_decode_tests.h
index 9c83109..08f1759 100644
--- a/test/qcbor_decode_tests.h
+++ b/test/qcbor_decode_tests.h
@@ -273,4 +273,9 @@
int32_t EnterBstrTest(void);
+/*
+ Test decoding of tagged types like UUID
+ */
+int32_t DecodeTaggedTypeTests(void);
+
#endif /* defined(__QCBOR__qcbort_decode_tests__) */
diff --git a/test/run_tests.c b/test/run_tests.c
index 35e6c9d..794c456 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -109,6 +109,7 @@
TEST_ENTRY(EncodeLengthThirtyoneTest),
TEST_ENTRY(CBORSequenceDecodeTests),
TEST_ENTRY(IntToTests),
+ TEST_ENTRY(DecodeTaggedTypeTests),
#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
TEST_ENTRY(EncodeLengthThirtyoneTest),
TEST_ENTRY(ExponentAndMantissaDecodeTests),