1 //! Smoke test build from dtolnay. 2 //! All rights are his, merely used to test minimal-lexical. 3 //! https://github.com/serde-rs/json/issues/536#issuecomment-583708730 4 5 extern crate rand_core; 6 extern crate rand_xorshift; 7 extern crate ryu; 8 9 use rand_core::{RngCore, SeedableRng}; 10 use rand_xorshift::XorShiftRng; 11 12 mod _common; 13 use self::_common::parse_float; 14 main()15pub fn main() { 16 let mut rng = XorShiftRng::from_seed([0; 16]); 17 let mut buffer = ryu::Buffer::new(); 18 loop { 19 let input = f64::from_bits(rng.next_u64()); 20 if input.is_finite() { 21 let printed = buffer.format_finite(input); 22 let (output, rest) = parse_float::<f64>(printed.as_bytes()); 23 assert_eq!(output, input); 24 assert_eq!(rest, b""); 25 } 26 } 27 } 28