on master help sign in
Add test coverage for remaining implemented functions

--HG-- extra : convert_revision : c7c53e3ae562e65408935e446c4ddafea43442e5

commit1d2fc49c8b90d7f1aa38a1015ce67834bfe39f4b authorBryan O'Sullivan <bos@serpentine.com> dateTue 3 Feb 2009, 08:01 (18 years ago) parent808eafb
1 file changed+31−5
tests/Properties.hs+31−5
tests/Properties.hs+31−5
@@ -73,19 +73,33 @@ prop_minimum = L.minimum `eqEP` T.minimum
7373
7474prop_scanl f z = L.scanl f z `eqP` (unpack . T.scanl f z)
7575
76+prop_replicate n = L.replicate n `eq` (unpack . T.replicate n)
77+prop_unfoldr f = L.unfoldr f `eq` (unpack . T.unfoldr f)
78+ where types = f :: Int -> Maybe (Char,Int)
79+prop_unfoldrN n f = (L.take n . L.unfoldr f) `eq` (unpack . T.unfoldrN n f)
80+ where types = f :: Int -> Maybe (Char,Int)
81+
7682prop_take n = L.take n `eqP` (unpack . T.take n)
7783prop_drop n = L.drop n `eqP` (unpack . T.drop n)
7884prop_takeWhile p = L.takeWhile p `eqP` (unpack . T.takeWhile p)
7985prop_dropWhile p = L.dropWhile p `eqP` (unpack . T.dropWhile p)
86+prop_inits = L.inits `eqP` (map unpack . T.inits)
87+prop_tails = L.tails `eqP` (map unpack . T.tails)
88+
89+prop_lines = L.lines `eqP` (map unpack . T.lines)
90+prop_words = L.words `eqP` (map unpack . T.words)
91+prop_unlines = L.unlines `eq` (unpack . T.unlines . map pack)
92+prop_unwords = L.unwords `eq` (unpack . T.unwords . map pack)
93+
8094prop_elem c = L.elem c `eqP` T.elem c
81−prop_find p = L.find p `eqP` T.find p
8295prop_filter p = L.filter p `eqP` (unpack . T.filter p)
96+prop_find p = L.find p `eqP` T.find p
97+
8398prop_index x s = x < L.length s && x >= 0 ==>
8499 (L.!!) s x == T.index (pack s) x
85100prop_findIndex p = L.findIndex p `eqP` T.findIndex p
86101prop_elemIndex c = L.elemIndex c `eqP` T.elemIndex c
87102prop_zipWith c s = L.zipWith c s `eqP` (unpack . T.zipWith c (pack s))
88−prop_words = L.words `eqP` (L.map unpack . T.words)
89103
90104main = run tests =<< getArgs
91105
@@ -143,16 +157,28 @@ tests = [
143157
144158 ("prop_scanl", mytest prop_scanl),
145159
160+ ("prop_replicate", mytest prop_replicate),
161+--("prop_unfoldr", mytest prop_unfoldr),
162+--("prop_unfoldrN", mytest prop_unfoldrN),
163+
146164 ("prop_take", mytest prop_take),
147165 ("prop_drop", mytest prop_drop),
148166 ("prop_takeWhile", mytest prop_takeWhile),
149167 ("prop_dropWhile", mytest prop_dropWhile),
168+ ("prop_inits", mytest prop_inits),
169+ ("prop_tails", mytest prop_tails),
170+
171+ ("prop_lines", mytest prop_lines),
172+ ("prop_words", mytest prop_words),
173+ ("prop_unlines", mytest prop_unlines),
174+ ("prop_unwords", mytest prop_unwords),
175+
150176 ("prop_elem", mytest prop_elem),
151− ("prop_find", mytest prop_find),
152177 ("prop_filter", mytest prop_filter),
178+ ("prop_find", mytest prop_find),
179+
153180 ("prop_index", mytest prop_index),
154181 ("prop_findIndex", mytest prop_findIndex),
155182 ("prop_elemIndex", mytest prop_elemIndex),
156− ("prop_zipWith", mytest prop_zipWith),
157− ("prop_words", mytest prop_words)
183+ ("prop_zipWith", mytest prop_zipWith)
158184 ]