on master help sign in
Improve run time of test suite
63e8879Bryan O'Sullivan
tests/Tests/Properties.hs+55−31
@@ -197,8 +197,10 @@ t_Show = show `eq` (show . T.pack)
197tl_Show = show `eq` (show . TL.pack)
197tl_Show = show `eq` (show . TL.pack)
198t_mappend s = mappend s`eqP` (unpackS . mappend (T.pack s))
198t_mappend s = mappend s`eqP` (unpackS . mappend (T.pack s))
199tl_mappend s = mappend s`eqP` (unpackS . mappend (TL.pack s))
199tl_mappend s = mappend s`eqP` (unpackS . mappend (TL.pack s))
200+t_mconcat = unsquare $
200−t_mconcat = mconcat `eq` (unpackS . mconcat . L.map T.pack)
201+ mconcat `eq` (unpackS . mconcat . L.map T.pack)
202+tl_mconcat = unsquare $
201−tl_mconcat = mconcat `eq` (unpackS . mconcat . L.map TL.pack)
203+ mconcat `eq` (unpackS . mconcat . L.map TL.pack)
202t_mempty = mempty == (unpackS (mempty :: T.Text))
204t_mempty = mempty == (unpackS (mempty :: T.Text))
203tl_mempty = mempty == (unpackS (mempty :: TL.Text))
205tl_mempty = mempty == (unpackS (mempty :: TL.Text))
204t_IsString = fromString `eqP` (T.unpack . fromString)
206t_IsString = fromString `eqP` (T.unpack . fromString)
@@ -262,11 +264,14 @@ s_map_s f = map f `eqP` (unpackS . S.unstream . S.map f)
262sf_map p f = (map f . L.filter p) `eqP` (unpackS . S.map f . S.filter p)
264sf_map p f = (map f . L.filter p) `eqP` (unpackS . S.map f . S.filter p)
263t_map f = map f `eqP` (unpackS . T.map f)
265t_map f = map f `eqP` (unpackS . T.map f)
264tl_map f = map f `eqP` (unpackS . TL.map f)
266tl_map f = map f `eqP` (unpackS . TL.map f)
267+s_intercalate c = unsquare $
265−s_intercalate c = L.intercalate c `eq`
268+ L.intercalate c `eq`
266 (unpackS . S.intercalate (packS c) . map packS)
269 (unpackS . S.intercalate (packS c) . map packS)
270+t_intercalate c = unsquare $
267−t_intercalate c = L.intercalate c `eq`
271+ L.intercalate c `eq`
268 (unpackS . T.intercalate (packS c) . map packS)
272 (unpackS . T.intercalate (packS c) . map packS)
273+tl_intercalate c = unsquare $
269−tl_intercalate c = L.intercalate c `eq`
274+ L.intercalate c `eq`
270 (unpackS . TL.intercalate (TL.pack c) . map TL.pack)
275 (unpackS . TL.intercalate (TL.pack c) . map TL.pack)
271s_intersperse c = L.intersperse c `eqP`
276s_intersperse c = L.intersperse c `eqP`
272 (unpackS . S.intersperse c)
277 (unpackS . S.intersperse c)
@@ -274,10 +279,14 @@ s_intersperse_s c = L.intersperse c `eqP`
274 (unpackS . S.unstream . S.intersperse c)
279 (unpackS . S.unstream . S.intersperse c)
275sf_intersperse p c= (L.intersperse c . L.filter p) `eqP`
280sf_intersperse p c= (L.intersperse c . L.filter p) `eqP`
276 (unpackS . S.intersperse c . S.filter p)
281 (unpackS . S.intersperse c . S.filter p)
282+t_intersperse c = unsquare $
277−t_intersperse c = L.intersperse c `eqP` (unpackS . T.intersperse c)
283+ L.intersperse c `eqP` (unpackS . T.intersperse c)
284+tl_intersperse c = unsquare $
278−tl_intersperse c = L.intersperse c `eqP` (unpackS . TL.intersperse c)
285+ L.intersperse c `eqP` (unpackS . TL.intersperse c)
286+t_transpose = unsquare $
279−t_transpose = L.transpose `eq` (map unpackS . T.transpose . map packS)
287+ L.transpose `eq` (map unpackS . T.transpose . map packS)
288+tl_transpose = unsquare $
280−tl_transpose = L.transpose `eq` (map unpackS . TL.transpose . map TL.pack)
289+ L.transpose `eq` (map unpackS . TL.transpose . map TL.pack)
281t_reverse = L.reverse `eqP` (unpackS . T.reverse)
290t_reverse = L.reverse `eqP` (unpackS . T.reverse)
282tl_reverse = L.reverse `eqP` (unpackS . TL.reverse)
291tl_reverse = L.reverse `eqP` (unpackS . TL.reverse)
283t_reverse_short n = L.reverse `eqP` (unpackS . S.reverse . shorten n . S.stream)
292t_reverse_short n = L.reverse `eqP` (unpackS . S.reverse . shorten n . S.stream)
@@ -374,17 +383,24 @@ sf_foldr p f z = (L.foldr f z . L.filter p) `eqP` (S.foldr f z . S.filter p)
374 where _types = f :: Char -> Char -> Char
383 where _types = f :: Char -> Char -> Char
375t_foldr f z = L.foldr f z `eqP` T.foldr f z
384t_foldr f z = L.foldr f z `eqP` T.foldr f z
376 where _types = f :: Char -> Char -> Char
385 where _types = f :: Char -> Char -> Char
386+tl_foldr f z = unsquare $
377−tl_foldr f z = L.foldr f z `eqP` TL.foldr f z
387+ L.foldr f z `eqP` TL.foldr f z
378 where _types = f :: Char -> Char -> Char
388 where _types = f :: Char -> Char -> Char
389+sf_foldr1 p f = unsquare $
379−sf_foldr1 p f = (L.foldr1 f . L.filter p) `eqP` (S.foldr1 f . S.filter p)
390+ (L.foldr1 f . L.filter p) `eqP` (S.foldr1 f . S.filter p)
380t_foldr1 f = L.foldr1 f `eqP` T.foldr1 f
391t_foldr1 f = L.foldr1 f `eqP` T.foldr1 f
392+tl_foldr1 f = unsquare $
381−tl_foldr1 f = L.foldr1 f `eqP` TL.foldr1 f
393+ L.foldr1 f `eqP` TL.foldr1 f
382
394
395+s_concat_s = unsquare $
383−s_concat_s = L.concat `eq` (unpackS . S.unstream . S.concat . map packS)
396+ L.concat `eq` (unpackS . S.unstream . S.concat . map packS)
397+sf_concat p = unsquare $
384−sf_concat p = (L.concat . map (L.filter p)) `eq`
398+ (L.concat . map (L.filter p)) `eq`
385 (unpackS . S.concat . map (S.filter p . packS))
399 (unpackS . S.concat . map (S.filter p . packS))
400+t_concat = unsquare $
386−t_concat = L.concat `eq` (unpackS . T.concat . map packS)
401+ L.concat `eq` (unpackS . T.concat . map packS)
402+tl_concat = unsquare $
387−tl_concat = L.concat `eq` (unpackS . TL.concat . map TL.pack)
403+ L.concat `eq` (unpackS . TL.concat . map TL.pack)
388sf_concatMap p f = unsquare $ (L.concatMap f . L.filter p) `eqP`
404sf_concatMap p f = unsquare $ (L.concatMap f . L.filter p) `eqP`
389 (unpackS . S.concatMap (packS . f) . S.filter p)
405 (unpackS . S.concatMap (packS . f) . S.filter p)
390t_concatMap f = unsquare $
406t_concatMap f = unsquare $
@@ -540,24 +556,27 @@ tl_groupBy p = L.groupBy p `eqP` (map unpackS . TL.groupBy p)
540t_inits = L.inits `eqP` (map unpackS . T.inits)
556t_inits = L.inits `eqP` (map unpackS . T.inits)
541tl_inits = L.inits `eqP` (map unpackS . TL.inits)
557tl_inits = L.inits `eqP` (map unpackS . TL.inits)
542t_tails = L.tails `eqP` (map unpackS . T.tails)
558t_tails = L.tails `eqP` (map unpackS . T.tails)
559+tl_tails = unsquare $
543−tl_tails = L.tails `eqP` (map unpackS . TL.tails)
560+ L.tails `eqP` (map unpackS . TL.tails)
544−t_findAppendId (NotEmpty s) = unsquare $ \ts ->
561+t_findAppendId = unsquare $ \(NotEmpty s) ts ->
545 let t = T.intercalate s ts
562 let t = T.intercalate s ts
546 in all (==t) $ map (uncurry T.append) (T.breakOnAll s t)
563 in all (==t) $ map (uncurry T.append) (T.breakOnAll s t)
547−tl_findAppendId (NotEmpty s) = unsquare $ \ts ->
564+tl_findAppendId = unsquare $ \(NotEmpty s) ts ->
548 let t = TL.intercalate s ts
565 let t = TL.intercalate s ts
549 in all (==t) $ map (uncurry TL.append) (TL.breakOnAll s t)
566 in all (==t) $ map (uncurry TL.append) (TL.breakOnAll s t)
567+t_findContains = unsquare $ \(NotEmpty s) ->
550−t_findContains (NotEmpty s) = all (T.isPrefixOf s . snd) . T.breakOnAll s .
568+ all (T.isPrefixOf s . snd) . T.breakOnAll s . T.intercalate s
551− T.intercalate s
552−tl_findContains (NotEmpty s) = all (TL.isPrefixOf s . snd) .
569+tl_findContains = unsquare $ \(NotEmpty s) -> all (TL.isPrefixOf s . snd) .
553 TL.breakOnAll s . TL.intercalate s
570 TL.breakOnAll s . TL.intercalate s
554sl_filterCount c = (L.genericLength . L.filter (==c)) `eqP` SL.countChar c
571sl_filterCount c = (L.genericLength . L.filter (==c)) `eqP` SL.countChar c
555t_findCount s = (L.length . T.breakOnAll s) `eq` T.count s
572t_findCount s = (L.length . T.breakOnAll s) `eq` T.count s
556tl_findCount s = (L.genericLength . TL.breakOnAll s) `eq` TL.count s
573tl_findCount s = (L.genericLength . TL.breakOnAll s) `eq` TL.count s
557
574
575+t_splitOn_split s = unsquare $
558−t_splitOn_split s = (T.splitOn s `eq` Slow.splitOn s) . T.intercalate s
576+ (T.splitOn s `eq` Slow.splitOn s) . T.intercalate s
577+tl_splitOn_split s = unsquare $
559−tl_splitOn_split s = ((TL.splitOn (TL.fromStrict s) . TL.fromStrict) `eq`
578+ ((TL.splitOn (TL.fromStrict s) . TL.fromStrict) `eq`
560− (map TL.fromStrict . T.splitOn s)) . T.intercalate s
579+ (map TL.fromStrict . T.splitOn s)) . T.intercalate s
561t_splitOn_i (NotEmpty t) = id `eq` (T.intercalate t . T.splitOn t)
580t_splitOn_i (NotEmpty t) = id `eq` (T.intercalate t . T.splitOn t)
562tl_splitOn_i (NotEmpty t) = id `eq` (TL.intercalate t . TL.splitOn t)
581tl_splitOn_i (NotEmpty t) = id `eq` (TL.intercalate t . TL.splitOn t)
563
582
@@ -599,10 +618,14 @@ t_lines' = lines' `eqP` (map unpackS . T.lines')
599t_words = L.words `eqP` (map unpackS . T.words)
618t_words = L.words `eqP` (map unpackS . T.words)
600
619
601tl_words = L.words `eqP` (map unpackS . TL.words)
620tl_words = L.words `eqP` (map unpackS . TL.words)
621+t_unlines = unsquare $
602−t_unlines = L.unlines `eq` (unpackS . T.unlines . map packS)
622+ L.unlines `eq` (unpackS . T.unlines . map packS)
623+tl_unlines = unsquare $
603−tl_unlines = L.unlines `eq` (unpackS . TL.unlines . map packS)
624+ L.unlines `eq` (unpackS . TL.unlines . map packS)
625+t_unwords = unsquare $
604−t_unwords = L.unwords `eq` (unpackS . T.unwords . map packS)
626+ L.unwords `eq` (unpackS . T.unwords . map packS)
627+tl_unwords = unsquare $
605−tl_unwords = L.unwords `eq` (unpackS . TL.unwords . map packS)
628+ L.unwords `eq` (unpackS . TL.unwords . map packS)
606
629
607s_isPrefixOf s = L.isPrefixOf s `eqP`
630s_isPrefixOf s = L.isPrefixOf s `eqP`
608 (S.isPrefixOf (S.stream $ packS s) . S.stream)
631 (S.isPrefixOf (S.stream $ packS s) . S.stream)
@@ -679,8 +702,9 @@ t_indices (NotEmpty s) = Slow.indices s `eq` indices s
679tl_indices (NotEmpty s) = lazyIndices s `eq` S.indices s
702tl_indices (NotEmpty s) = lazyIndices s `eq` S.indices s
680 where lazyIndices ss t = map fromIntegral $ Slow.indices (conc ss) (conc t)
703 where lazyIndices ss t = map fromIntegral $ Slow.indices (conc ss) (conc t)
681 conc = T.concat . TL.toChunks
704 conc = T.concat . TL.toChunks
682−t_indices_occurs (NotEmpty t) ts = let s = T.intercalate t ts
705+t_indices_occurs = unsquare $ \(NotEmpty t) ts ->
706+ let s = T.intercalate t ts
683− in Slow.indices t s == indices t s
707+ in Slow.indices t s == indices t s
684
708
685-- Bit shifts.
709-- Bit shifts.
686shiftL w = forAll (choose (0,width-1)) $ \k -> Bits.shiftL w k == U.shiftL w k
710shiftL w = forAll (choose (0,width-1)) $ \k -> Bits.shiftL w k == U.shiftL w k