mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-10-26 09:59:48 +03:00
Update the Scientific tests in Unicode.Parser
This commit is contained in:
parent
0633ecb373
commit
5ba608affc
@ -25,36 +25,26 @@ scientificExpFP :: Property
|
||||
scientificExpFP =
|
||||
forAll (chooseDouble (-99.99e-12, 1234.4567e+234)) $ \ls ->
|
||||
case runIdentity $ Stream.parse parser (Stream.fromList (show ls)) of
|
||||
Right val -> if val == show ls
|
||||
then property (val == show ls)
|
||||
else trace
|
||||
("Expected = " ++ show ls ++ " Got = " ++ val)
|
||||
property (val == show ls)
|
||||
Left _ -> property False
|
||||
Right val -> val `H.shouldBe` read (show ls)
|
||||
Left _ -> error "Parsing failed."
|
||||
|
||||
where
|
||||
|
||||
formatter = Scientific.formatScientific Scientific.Exponent Nothing
|
||||
toScientific (c, m) = Scientific.scientific c m
|
||||
parser = formatter . toScientific <$> Parser.number
|
||||
parser = toScientific <$> Parser.number
|
||||
|
||||
-- Standard decimal notation.
|
||||
scientificFixFP :: Property
|
||||
scientificFixFP =
|
||||
forAll (chooseDouble (-0.00099, 123445.67998)) $ \ls ->
|
||||
case runIdentity $ Stream.parse parser (Stream.fromList (show ls)) of
|
||||
Right val -> if val == show ls
|
||||
then property (val == show ls)
|
||||
else trace
|
||||
("Expected = " ++ show ls ++ " Got = " ++ val)
|
||||
property (val == show ls)
|
||||
Left _ -> property False
|
||||
Right val -> val `H.shouldBe` read (show ls)
|
||||
Left _ -> error "Parsing failed."
|
||||
|
||||
where
|
||||
|
||||
formatter = Scientific.formatScientific Scientific.Fixed Nothing
|
||||
toScientific (c, m) = Scientific.scientific c m
|
||||
parser = formatter . toScientific <$> Parser.number
|
||||
parser = toScientific <$> Parser.number
|
||||
|
||||
doubleExpFP :: Property
|
||||
doubleExpFP =
|
||||
|
Loading…
Reference in New Issue
Block a user