on master help sign in
Improve overall test coverage from 75% to 78%.
eab0a1dBryan O'Sullivan
tests/Makefile+1
@@ -22,6 +22,7 @@ qc: $(lib) QuickCheckUtils.o Properties.o
22
22
23qc-hpc: Properties.hs QuickCheckUtils.hs $(lib-srcs:%=../%)
23qc-hpc: Properties.hs QuickCheckUtils.hs $(lib-srcs:%=../%)
24 -mkdir -p hpcdir
24 -mkdir -p hpcdir
25+ @rm -f $@.tix
25 $(ghc) $(ghc-hpc-flags) -ihpcdir --make -o $@ $<
26 $(ghc) $(ghc-hpc-flags) -ihpcdir --make -o $@ $<
26
27
27coverage: qc-hpc-html/hpc_index.html
28coverage: qc-hpc-html/hpc_index.html
tests/Properties.hs+32−1
@@ -5,6 +5,7 @@ import Test.QuickCheck
5import Text.Show.Functions
5import Text.Show.Functions
6
6
7import Data.Char
7import Data.Char
8+import Data.Monoid
8import Debug.Trace
9import Debug.Trace
9import Text.Printf
10import Text.Printf
10import System.Environment
11import System.Environment
@@ -127,9 +128,24 @@ eqEP a b e w = a s == b t &&
127 n = fromIntegral w
128 n = fromIntegral w
128 s = notEmpty e
129 s = notEmpty e
129
130
131+prop_S_Eq s = (s==) `eq` ((S.stream s==) . S.stream)
132+prop_T_Eq s = (s==) `eq` ((T.pack s==) . T.pack)
133+prop_TL_Eq s = (s==) `eq` ((TL.pack s==) . TL.pack)
134+prop_S_Ord s = (compare s) `eq` (compare (S.stream s) . S.stream)
135+prop_T_Ord s = (compare s) `eq` (compare (T.pack s) . T.pack)
136+prop_TL_Ord s = (compare s) `eq` (compare (TL.pack s) . TL.pack)
137+prop_T_Read = id `eq` (T.unpack . read . show)
138+prop_TL_Read = id `eq` (TL.unpack . read . show)
139+prop_T_Show = show `eq` (show . T.pack)
140+prop_TL_Show = show `eq` (show . TL.pack)
141+prop_T_mappend s = mappend s`eqP` (unpackS . mappend (T.pack s))
142+prop_TL_mappend s = mappend s`eqP` (unpackS . mappend (TL.pack s))
143+prop_T_mconcat = mconcat `eq` (unpackS . mconcat . L.map T.pack)
144+prop_TL_mconcat = mconcat `eq` (unpackS . mconcat . L.map TL.pack)
145+
130prop_S_cons x = (x:) `eqP` (unpackS . S.cons x)
146prop_S_cons x = (x:) `eqP` (unpackS . S.cons x)
131prop_T_cons x = (x:) `eqP` (unpackS . T.cons x)
147prop_T_cons x = (x:) `eqP` (unpackS . T.cons x)
132−prop_TL_cons x = ((x:) `eqP` (TL.unpack . TL.cons x))
148+prop_TL_cons x = (x:) `eqP` (unpackS . TL.cons x)
133prop_S_snoc x = (++ [x]) `eqP` (unpackS . (flip S.snoc) x)
149prop_S_snoc x = (++ [x]) `eqP` (unpackS . (flip S.snoc) x)
134prop_T_snoc x = (++ [x]) `eqP` (unpackS . (flip T.snoc) x)
150prop_T_snoc x = (++ [x]) `eqP` (unpackS . (flip T.snoc) x)
135prop_TL_snoc x = (++ [x]) `eqP` (unpackS . (flip TL.snoc) x)
151prop_TL_snoc x = (++ [x]) `eqP` (unpackS . (flip TL.snoc) x)
@@ -440,6 +456,21 @@ tests = [
440 ("prop_T_utf32LE", mytest prop_T_utf32LE),
456 ("prop_T_utf32LE", mytest prop_T_utf32LE),
441 ("prop_T_utf32BE", mytest prop_T_utf32BE),
457 ("prop_T_utf32BE", mytest prop_T_utf32BE),
442
458
459+ ("prop_S_Eq", mytest prop_S_Eq),
460+ ("prop_T_Eq", mytest prop_T_Eq),
461+ ("prop_TL_Eq", mytest prop_TL_Eq),
462+ ("prop_S_Ord", mytest prop_S_Ord),
463+ ("prop_T_Ord", mytest prop_T_Ord),
464+ ("prop_TL_Ord", mytest prop_TL_Ord),
465+ ("prop_T_Read", mytest prop_T_Read),
466+ ("prop_TL_Read", mytest prop_TL_Read),
467+ ("prop_T_Show", mytest prop_T_Show),
468+ ("prop_TL_Show", mytest prop_TL_Show),
469+ ("prop_T_mappend", mytest prop_T_mappend),
470+ ("prop_TL_mappend", mytest prop_TL_mappend),
471+ ("prop_T_mconcat", mytest prop_T_mconcat),
472+ ("prop_TL_mconcat", mytest prop_TL_mconcat),
473+
443 ("prop_S_cons", mytest prop_S_cons),
474 ("prop_S_cons", mytest prop_S_cons),
444 ("prop_T_cons", mytest prop_T_cons),
475 ("prop_T_cons", mytest prop_T_cons),
445 ("prop_TL_cons", mytest prop_TL_cons),
476 ("prop_TL_cons", mytest prop_TL_cons),