Skip to content

Commit c8bf5ed

Browse files
committed
Add test for int to float
1 parent 09928a9 commit c8bf5ed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/core/tests/num/const_from.rs

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ fn from() {
77
const FROM: i64 = i64::from(1i32);
88
assert_eq!(FROM, 1i64);
99

10+
// From int to float
11+
const FROM_F64: f64 = f64::from(42u8);
12+
assert_eq!(FROM_F64, 42f64);
13+
1014
// Upper bounded
1115
const U8_FROM_U16: Result<u8, TryFromIntError> = u8::try_from(1u16);
1216
assert_eq!(U8_FROM_U16, Ok(1u8));

0 commit comments

Comments
 (0)