pqc 0.4 → 0.4.1
raw patch · 4 files changed
+36/−11 lines, 4 filesdep +ChasingBottomsPVP ok
version bump matches the API change (PVP)
Dependencies added: ChasingBottoms
API changes (from Hackage documentation)
Files
- LICENSE +1/−1
- Test/QuickCheck/Parallel.hs +17/−5
- examples/Example.hs +15/−3
- pqc.cabal +3/−2
LICENSE view
@@ -1,4 +1,4 @@-Copyright Don Stewart 2006.+Copyright Don Stewart 2006-2007, shelarcy 2011. All rights reserved.
Test/QuickCheck/Parallel.hs view
@@ -2,12 +2,12 @@ ----------------------------------------------------------------------------- -- | -- Module : Test.QuickCheck.Parallel--- Copyright : (c) Don Stewart 2006+-- Copyright : (c) Don Stewart 2006-2007, shelarcy 2011 -- License : BSD-style (see the file LICENSE) -- -- Maintainer : shelarcy <shelarcy@gmail.com> -- Stability : experimental--- Portability : non-portable (uses Control.Exception, Control.Concurrent)+-- Portability : non-portable (uses Control.Concurrent, GHC.Conc ) -- -- A parallel batch driver for running QuickCheck on threaded or SMP systems. -- See the /Example.hs/ file for a complete overview.@@ -52,8 +52,17 @@ -- | Variant of 'pRunWithNum'. Run a list of QuickCheck properties in parallel -- chunks, using number of Haskell threads that can run truly simultaneously--- (on separate physical processors) at any given time. (see 'getNumCapabilities'--- for more details).+-- (on separate physical processors) at any given time. For example, +--+-- > import Test.QuickCheck.Parallel+-- >+-- > pRun' 1000+-- > [ ("sort1", pDet prop_sort1)+-- > , ("sort2", pDet prop_sort2) ]+--+-- with SMP runtime's '-N[n]' flag will run 'n' threads over the property list,+-- to depth 1000. (see 'getNumCapabilities' for more details.)+-- pRun' :: Int -> [Test] -> IO () pRun' depth tests = do #if __GLASGOW_HASKELL__ >= 702@@ -86,9 +95,12 @@ -- > import Test.QuickCheck.Parallel -- > -- > do n <- getArgs >>= readIO . head--- > pRun n 1000 [ ("sort1", pDet prop_sort1) ]+-- > pRunWithNum n 1000 [ ("sort1", pDet prop_sort1) ] -- -- Will run 'n' threads over the property list, to depth 1000.+--+-- If you want to specify 'n' by using '-N[n]', use 'pRun'' instead of+-- this function. -- pRunWithNum :: Int -> Int -> [Test] -> IO () pRunWithNum n depth tests = do
examples/Example.hs view
@@ -7,7 +7,20 @@ import Test.QuickCheck.Parallel import Data.List import System.Environment+-- If you want to test code involving bottoms, use ChasingBottoms package.+import Test.ChasingBottoms (isBottom, bottom) +prop_head1 xs =+ (not (null xs)) ==>+ head xs == xs!!0+ where types = (xs :: [Int])+-- Test bottoms+{- test for abort -}+prop_head2 = isBottom (head [])+{- test for strictness -}+prop_head3 = isBottom (head bottom)++ prop_sort1 xs = sort xs == sortBy compare xs where types = (xs :: [Int]) @@ -39,11 +52,10 @@ where types = (xs :: [Int], ys :: [Int]) ----- Run in 4 threads, to depth of 1000+-- Run in x threads (that is specified by +RTS -Nx), to depth of 1000 -- main = do- n <- getArgs >>= readIO . head- pRun n 1000 $ take 100 $ cycle+ pRun' 1000 $ take 100 $ cycle [ ("sort1", pDet prop_sort1) , ("sort2", pDet prop_sort2) , ("sort3", pDet prop_sort3)
pqc.cabal view
@@ -1,11 +1,12 @@ name: pqc-version: 0.4+version: 0.4.1 description: Parallel batch driver for QuickCheck synopsis: Parallel batch driver for QuickCheck category: Testing license: BSD3 license-file: LICENSE Author: Don Stewart+Copyright: Don Stewart 2006-2007, shelarcy 2011 Maintainer: shelarcy <shelarcy@gmail.com> homepage: http://darcsden.com/shelarcy/pqc build-type: Simple@@ -32,7 +33,7 @@ buildable: False hs-source-dirs: examples default-language: Haskell2010- build-depends: base < 5, pqc+ build-depends: base < 5, pqc, ChasingBottoms -- for GHC 7.4.1 with pRunAllProcessors -- ghc-options: -threaded -- for GHC 7.2.1 or higher