Commit 2a41e3be authored by Don Stewart's avatar Don Stewart
Browse files

And add QC test for group/groupBy

parent dc6d798d
......@@ -103,6 +103,8 @@ prop_spanS f xs = P.span f (P.pack xs) ==
prop_breakS f xs = P.break f (P.pack xs) ==
let (a,b) = break f xs in (P.pack a, P.pack b)
prop_breakspan_1 xs c = P.break (== c) xs == P.span (/= c) xs
prop_linesS xs = P.lines (P.pack xs) == map P.pack (lines xs)
prop_unlinesS xss = P.unlines (map P.pack xss) == P.pack (unlines xss)
......@@ -254,6 +256,11 @@ prop_wordstokens xs = P.words xs == P.tokens isSpace xs
prop_unwords xs = (pack.unwords.words) xs == (P.unwords . P.words .pack) xs
prop_group xs = group xs == (map unpack . P.group . pack) xs
prop_groupBy xs = groupBy (==) xs == (map unpack . P.groupBy (==) . pack) xs
prop_groupBy1 xs = groupBy (/=) xs == (map unpack . P.groupBy (/=) . pack) xs
prop_join xs = (concat . (intersperse "XYX") . lines) xs ==
(unpack $ P.join (pack "XYX") (P.lines (pack xs)))
......@@ -315,6 +322,13 @@ prop_breakChar c xs =
(break (==c) xs) ==
(let (x,y) = P.breakChar c (pack xs) in (unpack x, unpack y))
prop_spanChar c xs =
(break (/=c) xs) ==
(let (x,y) = P.spanChar c (pack xs) in (unpack x, unpack y))
prop_spanChar_1 c xs =
(P.span (==c) xs) == P.spanChar c xs
prop_breakFirst c xs = (let (x,y) = break (==c) xs
in if null y then Nothing
else Just (pack x, pack $ drop 1 y)) ==
......@@ -444,6 +458,9 @@ main = do
, ("unlines", mytest prop_unlines)
, ("words", mytest prop_words)
, ("unwords", mytest prop_unwords)
, ("group", mytest prop_group)
, ("groupBy", mytest prop_groupBy)
, ("groupBy1", mytest prop_groupBy1)
, ("join", mytest prop_join)
, ("elemIndex1", mytest prop_elemIndex1)
, ("elemIndex2", mytest prop_elemIndex2)
......@@ -460,6 +477,8 @@ main = do
, ("maximum", mytest prop_maximum)
, ("minimum", mytest prop_minimum)
, ("breakChar", mytest prop_breakChar)
, ("spanChar", mytest prop_spanChar)
, ("spanChar1", mytest prop_spanChar_1)
, ("breakSpace", mytest prop_breakSpace)
, ("dropSpace", mytest prop_dropSpace)
, ("spanEnd", mytest prop_spanEnd)
......@@ -512,6 +531,7 @@ main = do
, ("dropWhileS", mytest prop_dropWhileS)
, ("spanS", mytest prop_spanS)
, ("breakS", mytest prop_breakS)
, ("breakspan", mytest prop_breakspan_1)
, ("linesS", mytest prop_linesS)
, ("unlinesS", mytest prop_unlinesS)
, ("wordsS", mytest prop_wordsS)
......
......@@ -51,6 +51,9 @@ lines : 01234567891011121314151617181920
unlines : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
words : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
unwords : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
group : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
groupBy : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
groupBy1 : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
join : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
elemIndex1 : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
elemIndex2 : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
......@@ -67,6 +70,8 @@ intersperse : 01234567891011121314151617181920
maximum : 01223445567778991010111112121313141516171717181920212223242526272829303031323334353637373738393940414243444546474848495050515253545556575859596060616161626364656667686970717273747575767778787980818283838485868788899091929394959696979899OK, 100 tests.
minimum : 01223445567778991010111112121313141516171717181920212223242526272829303031323334353637373738393940414243444546474848495050515253545556575859596060616161626364656667686970717273747575767778787980818283838485868788899091929394959696979899OK, 100 tests.
breakChar : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
spanChar : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
spanChar1 : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
breakSpace : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
dropSpace : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
spanEnd : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
......@@ -121,6 +126,7 @@ takeWhileS : 01234567891011121314151617181920
dropWhileS : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
spanS : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
breakS : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
breakspan : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
linesS : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
unlinesS : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
wordsS : 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899OK, 100 tests.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment