on master help sign in
Test the RealFloat builders
commitf9c535b45b541578fa5825474c4bad20e5862331 authorBryan O'Sullivan <bos@serpentine.com> dateFri 29 Jun 2012, 08:56 (14 years ago) parent0c71074
2 files changed+12−1
tests/Makefile+1−1 tests/Tests/Properties.hs+11
tests/Makefile+1−1
@@ -10,7 +10,7 @@ text-test-data:
1010
1111coverage/text-tests.tix:
1212 -mkdir -p coverage
13− ./dist/build/text-tests/text-tests
13+ ./dist/build/text-tests/text-tests -a 10000 -j8
1414 mv text-tests.tix $@
1515
1616coverage/text-tests-stdio.tix:
tests/Tests/Properties.hs+11
@@ -41,6 +41,7 @@ import qualified Data.Text.IO as T
4141import qualified Data.Text.Lazy as TL
4242import qualified Data.Text.Lazy.Builder as TB
4343import qualified Data.Text.Lazy.Builder.Int as TB
44+import qualified Data.Text.Lazy.Builder.RealFloat as TB
4445import qualified Data.Text.Lazy.Encoding as EL
4546import qualified Data.Text.Lazy.Fusion as SL
4647import qualified Data.Text.Lazy.IO as TL
@@ -655,6 +656,12 @@ tb_hexadecimal_word16 (a::Word16) = tb_hex a
655656tb_hexadecimal_word32 (a::Word32) = tb_hex a
656657tb_hexadecimal_word64 (a::Word64) = tb_hex a
657658
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+
658665-- Reading.
659666
660667t_decimal (n::Int) s =
@@ -1141,6 +1148,10 @@ tests =
11411148 testProperty "tb_hexadecimal_word32" tb_hexadecimal_word32,
11421149 testProperty "tb_hexadecimal_word64" tb_hexadecimal_word64
11431150 ],
1151+ testGroup "realfloat" [
1152+ testProperty "tb_realfloat_double" tb_realfloat_double,
1153+ testProperty "tb_realfloat_float" tb_realfloat_float
1154+ ],
11441155 testProperty "tb_fromText" tb_fromText,
11451156 testProperty "tb_singleton" tb_singleton
11461157 ],