Skip to content

Commit 43598d8

Browse files
committed
Gate some tests behind float_roundtrip feature
1 parent 9e7680a commit 43598d8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎tests/test.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,9 @@ fn test_parse_f64() {
827827
("3.1", 3.1),
828828
("-1.2", -1.2),
829829
("0.4", 0.4),
830+
// Edge case from:
831+
// https://github.com/serde-rs/json/issues/536#issuecomment-583714900
832+
("2.638344616030823e-256", 2.638344616030823e-256),
830833
]);
831834

832835
#[cfg(not(feature = "arbitrary_precision"))]
@@ -911,6 +914,7 @@ fn test_parse_f64() {
911914

912915
// Test roundtrip with some values that were not perfectly roundtripped by the
913916
// old f64 deserializer.
917+
#[cfg(feature = "float_roundtrip")]
914918
#[test]
915919
fn test_roundtrip_f64() {
916920
for &float in &[
@@ -920,16 +924,13 @@ fn test_roundtrip_f64() {
920924
-93.3113703768803_3, // -93.3113703768803_2
921925
-36.5739948427534_36, // -36.5739948427534_4
922926
52.31400820410624_4, // 52.31400820410624_
923-
97.45365320034685, // 97.4536532003468_4
927+
97.4536532003468_5, // 97.4536532003468_4
924928
// Samples from `rng.next_u64` + `f64::from_bits` + `is_finite` filter.
925929
2.0030397744267762e-253,
926930
7.101215824554616e260,
927931
1.769268377902049e74,
928932
-1.6727517818542075e58,
929933
3.9287532173373315e299,
930-
// Edge case from:
931-
// https://github.com/serde-rs/json/issues/536#issuecomment-583714900
932-
2.638344616030823e-256,
933934
] {
934935
let json = serde_json::to_string(&float).unwrap();
935936
let output: f64 = serde_json::from_str(&json).unwrap();

0 commit comments

Comments
 (0)