Skip to content

Commit 975b8e1

Browse files
committed
tests: json: fix tests involving double numbers
Update the JSON test cases to explicitly cast NAN and INFINITY to double type to avoid implicit promotion. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent ce771c5 commit 975b8e1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/lib/json/src/main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,10 @@ ZTEST(lib_json_test, test_json_double_nan)
745745
"}";
746746

747747
struct test_double doubles = {
748-
.some_double = NAN,
749-
.another_double = NAN,
750-
.some_array[0] = NAN,
751-
.some_array[1] = NAN,
748+
.some_double = (double)NAN,
749+
.another_double = (double)NAN,
750+
.some_array[0] = (double)NAN,
751+
.some_array[1] = (double)NAN,
752752
.some_array_len = 2,
753753
};
754754

@@ -775,10 +775,10 @@ ZTEST(lib_json_test, test_json_double_infinity)
775775
"}";
776776

777777
struct test_double doubles = {
778-
.some_double = INFINITY,
779-
.another_double = -INFINITY,
780-
.some_array[0] = INFINITY,
781-
.some_array[1] = -INFINITY,
778+
.some_double = (double)INFINITY,
779+
.another_double = (double)-INFINITY,
780+
.some_array[0] = (double)INFINITY,
781+
.some_array[1] = (double)-INFINITY,
782782
.some_array_len = 2,
783783
};
784784

0 commit comments

Comments
 (0)