@@ -1352,6 +1352,38 @@ fn test_range_step() {
13521352 assert_eq ! ( ( isize :: MIN ..isize :: MAX ) . step_by( 1 ) . size_hint( ) , ( usize :: MAX , Some ( usize :: MAX ) ) ) ;
13531353}
13541354
1355+ #[ test]
1356+ fn test_range_max ( ) {
1357+ assert_eq ! ( ( 0 ..100 ) . max( ) , Some ( 99 ) ) ;
1358+ assert_eq ! ( ( -20 ..-10 ) . max( ) , Some ( -11 ) ) ;
1359+ assert_eq ! ( ( 1 ..1 ) . max( ) , None ) ;
1360+ }
1361+
1362+ #[ test]
1363+ fn test_range_from_min ( ) {
1364+ assert_eq ! ( ( 0 ..) . min( ) , Some ( 0 ) ) ;
1365+ assert_eq ! ( ( -20 ..) . min( ) , Some ( -20 ) ) ;
1366+ assert_eq ! ( ( 20 ..) . min( ) , Some ( 20 ) ) ;
1367+ }
1368+
1369+ #[ test]
1370+ fn test_range_inc_last_max ( ) {
1371+ assert_eq ! ( ( 0 ..=20 ) . last( ) , Some ( 20 ) ) ;
1372+ assert_eq ! ( ( -20 ..=0 ) . last( ) , Some ( 0 ) ) ;
1373+ assert_eq ! ( ( 5 ..=5 ) . last( ) , Some ( 5 ) ) ;
1374+
1375+ assert_eq ! ( ( 0 ..=20 ) . max( ) , Some ( 20 ) ) ;
1376+ assert_eq ! ( ( -20 ..=0 ) . max( ) , Some ( 0 ) ) ;
1377+ assert_eq ! ( ( 5 ..=5 ) . max( ) , Some ( 5 ) ) ;
1378+ }
1379+
1380+ #[ test]
1381+ fn test_range_inc_min ( ) {
1382+ assert_eq ! ( ( 0 ..=20 ) . min( ) , Some ( 0 ) ) ;
1383+ assert_eq ! ( ( -20 ..=0 ) . min( ) , Some ( -20 ) ) ;
1384+ assert_eq ! ( ( 5 ..=5 ) . min( ) , Some ( 5 ) ) ;
1385+ }
1386+
13551387#[ test]
13561388fn test_repeat ( ) {
13571389 let mut it = repeat ( 42 ) ;
0 commit comments