mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Handle non-finite floats in test
This commit is contained in:
parent
8d5ea357b5
commit
5ad14553fd
1 changed files with 6 additions and 1 deletions
|
@ -487,7 +487,12 @@ mod test_parse {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[quickcheck]
|
#[quickcheck]
|
||||||
fn all_f64_values_parse(num: f64) {
|
fn all_f64_values_parse(mut num: f64) {
|
||||||
|
// NaN, Infinity, -Infinity (these would all parse as tags in Roc)
|
||||||
|
if !num.is_finite() {
|
||||||
|
num = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
// These can potentially be whole numbers. `Display` omits the decimal point for those,
|
// These can potentially be whole numbers. `Display` omits the decimal point for those,
|
||||||
// causing them to no longer be parsed as fractional numbers by Roc.
|
// causing them to no longer be parsed as fractional numbers by Roc.
|
||||||
// Using `Debug` instead of `Display` ensures they always have a decimal point.
|
// Using `Debug` instead of `Display` ensures they always have a decimal point.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue