on master help sign in
Update the Scientific tests in Unicode.Parser
commit5ba608affc0c975e9818bd347e554cb89f463cfe authorAdithya Kumar <adithya@composewell.com> dateMon 11 Sep 2023, 22:10 (3 years ago) parent0633ecb
1 file changed+6−16
test/Streamly/Test/Unicode/Parser.hs+6−16
test/Streamly/Test/Unicode/Parser.hs+6−16
@@ -25,36 +25,26 @@ scientificExpFP :: Property
2525scientificExpFP =
2626 forAll (chooseDouble (-99.99e-12, 1234.4567e+234)) $ \ls ->
2727 case runIdentity $ Stream.parse parser (Stream.fromList (show ls)) of
28− Right val -> if val == show ls
29− then property (val == show ls)
30− else trace
31− ("Expected = " ++ show ls ++ " Got = " ++ val)
32− property (val == show ls)
33− Left _ -> property False
28+ Right val -> val `H.shouldBe` read (show ls)
29+ Left _ -> error "Parsing failed."
3430
3531 where
3632
37− formatter = Scientific.formatScientific Scientific.Exponent Nothing
3833 toScientific (c, m) = Scientific.scientific c m
39− parser = formatter . toScientific <$> Parser.number
34+ parser = toScientific <$> Parser.number
4035
4136-- Standard decimal notation.
4237scientificFixFP :: Property
4338scientificFixFP =
4439 forAll (chooseDouble (-0.00099, 123445.67998)) $ \ls ->
4540 case runIdentity $ Stream.parse parser (Stream.fromList (show ls)) of
46− Right val -> if val == show ls
47− then property (val == show ls)
48− else trace
49− ("Expected = " ++ show ls ++ " Got = " ++ val)
50− property (val == show ls)
51− Left _ -> property False
41+ Right val -> val `H.shouldBe` read (show ls)
42+ Left _ -> error "Parsing failed."
5243
5344 where
5445
55− formatter = Scientific.formatScientific Scientific.Fixed Nothing
5646 toScientific (c, m) = Scientific.scientific c m
57− parser = formatter . toScientific <$> Parser.number
47+ parser = toScientific <$> Parser.number
5848
5949doubleExpFP :: Property
6050doubleExpFP =