about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-01-08 18:46:40 +0000
committervarkor <github@varkor.com>2018-01-09 19:37:44 +0000
commit919d643b7953ea1b3b717d31f0735423d97b87ca (patch)
tree30dfce35e6911eb9857d997a857f0635d00f9c42 /src/libcore/tests
parent2d8334358aeda76428ec1f841ec31ab3579325e0 (diff)
Add `min` and `last` specialisations for `Range`
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/iter.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs
index 9cbec8f9e6e..8997cf9c6bf 100644
--- a/src/libcore/tests/iter.rs
+++ b/src/libcore/tests/iter.rs
@@ -1353,10 +1353,14 @@ fn test_range_step() {
 }
 
 #[test]
-fn test_range_max() {
-    assert_eq!((0..100).max(), Some(99));
-    assert_eq!((-20..-10).max(), Some(-11));
-    assert_eq!((1..1).max(), None);
+fn test_range_last_max() {
+    assert_eq!((0..20).last(), Some(19));
+    assert_eq!((-20..0).last(), Some(-1));
+    assert_eq!((5..5).last(), None);
+
+    assert_eq!((0..20).max(), Some(19));
+    assert_eq!((-20..0).max(), Some(-1));
+    assert_eq!((5..5).max(), None);
 }
 
 #[test]
@@ -1377,6 +1381,13 @@ fn test_range_inclusive_last_max() {
 }
 
 #[test]
+fn test_range_min() {
+    assert_eq!((0..20).min(), Some(0));
+    assert_eq!((-20..0).min(), Some(-20));
+    assert_eq!((5..5).min(), None);
+}
+
+#[test]
 fn test_range_inclusive_min() {
     assert_eq!((0..=20).min(), Some(0));
     assert_eq!((-20..=0).min(), Some(-20));