mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
This commit is contained in:
commit
1d0f9e9192
178 changed files with 5342 additions and 3304 deletions
|
@ -2160,7 +2160,7 @@ fn max_u8() {
|
|||
);
|
||||
}
|
||||
|
||||
macro_rules! to_int_tests {
|
||||
macro_rules! num_conversion_tests {
|
||||
($($fn:expr, $typ:ty, ($($test_name:ident, $input:expr, $output:expr $(, [ $($support_gen:literal),* ])? )*))*) => {$($(
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", $($(feature = $support_gen)*)?))]
|
||||
|
@ -2171,7 +2171,7 @@ macro_rules! to_int_tests {
|
|||
)*)*}
|
||||
}
|
||||
|
||||
to_int_tests! {
|
||||
num_conversion_tests! {
|
||||
"Num.toI8", i8, (
|
||||
to_i8_same_width, "15u8", 15, ["gen-wasm"]
|
||||
to_i8_truncate, "115i32", 115, ["gen-wasm"]
|
||||
|
@ -2232,6 +2232,36 @@ to_int_tests! {
|
|||
to_nat_truncate, "115i128", 115
|
||||
to_nat_truncate_wraps, "10_000_000_000_000_000_000_000i128", 1864712049423024128
|
||||
)
|
||||
"Num.toF32", f32, (
|
||||
to_f32_from_i8, "15i8", 15.0
|
||||
to_f32_from_i16, "15i16", 15.0
|
||||
to_f32_from_i32, "15i32", 15.0
|
||||
to_f32_from_i64, "15i64", 15.0
|
||||
to_f32_from_i128, "15i128", 15.0
|
||||
to_f32_from_u8, "15u8", 15.0
|
||||
to_f32_from_u16, "15u16", 15.0
|
||||
to_f32_from_u32, "15u32", 15.0
|
||||
to_f32_from_u64, "15u64", 15.0
|
||||
to_f32_from_u128, "15u128", 15.0
|
||||
to_f32_from_nat, "15nat", 15.0
|
||||
to_f32_from_f32, "1.5f32", 1.5
|
||||
to_f32_from_f64, "1.5f64", 1.5
|
||||
)
|
||||
"Num.toF64", f64, (
|
||||
to_f64_from_i8, "15i8", 15.0
|
||||
to_f64_from_i16, "15i16", 15.0
|
||||
to_f64_from_i32, "15i32", 15.0
|
||||
to_f64_from_i64, "15i64", 15.0
|
||||
to_f64_from_i128, "15i128", 15.0
|
||||
to_f64_from_u8, "15u8", 15.0
|
||||
to_f64_from_u16, "15u16", 15.0
|
||||
to_f64_from_u32, "15u32", 15.0
|
||||
to_f64_from_u64, "15u64", 15.0
|
||||
to_f64_from_u128, "15u128", 15.0
|
||||
to_f64_from_nat, "15nat", 15.0
|
||||
to_f64_from_f32, "1.5f32", 1.5
|
||||
to_f64_from_f64, "1.5f64", 1.5
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! to_int_checked_tests {
|
||||
|
@ -2906,3 +2936,17 @@ fn div_of_unsigned() {
|
|||
u8
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn dec_float_suffix() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
123.0dec
|
||||
"#
|
||||
),
|
||||
RocDec::from_str_to_i128_unsafe("123.0"),
|
||||
i128
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue