Add new constants to symbol table, attempt to add tests

This commit is contained in:
Andy Ferris 2024-05-03 19:50:12 +10:00
parent a0c4bb571f
commit 03e9344a83
2 changed files with 44 additions and 0 deletions

View file

@ -1370,6 +1370,10 @@ define_builtins! {
162 NUM_F64_TO_PARTS: "f64ToParts" 162 NUM_F64_TO_PARTS: "f64ToParts"
163 NUM_F32_FROM_PARTS: "f32FromParts" 163 NUM_F32_FROM_PARTS: "f32FromParts"
164 NUM_F64_FROM_PARTS: "f64FromParts" 164 NUM_F64_FROM_PARTS: "f64FromParts"
165 NUM_NAN_F32: "nanF32"
166 NUM_NAN_F64: "nanF64"
167 NUM_INFINITY_F32: "infinityF32"
168 NUM_INFINITY_F64: "infinityF64"
} }
4 BOOL: "Bool" => { 4 BOOL: "Bool" => {
0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias 0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias

View file

@ -3901,3 +3901,43 @@ fn f64_from_parts() {
f64 f64
); );
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn nan_f32() {
assert_evals_to!(
r"Num.nanF32",
f32::NAN,
f32
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn nan_f64() {
assert_evals_to!(
r"Num.nanF64",
f64::NAN,
f64
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn infinity_f32() {
assert_evals_to!(
r"Num.infinityF32",
f32::INFINITY,
f32
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn infinity_f64() {
assert_evals_to!(
r"Num.infinityF64",
f64::INFINITY,
f64
);
}