@@ -410,18 +410,8 @@ fn to_abs_slice(axis_len: usize, slice: Slice) -> (usize, usize, isize)
410410 if end < start {
411411 end = start;
412412 }
413- ndassert ! (
414- start <= axis_len,
415- "Slice begin {} is past end of axis of length {}" ,
416- start,
417- axis_len,
418- ) ;
419- ndassert ! (
420- end <= axis_len,
421- "Slice end {} is past end of axis of length {}" ,
422- end,
423- axis_len,
424- ) ;
413+ ndassert ! ( start <= axis_len, "Slice begin {} is past end of axis of length {}" , start, axis_len, ) ;
414+ ndassert ! ( end <= axis_len, "Slice end {} is past end of axis of length {}" , end, axis_len, ) ;
425415 ndassert ! ( step != 0 , "Slice stride must not be zero" ) ;
426416 ( start, end, step)
427417}
@@ -1100,14 +1090,8 @@ mod test
11001090 assert_eq ! ( slice_min_max( 10 , Slice :: new( -8 , Some ( 8 ) , -3 ) ) , Some ( ( 4 , 7 ) ) ) ;
11011091 assert_eq ! ( slice_min_max( 10 , Slice :: new( 1 , Some ( -2 ) , -3 ) ) , Some ( ( 1 , 7 ) ) ) ;
11021092 assert_eq ! ( slice_min_max( 10 , Slice :: new( 2 , Some ( -2 ) , -3 ) ) , Some ( ( 4 , 7 ) ) ) ;
1103- assert_eq ! (
1104- slice_min_max( 10 , Slice :: new( -9 , Some ( -2 ) , -3 ) ) ,
1105- Some ( ( 1 , 7 ) )
1106- ) ;
1107- assert_eq ! (
1108- slice_min_max( 10 , Slice :: new( -8 , Some ( -2 ) , -3 ) ) ,
1109- Some ( ( 4 , 7 ) )
1110- ) ;
1093+ assert_eq ! ( slice_min_max( 10 , Slice :: new( -9 , Some ( -2 ) , -3 ) ) , Some ( ( 1 , 7 ) ) ) ;
1094+ assert_eq ! ( slice_min_max( 10 , Slice :: new( -8 , Some ( -2 ) , -3 ) ) , Some ( ( 4 , 7 ) ) ) ;
11111095 assert_eq ! ( slice_min_max( 9 , Slice :: new( 2 , None , -3 ) ) , Some ( ( 2 , 8 ) ) ) ;
11121096 assert_eq ! ( slice_min_max( 9 , Slice :: new( -7 , None , -3 ) ) , Some ( ( 2 , 8 ) ) ) ;
11131097 assert_eq ! ( slice_min_max( 9 , Slice :: new( 3 , None , -3 ) ) , Some ( ( 5 , 8 ) ) ) ;
@@ -1117,46 +1101,18 @@ mod test
11171101 #[ test]
11181102 fn slices_intersect_true ( )
11191103 {
1120- assert ! ( slices_intersect(
1121- & Dim ( [ 4 , 5 ] ) ,
1122- s![ NewAxis , .., NewAxis , ..] ,
1123- s![ .., NewAxis , .., NewAxis ]
1124- ) ) ;
1125- assert ! ( slices_intersect(
1126- & Dim ( [ 4 , 5 ] ) ,
1127- s![ NewAxis , 0 , ..] ,
1128- s![ 0 , ..]
1129- ) ) ;
1130- assert ! ( slices_intersect(
1131- & Dim ( [ 4 , 5 ] ) ,
1132- s![ ..; 2 , ..] ,
1133- s![ ..; 3 , NewAxis , ..]
1134- ) ) ;
1135- assert ! ( slices_intersect(
1136- & Dim ( [ 4 , 5 ] ) ,
1137- s![ .., ..; 2 ] ,
1138- s![ .., 1 ..; 3 , NewAxis ]
1139- ) ) ;
1104+ assert ! ( slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ NewAxis , .., NewAxis , ..] , s![ .., NewAxis , .., NewAxis ] ) ) ;
1105+ assert ! ( slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ NewAxis , 0 , ..] , s![ 0 , ..] ) ) ;
1106+ assert ! ( slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ ..; 2 , ..] , s![ ..; 3 , NewAxis , ..] ) ) ;
1107+ assert ! ( slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ .., ..; 2 ] , s![ .., 1 ..; 3 , NewAxis ] ) ) ;
11401108 assert ! ( slices_intersect( & Dim ( [ 4 , 10 ] ) , s![ .., ..; 9 ] , s![ .., 3 ..; 6 ] ) ) ;
11411109 }
11421110
11431111 #[ test]
11441112 fn slices_intersect_false ( )
11451113 {
1146- assert ! ( !slices_intersect(
1147- & Dim ( [ 4 , 5 ] ) ,
1148- s![ ..; 2 , ..] ,
1149- s![ NewAxis , 1 ..; 2 , ..]
1150- ) ) ;
1151- assert ! ( !slices_intersect(
1152- & Dim ( [ 4 , 5 ] ) ,
1153- s![ ..; 2 , NewAxis , ..] ,
1154- s![ 1 ..; 3 , ..]
1155- ) ) ;
1156- assert ! ( !slices_intersect(
1157- & Dim ( [ 4 , 5 ] ) ,
1158- s![ .., ..; 9 ] ,
1159- s![ .., 3 ..; 6 , NewAxis ]
1160- ) ) ;
1114+ assert ! ( !slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ ..; 2 , ..] , s![ NewAxis , 1 ..; 2 , ..] ) ) ;
1115+ assert ! ( !slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ ..; 2 , NewAxis , ..] , s![ 1 ..; 3 , ..] ) ) ;
1116+ assert ! ( !slices_intersect( & Dim ( [ 4 , 5 ] ) , s![ .., ..; 9 ] , s![ .., 3 ..; 6 , NewAxis ] ) ) ;
11611117 }
11621118}
0 commit comments