File tree Expand file tree Collapse file tree 5 files changed +45
-72
lines changed
library/coretests/tests/floats Expand file tree Collapse file tree 5 files changed +45
-72
lines changed Original file line number Diff line number Diff line change @@ -132,24 +132,6 @@ fn test_float_bits_conv() {
132132 assert_eq ! ( f128:: from_bits( masked_nan2) . to_bits( ) , masked_nan2) ;
133133}
134134
135- #[ test]
136- #[ should_panic]
137- fn test_clamp_min_greater_than_max ( ) {
138- let _ = 1.0f128 . clamp ( 3.0 , 1.0 ) ;
139- }
140-
141- #[ test]
142- #[ should_panic]
143- fn test_clamp_min_is_nan ( ) {
144- let _ = 1.0f128 . clamp ( f128:: NAN , 1.0 ) ;
145- }
146-
147- #[ test]
148- #[ should_panic]
149- fn test_clamp_max_is_nan ( ) {
150- let _ = 1.0f128 . clamp ( 3.0 , f128:: NAN ) ;
151- }
152-
153135#[ test]
154136fn test_total_cmp ( ) {
155137 use core:: cmp:: Ordering ;
Original file line number Diff line number Diff line change @@ -131,24 +131,6 @@ fn test_float_bits_conv() {
131131 assert_eq ! ( f16:: from_bits( masked_nan2) . to_bits( ) , masked_nan2) ;
132132}
133133
134- #[ test]
135- #[ should_panic]
136- fn test_clamp_min_greater_than_max ( ) {
137- let _ = 1.0f16 . clamp ( 3.0 , 1.0 ) ;
138- }
139-
140- #[ test]
141- #[ should_panic]
142- fn test_clamp_min_is_nan ( ) {
143- let _ = 1.0f16 . clamp ( f16:: NAN , 1.0 ) ;
144- }
145-
146- #[ test]
147- #[ should_panic]
148- fn test_clamp_max_is_nan ( ) {
149- let _ = 1.0f16 . clamp ( 3.0 , f16:: NAN ) ;
150- }
151-
152134#[ test]
153135#[ cfg( not( miri) ) ]
154136#[ cfg( target_has_reliable_f16_math) ]
Original file line number Diff line number Diff line change @@ -112,24 +112,6 @@ fn test_float_bits_conv() {
112112 assert_eq ! ( f32 :: from_bits( masked_nan2) . to_bits( ) , masked_nan2) ;
113113}
114114
115- #[ test]
116- #[ should_panic]
117- fn test_clamp_min_greater_than_max ( ) {
118- let _ = 1.0f32 . clamp ( 3.0 , 1.0 ) ;
119- }
120-
121- #[ test]
122- #[ should_panic]
123- fn test_clamp_min_is_nan ( ) {
124- let _ = 1.0f32 . clamp ( f32:: NAN , 1.0 ) ;
125- }
126-
127- #[ test]
128- #[ should_panic]
129- fn test_clamp_max_is_nan ( ) {
130- let _ = 1.0f32 . clamp ( 3.0 , f32:: NAN ) ;
131- }
132-
133115#[ test]
134116fn test_total_cmp ( ) {
135117 use core:: cmp:: Ordering ;
Original file line number Diff line number Diff line change @@ -105,24 +105,6 @@ fn test_float_bits_conv() {
105105 assert_eq ! ( f64 :: from_bits( masked_nan2) . to_bits( ) , masked_nan2) ;
106106}
107107
108- #[ test]
109- #[ should_panic]
110- fn test_clamp_min_greater_than_max ( ) {
111- let _ = 1.0f64 . clamp ( 3.0 , 1.0 ) ;
112- }
113-
114- #[ test]
115- #[ should_panic]
116- fn test_clamp_min_is_nan ( ) {
117- let _ = 1.0f64 . clamp ( f64:: NAN , 1.0 ) ;
118- }
119-
120- #[ test]
121- #[ should_panic]
122- fn test_clamp_max_is_nan ( ) {
123- let _ = 1.0f64 . clamp ( 3.0 , f64:: NAN ) ;
124- }
125-
126108#[ test]
127109fn test_total_cmp ( ) {
128110 use core:: cmp:: Ordering ;
Original file line number Diff line number Diff line change @@ -1144,3 +1144,48 @@ float_test! {
11441144 assert_biteq!( Float :: INFINITY . sqrt( ) , Float :: INFINITY ) ;
11451145 }
11461146}
1147+
1148+ float_test ! {
1149+ name: clamp_min_greater_than_max,
1150+ attrs: {
1151+ const : #[ cfg( false ) ] ,
1152+ f16: #[ should_panic, cfg( any( miri, target_has_reliable_f16) ) ] ,
1153+ f32 : #[ should_panic] ,
1154+ f64 : #[ should_panic] ,
1155+ f128: #[ should_panic, cfg( any( miri, target_has_reliable_f128) ) ] ,
1156+ } ,
1157+ test<Float > {
1158+ let one : Float = 1.0 ;
1159+ let _ = one. clamp( 3.0 , 1.0 ) ;
1160+ }
1161+ }
1162+
1163+ float_test ! {
1164+ name: clamp_min_is_nan,
1165+ attrs: {
1166+ const : #[ cfg( false ) ] ,
1167+ f16: #[ should_panic, cfg( any( miri, target_has_reliable_f16) ) ] ,
1168+ f32 : #[ should_panic] ,
1169+ f64 : #[ should_panic] ,
1170+ f128: #[ should_panic, cfg( any( miri, target_has_reliable_f128) ) ] ,
1171+ } ,
1172+ test<Float > {
1173+ let one : Float = 1.0 ;
1174+ let _ = one. clamp( Float :: NAN , 1.0 ) ;
1175+ }
1176+ }
1177+
1178+ float_test ! {
1179+ name: clamp_max_is_nan,
1180+ attrs: {
1181+ const : #[ cfg( false ) ] ,
1182+ f16: #[ should_panic, cfg( any( miri, target_has_reliable_f16) ) ] ,
1183+ f32 : #[ should_panic] ,
1184+ f64 : #[ should_panic] ,
1185+ f128: #[ should_panic, cfg( any( miri, target_has_reliable_f128) ) ] ,
1186+ } ,
1187+ test<Float > {
1188+ let one : Float = 1.0 ;
1189+ let _ = one. clamp( 3.0 , Float :: NAN ) ;
1190+ }
1191+ }
You can’t perform that action at this time.
0 commit comments