mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
implement some missing checked operations in the dev backend
This commit is contained in:
parent
e850f94d05
commit
124b533bc0
2 changed files with 47 additions and 9 deletions
|
@ -1823,7 +1823,7 @@ fn int_add_checked_err() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn int_add_wrap() {
|
||||
assert_evals_to!(
|
||||
"Num.addWrap 9_223_372_036_854_775_807 1",
|
||||
|
@ -1846,7 +1846,7 @@ fn float_add_checked_pass() {
|
|||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn float_add_checked_fail() {
|
||||
assert_evals_to!(
|
||||
"Num.addChecked 1.7976931348623157e308 1.7976931348623157e308",
|
||||
"Num.addChecked 1.7976931348623157e308f64 1.7976931348623157e308",
|
||||
RocResult::err(()),
|
||||
RocResult<f64, ()>
|
||||
);
|
||||
|
@ -3937,7 +3937,7 @@ fn bool_in_switch() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn add_checked_dec() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
|
@ -3951,7 +3951,7 @@ fn add_checked_dec() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn sub_checked_dec() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
|
@ -3995,6 +3995,23 @@ fn mul_checked_u128() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn sub_checked_u128() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
x : Result U128 [ Overflow ]
|
||||
x = Num.subChecked 5u128 2u128
|
||||
|
||||
x
|
||||
"#
|
||||
),
|
||||
RocResult::ok(5u128 - 2u128),
|
||||
RocResult<u128, ()>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn add_checked_u128() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue