Fixed
Details
Assignee
UnassignedUnassignedReporter
Paula GearonPaula GearonApproval
OkPatch
Code and TestPriority
MinorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Paula Gearon
Paula GearonApproval
Ok
Patch
Code and Test
Priority
Affects versions
Fix versions
Created February 5, 2022 at 8:12 PM
Updated February 16, 2022 at 5:24 PM
Resolved February 16, 2022 at 5:24 PM
The test file `test/clojure/test_clojure/parse.clj` includes this block in `test-parse-double` (lines 57-60):
This has several problems:
The function being called is `parse-long`, not `parse-double`
Parsing a number larger than the maximum double will return `Double/POSITIVE_INFINITY`, not `nil`
Parsing a number smaller than the minimum double will be rounded to the `Double/MIN_VALUE` or `0.0`, whichever is closer.
The smallest double is `4.9e-324`. The value being tested is about twice that, so it would parse correctly anyway (it gets rounded to `1.0E-323`)
All of this is hidden because the wrong function was being called, which returns `nil` for invalid input.
Proposal:
Test that numbers too large are rounded to Infinity.
Test that numbers too small are rounded up to `Double/MIN_VALUE` or down to `0.0`.
Test that strings that do not form valid doubles will return `nil` when parsed.
Screened: Alex Miller