|
1 | | -#![cfg(not(miri))] // Miri does not implement ldexp, which most tests here need |
2 | | - |
3 | 1 | use std::prelude::v1::*; |
4 | 2 | use std::{str, i16, f32, f64, fmt}; |
5 | 3 |
|
@@ -257,6 +255,7 @@ pub fn f32_shortest_sanity_test<F>(mut f: F) where F: FnMut(&Decoded, &mut [u8]) |
257 | 255 | check_shortest!(f(minf32) => b"1", -44); |
258 | 256 | } |
259 | 257 |
|
| 258 | +#[cfg(not(miri))] // Miri is too slow |
260 | 259 | pub fn f32_exact_sanity_test<F>(mut f: F) |
261 | 260 | where F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16) { |
262 | 261 | let minf32 = ldexp_f32(1.0, -149); |
@@ -362,6 +361,7 @@ pub fn f64_shortest_sanity_test<F>(mut f: F) where F: FnMut(&Decoded, &mut [u8]) |
362 | 361 | check_shortest!(f(minf64) => b"5", -323); |
363 | 362 | } |
364 | 363 |
|
| 364 | +#[cfg(not(miri))] // Miri is too slow |
365 | 365 | pub fn f64_exact_sanity_test<F>(mut f: F) |
366 | 366 | where F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16) { |
367 | 367 | let minf64 = ldexp_f64(1.0, -1074); |
@@ -553,6 +553,10 @@ pub fn to_shortest_str_test<F>(mut f_: F) |
553 | 553 | assert_eq!(to_string(f, minf64, Minus, 324, false), format!("0.{:0>323}5", "")); |
554 | 554 | assert_eq!(to_string(f, minf64, Minus, 325, false), format!("0.{:0>323}50", "")); |
555 | 555 |
|
| 556 | + if cfg!(miri) { // Miri is too slow |
| 557 | + return; |
| 558 | + } |
| 559 | + |
556 | 560 | // very large output |
557 | 561 | assert_eq!(to_string(f, 1.1, Minus, 80000, false), format!("1.1{:0>79999}", "")); |
558 | 562 | } |
@@ -807,6 +811,10 @@ pub fn to_exact_exp_str_test<F>(mut f_: F) |
807 | 811 | "1.401298464324817070923729583289916131280261941876515771757068283\ |
808 | 812 | 8897910826858606014866381883621215820312500000000000000000000000e-45"); |
809 | 813 |
|
| 814 | + if cfg!(miri) { // Miri is too slow |
| 815 | + return; |
| 816 | + } |
| 817 | + |
810 | 818 | assert_eq!(to_string(f, f64::MAX, Minus, 1, false), "2e308"); |
811 | 819 | assert_eq!(to_string(f, f64::MAX, Minus, 2, false), "1.8e308"); |
812 | 820 | assert_eq!(to_string(f, f64::MAX, Minus, 4, false), "1.798e308"); |
@@ -1040,6 +1048,10 @@ pub fn to_exact_fixed_str_test<F>(mut f_: F) |
1040 | 1048 | assert_eq!(to_string(f, f32::MAX, Minus, 2, false), |
1041 | 1049 | "340282346638528859811704183484516925440.00"); |
1042 | 1050 |
|
| 1051 | + if cfg!(miri) { // Miri is too slow |
| 1052 | + return; |
| 1053 | + } |
| 1054 | + |
1043 | 1055 | let minf32 = ldexp_f32(1.0, -149); |
1044 | 1056 | assert_eq!(to_string(f, minf32, Minus, 0, false), "0"); |
1045 | 1057 | assert_eq!(to_string(f, minf32, Minus, 1, false), "0.0"); |
|
0 commit comments