mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
add tests for the new min/max constants
This commit is contained in:
parent
f77e559c6f
commit
5cd36a3c26
1 changed files with 56 additions and 2 deletions
|
@ -591,8 +591,6 @@ fn f64_round() {
|
|||
fn f64_abs() {
|
||||
assert_evals_to!("Num.abs -4.7", 4.7, f64);
|
||||
assert_evals_to!("Num.abs 5.8", 5.8, f64);
|
||||
//assert_evals_to!("Num.abs Num.maxFloat", f64::MAX, f64);
|
||||
//assert_evals_to!("Num.abs Num.minFloat", -f64::MIN, f64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2320,6 +2318,62 @@ fn max_u8() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn max_f64() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Num.maxF64
|
||||
"#
|
||||
),
|
||||
f64::MAX,
|
||||
f64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn min_f64() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Num.minF64
|
||||
"#
|
||||
),
|
||||
f64::MIN,
|
||||
f64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn max_f32() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Num.maxF32
|
||||
"#
|
||||
),
|
||||
f32::MAX,
|
||||
f32
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn min_f32() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
Num.minF32
|
||||
"#
|
||||
),
|
||||
f32::MIN,
|
||||
f32
|
||||
);
|
||||
}
|
||||
|
||||
macro_rules! num_conversion_tests {
|
||||
($($fn:expr, $typ:ty, ($($test_name:ident, $input:expr, $output:expr $(, [ $($support_gen:literal),* ])? )*))*) => {$($(
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue