Decode conformance for preferred serialization, CDE and dCBOR (#216)
Three conformance modes are added for decoding
- preferred serialization
- CDE
- dCBOR
This checks for sort ordering and duplicate labels when a map is decoded in CDE and dCBOR modes.
It does not support arrays and maps as map labels. They will error out, unless you use maps-as-arrays mode.
Conformance includes checking for shortest form of integers and floats and for dCBOR unification of floats and integers.
* start work on dCBOR decoding enforcement
* checkpoint
* Floating point conformane; ifdef for disabling
* Add more tests
* More dCBOR tests and conformance checks
* More test cases
* Bug fixes and more tests
* Check point stuff
* Map dup and sort order checking kind of working
* more work...
* Finish off UsefulInputBuf_Compare()
* Fix #ifdef fanout
* Fix warnings and #ifdef fan out
* sort & dup checking working and tested
* Fix test ifdef fan out
* Minor fix of one test case
* Another fan out fix
* backout map label checking; doc; test
* Stragglers
---------
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/test/run_tests.c b/test/run_tests.c
index e24506a..3fe4905 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -67,10 +67,18 @@
static test_entry s_tests[] = {
+#ifndef QCBOR_DISABLE_DECODE_CONFORMANCE
+ TEST_ENTRY(DecodeConformanceTests),
+#endif /* ! QCBOR_DISABLE_DECODE_CONFORMANCE */
+ TEST_ENTRY(ErrorHandlingTests),
+ TEST_ENTRY(OpenCloseBytesTest),
#ifndef QCBOR_DISABLE_NON_INTEGER_LABELS
TEST_ENTRY(GetMapAndArrayTest),
TEST_ENTRY(TellTests),
TEST_ENTRY(ParseMapAsArrayTest),
+#ifndef QCBOR_DISABLE_ENCODE_USAGE_GUARDS
+ TEST_ENTRY(ArrayNestingTest3),
+#endif /* QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
TEST_ENTRY(SpiffyDateDecodeTest),
#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
TEST_ENTRY(ErrorHandlingTests),
@@ -86,7 +94,7 @@
TEST_ENTRY(IndefiniteLengthNestTest),
TEST_ENTRY(IndefiniteLengthArrayMapTest),
TEST_ENTRY(NestedMapTestIndefLen),
-#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+#endif /* ! QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
TEST_ENTRY(SimpleValueDecodeTests),
TEST_ENTRY(DecodeFailureTests),
@@ -95,11 +103,6 @@
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),
@@ -165,8 +168,6 @@
TEST_ENTRY(PeekAndRewindTest),
#endif /* ! QCBOR_DISABLE_NON_INTEGER_LABELS */
-
-
#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
TEST_ENTRY(ExponentAndMantissaDecodeTests),
#ifndef QCBOR_DISABLE_TAGS