File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1777,4 +1777,22 @@ mod tests {
17771777 assert_ne ! ( nan_masked & QNAN_MASK , 0 ) ;
17781778 assert ! ( nan_masked_fl. is_nan( ) ) ;
17791779 }
1780+
1781+ #[ test]
1782+ #[ should_panic]
1783+ fn test_clamp_min_greater_than_max ( ) {
1784+ 1.0f32 . clamp ( 3.0 , 1.0 ) ;
1785+ }
1786+
1787+ #[ test]
1788+ #[ should_panic]
1789+ fn test_clamp_min_is_nan ( ) {
1790+ 1.0f32 . clamp ( NAN , 1.0 ) ;
1791+ }
1792+
1793+ #[ test]
1794+ #[ should_panic]
1795+ fn test_clamp_max_is_nan ( ) {
1796+ 1.0f32 . clamp ( 3.0 , NAN ) ;
1797+ }
17801798}
Original file line number Diff line number Diff line change @@ -1668,4 +1668,22 @@ mod tests {
16681668 assert_approx_eq ! ( f64 :: from_bits( 0x4094e40000000000 ) , 1337.0 ) ;
16691669 assert_approx_eq ! ( f64 :: from_bits( 0xc02c800000000000 ) , -14.25 ) ;
16701670 }
1671+
1672+ #[ test]
1673+ #[ should_panic]
1674+ fn test_clamp_min_greater_than_max ( ) {
1675+ 1.0f64 . clamp ( 3.0 , 1.0 ) ;
1676+ }
1677+
1678+ #[ test]
1679+ #[ should_panic]
1680+ fn test_clamp_min_is_nan ( ) {
1681+ 1.0f64 . clamp ( NAN , 1.0 ) ;
1682+ }
1683+
1684+ #[ test]
1685+ #[ should_panic]
1686+ fn test_clamp_max_is_nan ( ) {
1687+ 1.0f64 . clamp ( 3.0 , NAN ) ;
1688+ }
16711689}
Original file line number Diff line number Diff line change 249249#![ feature( cfg_target_vendor) ]
250250#![ feature( char_error_internals) ]
251251#![ feature( char_internals) ]
252+ #![ feature( clamp) ]
252253#![ feature( collections_range) ]
253254#![ feature( compiler_builtins_lib) ]
254255#![ feature( const_fn) ]
You can’t perform that action at this time.
0 commit comments