on master help sign in
Test the RealFloat builders
f9c535bBryan O'Sullivan
tests/Makefile+1−1
@@ -10,7 +10,7 @@ text-test-data:
10
10
11coverage/text-tests.tix:
11coverage/text-tests.tix:
12 -mkdir -p coverage
12 -mkdir -p coverage
13− ./dist/build/text-tests/text-tests
13+ ./dist/build/text-tests/text-tests -a 10000 -j8
14 mv text-tests.tix $@
14 mv text-tests.tix $@
15
15
16coverage/text-tests-stdio.tix:
16coverage/text-tests-stdio.tix:
tests/Tests/Properties.hs+11
@@ -41,6 +41,7 @@ import qualified Data.Text.IO as T
41import qualified Data.Text.Lazy as TL
41import qualified Data.Text.Lazy as TL
42import qualified Data.Text.Lazy.Builder as TB
42import qualified Data.Text.Lazy.Builder as TB
43import qualified Data.Text.Lazy.Builder.Int as TB
43import qualified Data.Text.Lazy.Builder.Int as TB
44+import qualified Data.Text.Lazy.Builder.RealFloat as TB
44import qualified Data.Text.Lazy.Encoding as EL
45import qualified Data.Text.Lazy.Encoding as EL
45import qualified Data.Text.Lazy.Fusion as SL
46import qualified Data.Text.Lazy.Fusion as SL
46import qualified Data.Text.Lazy.IO as TL
47import qualified Data.Text.Lazy.IO as TL
@@ -655,6 +656,12 @@ tb_hexadecimal_word16 (a::Word16) = tb_hex a
655tb_hexadecimal_word32 (a::Word32) = tb_hex a
656tb_hexadecimal_word32 (a::Word32) = tb_hex a
656tb_hexadecimal_word64 (a::Word64) = tb_hex a
657tb_hexadecimal_word64 (a::Word64) = tb_hex a
657
658
659+tb_realfloat :: (RealFloat a, Show a) => a -> Bool
660+tb_realfloat = (TB.toLazyText . TB.realFloat) `eq` (TL.pack . show)
661+
662+tb_realfloat_float (a::Float) = tb_realfloat a
663+tb_realfloat_double (a::Double) = tb_realfloat a
664+
658-- Reading.
665-- Reading.
659
666
660t_decimal (n::Int) s =
667t_decimal (n::Int) s =
@@ -1141,6 +1148,10 @@ tests =
1141 testProperty "tb_hexadecimal_word32" tb_hexadecimal_word32,
1148 testProperty "tb_hexadecimal_word32" tb_hexadecimal_word32,
1142 testProperty "tb_hexadecimal_word64" tb_hexadecimal_word64
1149 testProperty "tb_hexadecimal_word64" tb_hexadecimal_word64
1143 ],
1150 ],
1151+ testGroup "realfloat" [
1152+ testProperty "tb_realfloat_double" tb_realfloat_double,
1153+ testProperty "tb_realfloat_float" tb_realfloat_float
1154+ ],
1144 testProperty "tb_fromText" tb_fromText,
1155 testProperty "tb_fromText" tb_fromText,
1145 testProperty "tb_singleton" tb_singleton
1156 testProperty "tb_singleton" tb_singleton
1146 ],
1157 ],