Skip to content

Commit

Permalink
Reduce default number of quickcheck tests in dejafu-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barrucadu committed Dec 8, 2017
1 parent 455a0f4 commit 4791333
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions dejafu-tests/Main.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
module Main where

import Test.Framework (Test, defaultMain, testGroup)
import Data.Maybe (fromMaybe)
import System.Environment (getArgs)
import qualified Test.Framework as T

import Cases
import Examples

main :: IO ()
main = defaultMain allTests
main = do
opts <- setDefaults <$> (T.interpretArgsOrExit =<< getArgs)
T.defaultMainWithOpts allTests opts

allTests :: [Test]
allTests = map (uncurry testGroup)
allTests :: [T.Test]
allTests = map (uncurry T.testGroup)
[ ("Test Cases", testCases)
, ("Examples", testExamples)
]

-- | Reduce the default number of quickcheck runs.
setDefaults :: T.RunnerOptions -> T.RunnerOptions
setDefaults opts = opts { T.ropt_test_options = set (T.ropt_test_options opts) } where
set (Just opts) = Just (set' opts)
set Nothing = Just (set' (T.TestOptions Nothing Nothing Nothing Nothing Nothing Nothing))

set' opts = opts
{ T.topt_maximum_generated_tests = Just . fromMaybe 25 $
T.topt_maximum_generated_tests opts
}

0 comments on commit 4791333

Please sign in to comment.