about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon BD <simon@server>2012-10-22 22:04:14 -0500
committerSimon BD <simon@server>2012-10-22 22:04:14 -0500
commite0a9d41b04f16b7771315dcbfcb4e1fa4c347c33 (patch)
tree137701b6e3e9099b4ede6e86a2db1ea20e089f56
parent254a86e49edb0fbf38d335a50b1ab535fa7fd757 (diff)
Re-add bad Ord impl test
-rw-r--r--src/libstd/sort.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs
index 92389ca03e4..a42d6be51fb 100644
--- a/src/libstd/sort.rs
+++ b/src/libstd/sort.rs
@@ -1046,6 +1046,25 @@ mod test_tim_sort {
         tim_sort(arr);
         fail ~"Guarantee the fail";
     }
+
+    struct DVal { val: ~uint }
+    impl DVal: Ord {
+        pure fn lt(_x: &DVal) -> bool { true }
+        pure fn le(_x: &DVal) -> bool { true }
+        pure fn gt(_x: &DVal) -> bool { true }
+        pure fn ge(_x: &DVal) -> bool { true }
+    }
+
+    #[test]
+    fn test_bad_Ord_impl() {
+        let rng = rand::Rng();
+        let mut arr = do vec::from_fn(500) |_i| {
+            let randVal = rng.gen_uint();
+            DVal { val: ~randVal }
+        };
+
+        tim_sort(arr);
+    }
 }
 
 #[cfg(test)]