mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-15 21:23:57 +00:00
Gen tests for promoted num layouts
This commit is contained in:
parent
ba450367ca
commit
2492fba9f9
5 changed files with 79 additions and 16 deletions
|
|
@ -3530,3 +3530,48 @@ fn round_to_u32() {
|
|||
u32
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn promote_u64_number_layout() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
9999999999999999999 + 1
|
||||
"#
|
||||
),
|
||||
10000000000000000000,
|
||||
u64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn promote_i128_number_layout() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
{
|
||||
a: 18446744073709551616 + 1,
|
||||
b: -9223372036854775809 + 1,
|
||||
}
|
||||
"#
|
||||
),
|
||||
(18446744073709551617, -9223372036854775808),
|
||||
(i128, i128)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn promote_u128_number_layout() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
170141183460469231731687303715884105728 + 1
|
||||
"#
|
||||
),
|
||||
170141183460469231731687303715884105729,
|
||||
u128
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ fn when_two_element_tag_first() {
|
|||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
x : [A (Int *), B (Int *)]
|
||||
x : [A (Int a), B (Int a)]
|
||||
x = A 0x2
|
||||
|
||||
when x is
|
||||
|
|
@ -192,7 +192,7 @@ fn when_two_element_tag_second() {
|
|||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
x : [A (Int *), B (Int *)]
|
||||
x : [A (Int a), B (Int a)]
|
||||
x = B 0x3
|
||||
|
||||
when x is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue