From f9c535b45b541578fa5825474c4bad20e5862331 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Fri, 29 Jun 2012 08:56:40 -0700 Subject: [PATCH] Test the RealFloat builders --- tests/Makefile | 2 +- tests/Tests/Properties.hs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 008430fd..a0753b96 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -10,7 +10,7 @@ text-test-data: coverage/text-tests.tix: -mkdir -p coverage - ./dist/build/text-tests/text-tests + ./dist/build/text-tests/text-tests -a 10000 -j8 mv text-tests.tix $@ coverage/text-tests-stdio.tix: diff --git a/tests/Tests/Properties.hs b/tests/Tests/Properties.hs index c5713973..8c524016 100644 --- a/tests/Tests/Properties.hs +++ b/tests/Tests/Properties.hs @@ -41,6 +41,7 @@ import qualified Data.Text.IO as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Builder as TB import qualified Data.Text.Lazy.Builder.Int as TB +import qualified Data.Text.Lazy.Builder.RealFloat as TB import qualified Data.Text.Lazy.Encoding as EL import qualified Data.Text.Lazy.Fusion as SL import qualified Data.Text.Lazy.IO as TL @@ -655,6 +656,12 @@ tb_hexadecimal_word16 (a::Word16) = tb_hex a tb_hexadecimal_word32 (a::Word32) = tb_hex a tb_hexadecimal_word64 (a::Word64) = tb_hex a +tb_realfloat :: (RealFloat a, Show a) => a -> Bool +tb_realfloat = (TB.toLazyText . TB.realFloat) `eq` (TL.pack . show) + +tb_realfloat_float (a::Float) = tb_realfloat a +tb_realfloat_double (a::Double) = tb_realfloat a + -- Reading. t_decimal (n::Int) s = @@ -1141,6 +1148,10 @@ tests = testProperty "tb_hexadecimal_word32" tb_hexadecimal_word32, testProperty "tb_hexadecimal_word64" tb_hexadecimal_word64 ], + testGroup "realfloat" [ + testProperty "tb_realfloat_double" tb_realfloat_double, + testProperty "tb_realfloat_float" tb_realfloat_float + ], testProperty "tb_fromText" tb_fromText, testProperty "tb_singleton" tb_singleton ],