mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Use unsigned LLVM intrinsic arithmetic for unsigned integers
Closes #2331
This commit is contained in:
parent
2f3919c870
commit
abe42781d5
3 changed files with 86 additions and 25 deletions
|
@ -2101,3 +2101,57 @@ fn num_to_str() {
|
|||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn u8_addition_greater_than_i8() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
x : U8
|
||||
x = 100
|
||||
y : U8
|
||||
y = 100
|
||||
x + y
|
||||
"#
|
||||
),
|
||||
200,
|
||||
u8
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn u8_sub_greater_than_i8() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
x : U8
|
||||
x = 255
|
||||
y : U8
|
||||
y = 55
|
||||
x - y
|
||||
"#
|
||||
),
|
||||
200,
|
||||
u8
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn u8_mul_greater_than_i8() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
x : U8
|
||||
x = 40
|
||||
y : U8
|
||||
y = 5
|
||||
x * y
|
||||
"#
|
||||
),
|
||||
200,
|
||||
u8
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue