mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
add test for dec division
This commit is contained in:
parent
191752e979
commit
5df2199ef5
@ -799,6 +799,13 @@ fn gen_div_checked_by_zero_dec() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[should_panic(expected = r#"Roc failed with message: "Decimal divison by 0"#)]
|
||||
fn gen_div_dec_by_zero() {
|
||||
assert_evals_to!("1dec / 0", RocDec::from_str_to_i128_unsafe("-1"), i128);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
|
||||
fn gen_int_eq() {
|
||||
@ -1175,6 +1182,22 @@ fn gen_div_checked_by_zero_i64() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn gen_div_by_zero_i64() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
when Num.divTruncChecked 1000 0 is
|
||||
Err DivByZero -> 99
|
||||
_ -> -24
|
||||
"#
|
||||
),
|
||||
99,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn gen_rem_i64() {
|
||||
|
Loading…
Reference in New Issue
Block a user