fixes for tests with combos of disable options
diff --git a/Makefile b/Makefile
index d9f2b17..e1659ce 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
CC=cc
#CC=/usr/local/bin/gcc-9
-CFLAGS=-I inc -I test -Os -fPIC
+CFLAGS=-I inc -I test -Os -fPIC $(CMD_LINE)
# The following are used before a release of QCBOR help to make sure
# the code compiles and runs in the most strict environments, but not
diff --git a/test/float_tests.c b/test/float_tests.c
index 7eb435e..981e897 100644
--- a/test/float_tests.c
+++ b/test/float_tests.c
@@ -1079,31 +1079,61 @@
QCBORDecode_GetDouble(&DC, &d);
uErr = QCBORDecode_GetAndResetError(&DC);
+#ifndef QCBOR_DISABLE_FLOAT_HW_USE
if(uErr != QCBOR_SUCCESS ||
d != 3.140000104904175) {
return -306;
}
+#else
+ // Disabled use of HW to convert from single to double
+ if(uErr != QCBOR_ERR_HW_FLOAT_DISABLED) {
+ return -316;
+ }
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
+
QCBORDecode_GetDouble(&DC, &d);
uErr = QCBORDecode_GetAndResetError(&DC);
+#ifndef QCBOR_DISABLE_FLOAT_HW_USE
if(uErr != QCBOR_SUCCESS ||
d != 0.0) {
return -307;
}
+#else
+ // Disabled use of HW to convert from single to double
+ if(uErr == QCBOR_SUCCESS) {
+ return -317;
+ }
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
+
QCBORDecode_GetDouble(&DC, &d);
uErr = QCBORDecode_GetAndResetError(&DC);
+#ifndef QCBOR_DISABLE_FLOAT_HW_USE
if(uErr != QCBOR_SUCCESS ||
!isnan(d)) {
return -308;
}
+#else
+ // Disabled use of HW to convert from single to double
+ if(uErr == QCBOR_SUCCESS) {
+ return -318;
+ }
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
QCBORDecode_GetDouble(&DC, &d);
uErr = QCBORDecode_GetAndResetError(&DC);
+#ifndef QCBOR_DISABLE_FLOAT_HW_USE
if(uErr != QCBOR_SUCCESS ||
d != INFINITY) {
return -309;
}
+#else
+ // Disabled use of HW to convert from single to double
+ if(uErr == QCBOR_SUCCESS) {
+ return -318;
+ }
+#endif /* QCBOR_DISABLE_FLOAT_HW_USE */
#endif /* QCBOR_DISABLE_PREFERRED_FLOAT */
return 0;
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 205eada..a230305 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -6498,12 +6498,19 @@
"label2",
0xff,
&uDouble);
+#ifndef QCBOR_DISABLE_FLOAT_HW_USE
if(QCBORDecode_GetAndResetError(&DCtx)) {
return 5;
}
if(uDouble != -16777474) {
return 6;
}
+#else
+ if(QCBORDecode_GetAndResetError(&DCtx) != QCBOR_ERR_HW_FLOAT_DISABLED) {
+ return 7;
+ }
+#endif
+
QCBORDecode_ExitMap(&DCtx);