packages feed

MuCheck-SmallCheck (empty) → 0.2.0.0

raw patch · 6 files changed

+92/−0 lines, 6 filesdep +MuCheckdep +basedep +smallchecksetup-changed

Dependencies added: MuCheck, base, smallcheck

Files

+ LICENSE view
+ MuCheck-SmallCheck.cabal view
@@ -0,0 +1,40 @@+name:                MuCheck-SmallCheck+version:             0.2.0.0+synopsis:            Automated Mutation Testing for SmallCheck tests+description:         This package contains the test adapter for SmallCheck tests to use it with MuCheck+homepage:            https://bitbucket.com/osu-testing/mucheck-smallcheck+license:             GPL-2+license-file:        LICENSE+author:              Rahul Gopinath <rahul@gopinath.org>+maintainer:          rahul@gopinath.org+category:            Testing+build-type:          Simple+cabal-version:       >= 1.10+extra-source-files:  changes.md++source-repository    head+  type:              git+  location:          https://bitbucket.org/osu-testing/mucheck-smallcheck.git++source-repository    this+  type:              git+  location:          https://bitbucket.org/osu-testing/mucheck-smallcheck.git+  tag:               0.2.0.0++executable mucheck-smallcheck+  build-depends:    base >=4 && <5,+                    smallcheck == 1.1.1,+                    MuCheck== 0.2.0.*+  default-language: Haskell2010+  hs-source-dirs:   src+  main-is:          Main.hs+  ghc-options:     -Wall -fno-warn-orphans++library+  exposed-modules:  Test.MuCheck.TestAdapter.SmallCheck+  build-depends:    base >=4 && <5,+                    smallcheck == 1.1.1,+                    MuCheck==0.2.0.*+  default-language: Haskell2010+  hs-source-dirs:   src+
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple++main = defaultMain
+ changes.md view
+ src/Main.hs view
@@ -0,0 +1,22 @@+module Main where+import System.Environment (getArgs, withArgs)++import Test.MuCheck (mucheck)+import Test.MuCheck.TestAdapter.SmallCheck+import Test.MuCheck.TestAdapter+import Test.MuCheck.Utils.Print++main :: IO ()+main = do+  val <- getArgs+  case val of+    ("-h" : _ ) -> help+    (fn : file : modulename : args) -> withArgs [] $ mucheck tsFn fn file modulename args+    _ -> error "Need function file modulename [args]\n\tUse -h to get help"+  where tsFn :: [MutantFilename] -> [InterpreterOutput SmallCheckSummary] -> Summary+        tsFn = testSummary+++help :: IO ()+help = putStrLn $ "mucheck function file modulename [args]\n" ++ showAS ["E.g:",+       " mucheck-smallcheck qsort Examples/SmallCheckTest.hs Examples.SmallCheckTest 'smallCheckResult idEmpProp'",""]
+ src/Test/MuCheck/TestAdapter/SmallCheck.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable, TypeSynonymInstances, FlexibleInstances #-}+-- | Module for using quickcheck properties+module Test.MuCheck.TestAdapter.SmallCheck where+import qualified Test.SmallCheck.Drivers as Sc+import Test.MuCheck.TestAdapter+import Test.MuCheck.Utils.Print (showA, showAS)++import Data.Typeable+import Data.List((\\))+import Data.Either (partitionEithers)++type SmallCheckSummary = Maybe Sc.PropertyFailure+deriving instance Typeable Sc.PropertyFailure++-- | Summarizable instance of `SmallCheckSummary`+instance Summarizable SmallCheckSummary where+  testSummary mutantFiles results = Summary logMsg+    where (errorCases, executedCases) = partitionEithers results+          [successCases, failureCases] = map (\c -> filter (c . snd) executedCases) [isSuccess, isFailure]+          errorFiles = mutantFiles \\ map fst executedCases+          logMsg = showAS ["Details:",+                           "Loading error files:", showA errorFiles,+                           "Loading error messages:", showA errorCases,+                           "Successes:", showA successCases,+                           "Failure:", showA failureCases]+  isSuccess Nothing = True+  isSuccess _       = False