File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
library/coretests/tests/floats Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ const TOL_PRECISE: f128 = 1e-28;
2020
2121#[ test]
2222fn test_from ( ) {
23- assert_biteq ! ( f128:: from( false ) , 0.0 ) ;
24- assert_biteq ! ( f128:: from( true ) , 1.0 ) ;
2523 assert_biteq ! ( f128:: from( u8 :: MIN ) , 0.0 ) ;
2624 assert_biteq ! ( f128:: from( 42_u8 ) , 42.0 ) ;
2725 assert_biteq ! ( f128:: from( u8 :: MAX ) , 255.0 ) ;
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ const TOL_P4: f16 = 10.0;
2424
2525#[ test]
2626fn test_from ( ) {
27- assert_biteq ! ( f16:: from( false ) , 0.0 ) ;
28- assert_biteq ! ( f16:: from( true ) , 1.0 ) ;
2927 assert_biteq ! ( f16:: from( u8 :: MIN ) , 0.0 ) ;
3028 assert_biteq ! ( f16:: from( 42_u8 ) , 42.0 ) ;
3129 assert_biteq ! ( f16:: from( u8 :: MAX ) , 255.0 ) ;
Original file line number Diff line number Diff line change @@ -1582,3 +1582,15 @@ float_test! {
15821582 assert_biteq!( ( flt( -3.2 ) ) . mul_add( 2.4 , neg_inf) , neg_inf) ;
15831583 }
15841584}
1585+
1586+ float_test ! {
1587+ name: from_bool,
1588+ attrs: {
1589+ f16: #[ cfg( any( miri, target_has_reliable_f16) ) ] ,
1590+ f128: #[ cfg( any( miri, target_has_reliable_f128) ) ] ,
1591+ } ,
1592+ test<Float > {
1593+ assert_biteq!( Float :: from( false ) , Float :: ZERO ) ;
1594+ assert_biteq!( Float :: from( true ) , Float :: ONE ) ;
1595+ }
1596+ }
You can’t perform that action at this time.
0 commit comments