Skip to content

Commit

Permalink
Test the RealFloat builders
Browse files Browse the repository at this point in the history
  • Loading branch information
bos committed Jun 29, 2012
1 parent 0c71074 commit f9c535b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/Makefile
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions tests/Tests/Properties.hs
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
],
Expand Down

0 comments on commit f9c535b

Please sign in to comment.