Fix preferred serialization of subnormals (#192)
Preferred Serialization now fully supports conversion to/from half, single and double subnormals. This includes NaN payloads.
The tests for floating-point are much better organized and give greater coverage.
IEEE 754 code is better organized and cleaner.
* Fix preferred serialization of subnormals (checkpoint)
* Check point progress
* Preferred float mostly working and tests passing
* added NaN tests
* Fix up ieee754.h; a few other compiler warnings
* decoding NaN payloads fix; rework half-double; tests
* Code tidyness
* indent to 3, not 4
* TODO's are done in other test; code tidy
* test running with float HW use disabled
* Remove / rearrange float tests
* Fix full float ifdef test fan out
* Code tidiness; sort out final TODO's
---------
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/test/float_tests.h b/test/float_tests.h
index 54daa3f..427aa76 100644
--- a/test/float_tests.h
+++ b/test/float_tests.h
@@ -1,7 +1,7 @@
/*==============================================================================
- float_tests.h -- tests for float and conversion to/from half-precision
+ float_tests.h -- tests for floats and conversion to/from half-precision
- Copyright (c) 2018-2020, Laurence Lundblade. All rights reserved.
+ Copyright (c) 2018-2024, Laurence Lundblade. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
@@ -17,22 +17,35 @@
#ifndef QCBOR_DISABLE_PREFERRED_FLOAT
-int32_t HalfPrecisionDecodeBasicTests(void);
-
-int32_t DoubleAsSmallestTest(void);
-
+/* This tests a large number half-precision values
+ * in the conversion to/from half/double against
+ * the sample code in the CBOR RFC. */
int32_t HalfPrecisionAgainstRFCCodeTest(void);
#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
+
/*
- This calls each and every method for encoding
- floating-point numbers.
+ * This tests floating point encoding, decoding
+ * and conversion for lots of different values.
+ * It covers Preferred Serialization processing
+ * of floating point. It's focus is on the numbers
+ * not the encode/decode functions.
+ */
+int32_t FloatValuesTests(void);
+
+
+/*
+ * This calls each and every method for encoding
+ * floating-point numbers.
*/
int32_t GeneralFloatEncodeTests(void);
+
/*
- Tests basic float decoding.
+ * Tests float decoding, including error codes in scenarios
+ * where various float features are disabled. This also
+ * tests decoding using spiffy decode methods.
*/
int32_t GeneralFloatDecodeTests(void);