Bryan O'Sullivan committed 1b0d7bc

Test the RealFloat builders

Comments (0)

Files changed (2)

 	-mkdir -p coverage
-	./dist/build/text-tests/text-tests
+	./dist/build/text-tests/text-tests -a 10000 -j8
 	mv text-tests.tix $@


 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
 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 =
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.