takes one function of the form Float -> Quantity Float units and one of the form Quantity Float units -> Float
verifies that for randomly-generated Float values between -10 and 10, calling the second function on the result of the first function gives you the original value to within 1e-12
For example, Length.feet 5 |> Length.inFeet should return (almost) exactly 5. Then, use that generic testing function to test as many pairs of functions as possible:
Add a generic testing function that:
Float -> Quantity Float units
and one of the formQuantity Float units -> Float
Float
values between -10 and 10, calling the second function on the result of the first function gives you the original value to within 1e-12For example,
Length.feet 5 |> Length.inFeet
should return (almost) exactly 5. Then, use that generic testing function to test as many pairs of functions as possible:Length.feet
/Length.inFeet
Duration.days
/Duration.inDays
Speed.milesPerHour
/Speed.inMilesPerHour
etc.