rename config macro QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 689d275..6e1cc3b 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -3027,7 +3027,7 @@
4([1,3])
*/
uError = QCBORDecode_GetNext(&DCtx, &Item);
-#ifdef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifdef QCBOR_DISABLE_EXP_AND_MANTISSA
if(uError != QCBOR_SUCCESS ||
Item.uDataType != QCBOR_TYPE_ARRAY ||
!QCBORDecode_IsTagged(&DCtx, &Item, CBOR_TAG_DECIMAL_FRACTION) ||
@@ -3043,7 +3043,7 @@
uError = QCBORDecode_GetNext(&DCtx, &Item);
uError = QCBORDecode_GetNext(&DCtx, &Item);
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
if(uError != QCBOR_SUCCESS ||
Item.uDataType != QCBOR_TYPE_DECIMAL_FRACTION ||
QCBORDecode_GetNthTag(&DCtx, &Item, 0) != CBOR_TAG_INVALID64 ||
@@ -3053,7 +3053,7 @@
QCBORDecode_GetNthTag(&DCtx, &Item, 4) != CBOR_TAG_INVALID64 ) {
return -5;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
/*
More than 4 tags on an item 225(226(227(228(229([])))))
@@ -4491,7 +4491,7 @@
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS */
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/* exponent, mantissa
[
@@ -4796,7 +4796,7 @@
struct FailInput));
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
@@ -5583,61 +5583,61 @@
"Decimal Fraction with positive bignum 257 * 10e3",
{(uint8_t[]){0xC4, 0x82, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC2, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
257000,
QCBOR_SUCCESS,
257000,
QCBOR_SUCCESS,
257000.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
{
"bigfloat with negative bignum -258 * 2e3",
{(uint8_t[]){0xC5, 0x82, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC3, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
-2064,
QCBOR_SUCCESS,
0,
QCBOR_ERR_NUMBER_SIGN_CONVERSION,
-2064.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
{
"bigfloat with positive bignum 257 * 2e3",
{(uint8_t[]){0xC5, 0x82, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC2, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
2056,
QCBOR_SUCCESS,
2056,
QCBOR_SUCCESS,
2056.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
{
"negative bignum 0xc349010000000000000000 -18446744073709551617",
@@ -5665,60 +5665,60 @@
"Decimal Fraction with neg bignum [9223372036854775807, -4759477275222530853137]",
{(uint8_t[]){0xC4, 0x82, 0x1B, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xC3, 0x4A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10,}, 23},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_NUMBER_SIGN_CONVERSION,
-INFINITY,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"big float [9223372036854775806, 9223372036854775806]",
{(uint8_t[]){0xC5, 0x82, 0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, 20},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
INFINITY,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"Big float 3 * 2^^2",
{(uint8_t[]){0xC5, 0x82, 0x02, 0x03}, 4},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
12,
QCBOR_SUCCESS,
12,
QCBOR_SUCCESS,
12.0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"Positive integer 18446744073709551615",
@@ -5828,21 +5828,21 @@
{
"Decimal fraction 3/10",
{(uint8_t[]){0xC4, 0x82, 0x20, 0x03}, 4},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0.30000000000000004,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
"+inifinity",
@@ -6004,21 +6004,21 @@
0xC5, 0x82,
0x3B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x1B, 0x7f, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, 20},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
},
{
@@ -6027,21 +6027,21 @@
0xC5, 0x82,
0x1B, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xC3, 0x42, 0x01, 0x01}, 15},
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
0,
QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW,
0,
QCBOR_ERR_NUMBER_SIGN_CONVERSION,
-INFINITY,
QCBOR_SUCCESS
-#else /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0,
QCBOR_ERR_UNEXPECTED_TYPE,
0.0,
QCBOR_ERR_UNEXPECTED_TYPE
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA*/
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA*/
},
};
diff --git a/test/qcbor_decode_tests.h b/test/qcbor_decode_tests.h
index c2a4165..53f6bd2 100644
--- a/test/qcbor_decode_tests.h
+++ b/test/qcbor_decode_tests.h
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -247,7 +247,7 @@
int32_t SetUpAllocatorTest(void);
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
Test decoding of decimal fractions and big floats, both of which are
made up of an exponent and mantissa.
@@ -259,7 +259,7 @@
Hostile input tests for decimal fractions and big floats.
*/
int32_t ExponentAndMantissaDecodeFailTests(void);
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
int32_t EnterMapTest(void);
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index c3e7315..6655aed 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -96,7 +96,7 @@
#endif
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
Returns 0 if UsefulBufs are equal
Returns 1000000 + offeset if they are not equal.
@@ -130,7 +130,7 @@
return 0;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
// One big buffer that is used by all the tests to encode into
@@ -2513,7 +2513,7 @@
}
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
[
4([-1, 3]),
@@ -2711,7 +2711,7 @@
return 0;
}
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
int32_t QCBORHeadTest()
diff --git a/test/qcbor_encode_tests.h b/test/qcbor_encode_tests.h
index e54168a..ae64f7d 100644
--- a/test/qcbor_encode_tests.h
+++ b/test/qcbor_encode_tests.h
@@ -1,6 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
- Copyright (c) 2018-2020, Laurence Lundblade.
+ Copyright (c) 2018-2021, Laurence Lundblade.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -165,13 +165,13 @@
int32_t CoseSign1TBSTest(void);
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
/*
Test encoding of decimal fractions and big floats, both of which are
made up of an exponent and mantissa
*/
int32_t ExponentAndMantissaEncodeTests(void);
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
/*
diff --git a/test/run_tests.c b/test/run_tests.c
index 314525c..cc9c70b 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -1,7 +1,7 @@
/*==============================================================================
run_tests.c -- test aggregator and results reporting
- Copyright (c) 2018-2020, Laurence Lundblade. All rights reserved.
+ Copyright (c) 2018-2021, Laurence Lundblade. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
@@ -20,6 +20,12 @@
#include "UsefulBuf_Tests.h"
+
+// For size printing and some conditionals
+#include "qcbor/qcbor_encode.h"
+#include "qcbor/qcbor_decode.h"
+#include "qcbor/qcbor_spiffy_decode.h"
+
/*
Test configuration
*/
@@ -124,12 +130,12 @@
TEST_ENTRY(IntToTests),
TEST_ENTRY(DecodeTaggedTypeTests),
TEST_ENTRY(PeekAndRewindTest),
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
TEST_ENTRY(EncodeLengthThirtyoneTest),
TEST_ENTRY(ExponentAndMantissaDecodeTests),
TEST_ENTRY(ExponentAndMantissaDecodeFailTests),
TEST_ENTRY(ExponentAndMantissaEncodeTests),
-#endif /* QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
TEST_ENTRY(ParseEmptyMapInMapTest),
};
@@ -296,10 +302,6 @@
}
-// For size printing
-#include "qcbor/qcbor_encode.h"
-#include "qcbor/qcbor_decode.h"
-#include "qcbor/qcbor_spiffy_decode.h"
/*