| 1 | use ronrust-analyzer cargo ron 0.12.0 crate/::{ |
| 2 | derust-analyzer cargo ron 0.12.0 de/::from_strrust-analyzer cargo ron 0.12.0 de/from_str()., |
| 3 | serrust-analyzer cargo ron 0.12.0 ser/::{to_stringrust-analyzer cargo ron 0.12.0 ser/to_string()., to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty()., PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#}, |
| 4 | }; |
| 5 | |
| 6 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 7 | fn test_inf_and_nanrust-analyzer cargo ron 0.12.0 test_inf_and_nan().() { |
| 8 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("inf"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/INFINITY.)); |
| 9 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-inf"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/NEG_INFINITY.)); |
| 10 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<f64>("NaN").maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|n| n.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_nan().()), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)) |
| 11 | } |
| 12 | |
| 13 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 14 | fn decimal_floatsrust-analyzer cargo ron 0.12.0 decimal_floats().() { |
| 15 | let non_pretty = to_stringrust-analyzer cargo ron 0.12.0 ser/to_string().(&1.0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 16 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(non_pretty, "1.0"); |
| 17 | |
| 18 | let with_pretty = to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().(&1.0, PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#::newrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 19 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(with_pretty, "1.0"); |
| 20 | |
| 21 | let tiny_pretty = to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().(&0.00000000000000005, PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#::newrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 22 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tiny_pretty, "0.00000000000000005"); |
| 23 | } |