Commits

Bryan O'Sullivan committed 359abdc

Improve overall test coverage from 75% to 78%.

Comments (0)

Files changed (2)

 
 qc-hpc: Properties.hs QuickCheckUtils.hs $(lib-srcs:%=../%)
 	-mkdir -p hpcdir
+	@rm -f $@.tix
 	$(ghc) $(ghc-hpc-flags) -ihpcdir --make -o $@ $<
 
 coverage: qc-hpc-html/hpc_index.html

tests/Properties.hs

 import Text.Show.Functions
 
 import Data.Char
+import Data.Monoid
 import Debug.Trace
 import Text.Printf
 import System.Environment
           n             = fromIntegral w
           s             = notEmpty e
 
+prop_S_Eq s            = (s==)    `eq` ((S.stream s==) . S.stream)
+prop_T_Eq s            = (s==)    `eq` ((T.pack s==) . T.pack)
+prop_TL_Eq s           = (s==)    `eq` ((TL.pack s==) . TL.pack)
+prop_S_Ord s           = (compare s) `eq` (compare (S.stream s) . S.stream)
+prop_T_Ord s           = (compare s) `eq` (compare (T.pack s) . T.pack)
+prop_TL_Ord s          = (compare s) `eq` (compare (TL.pack s) . TL.pack)
+prop_T_Read            = id       `eq` (T.unpack . read . show)
+prop_TL_Read           = id       `eq` (TL.unpack . read . show)
+prop_T_Show            = show     `eq` (show . T.pack)
+prop_TL_Show           = show     `eq` (show . TL.pack)
+prop_T_mappend s       = mappend s`eqP` (unpackS . mappend (T.pack s))
+prop_TL_mappend s      = mappend s`eqP` (unpackS . mappend (TL.pack s))
+prop_T_mconcat         = mconcat  `eq` (unpackS . mconcat . L.map T.pack)
+prop_TL_mconcat        = mconcat  `eq` (unpackS . mconcat . L.map TL.pack)
+
 prop_S_cons x          = (x:)     `eqP` (unpackS . S.cons x)
 prop_T_cons x          = (x:)     `eqP` (unpackS . T.cons x)
-prop_TL_cons x         = ((x:)     `eqP` (TL.unpack . TL.cons x))
+prop_TL_cons x         = (x:)     `eqP` (unpackS . TL.cons x)
 prop_S_snoc x          = (++ [x]) `eqP` (unpackS . (flip S.snoc) x)
 prop_T_snoc x          = (++ [x]) `eqP` (unpackS . (flip T.snoc) x)
 prop_TL_snoc x         = (++ [x]) `eqP` (unpackS . (flip TL.snoc) x)
   ("prop_T_utf32LE", mytest prop_T_utf32LE),
   ("prop_T_utf32BE", mytest prop_T_utf32BE),
 
+  ("prop_S_Eq", mytest prop_S_Eq),
+  ("prop_T_Eq", mytest prop_T_Eq),
+  ("prop_TL_Eq", mytest prop_TL_Eq),
+  ("prop_S_Ord", mytest prop_S_Ord),
+  ("prop_T_Ord", mytest prop_T_Ord),
+  ("prop_TL_Ord", mytest prop_TL_Ord),
+  ("prop_T_Read", mytest prop_T_Read),
+  ("prop_TL_Read", mytest prop_TL_Read),
+  ("prop_T_Show", mytest prop_T_Show),
+  ("prop_TL_Show", mytest prop_TL_Show),
+  ("prop_T_mappend", mytest prop_T_mappend),
+  ("prop_TL_mappend", mytest prop_TL_mappend),
+  ("prop_T_mconcat", mytest prop_T_mconcat),
+  ("prop_TL_mconcat", mytest prop_TL_mconcat),
+
   ("prop_S_cons", mytest prop_S_cons),
   ("prop_T_cons", mytest prop_T_cons),
   ("prop_TL_cons", mytest prop_TL_cons),
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 ProjectModifiedEvent.java.
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.