about summary refs log tree commit diff
path: root/src/librand/rand_impls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librand/rand_impls.rs')
-rw-r--r--src/librand/rand_impls.rs52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/librand/rand_impls.rs b/src/librand/rand_impls.rs
index e2a5276cc78..2f37451ecbb 100644
--- a/src/librand/rand_impls.rs
+++ b/src/librand/rand_impls.rs
@@ -211,55 +211,3 @@ impl<T:Rand> Rand for Option<T> {
         }
     }
 }
-
-#[cfg(test)]
-mod tests {
-    use std::rand::{Rng, thread_rng, Open01, Closed01};
-
-    struct ConstantRng(u64);
-    impl Rng for ConstantRng {
-        fn next_u32(&mut self) -> u32 {
-            let ConstantRng(v) = *self;
-            v as u32
-        }
-        fn next_u64(&mut self) -> u64 {
-            let ConstantRng(v) = *self;
-            v
-        }
-    }
-
-    #[test]
-    fn floating_point_edge_cases() {
-        // the test for exact equality is correct here.
-        assert!(ConstantRng(0xffff_ffff).gen::<f32>() != 1.0);
-        assert!(ConstantRng(0xffff_ffff_ffff_ffff).gen::<f64>() != 1.0);
-    }
-
-    #[test]
-    fn rand_open() {
-        // this is unlikely to catch an incorrect implementation that
-        // generates exactly 0 or 1, but it keeps it sane.
-        let mut rng = thread_rng();
-        for _ in 0..1_000 {
-            // strict inequalities
-            let Open01(f) = rng.gen::<Open01<f64>>();
-            assert!(0.0 < f && f < 1.0);
-
-            let Open01(f) = rng.gen::<Open01<f32>>();
-            assert!(0.0 < f && f < 1.0);
-        }
-    }
-
-    #[test]
-    fn rand_closed() {
-        let mut rng = thread_rng();
-        for _ in 0..1_000 {
-            // strict inequalities
-            let Closed01(f) = rng.gen::<Closed01<f64>>();
-            assert!(0.0 <= f && f <= 1.0);
-
-            let Closed01(f) = rng.gen::<Closed01<f32>>();
-            assert!(0.0 <= f && f <= 1.0);
-        }
-    }
-}