Skip to content

Commit

Permalink
Add test for int to float
Browse files Browse the repository at this point in the history
  • Loading branch information
usbalbin committed Aug 7, 2021
1 parent 09928a9 commit c8bf5ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/core/tests/num/const_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ fn from() {
const FROM: i64 = i64::from(1i32);
assert_eq!(FROM, 1i64);

// From int to float
const FROM_F64: f64 = f64::from(42u8);
assert_eq!(FROM_F64, 42f64);

// Upper bounded
const U8_FROM_U16: Result<u8, TryFromIntError> = u8::try_from(1u16);
assert_eq!(U8_FROM_U16, Ok(1u8));
Expand Down

0 comments on commit c8bf5ed

Please sign in to comment.