Reduce default number of quickcheck tests in dejafu-tests

This commit is contained in:
Michael Walker 2017-12-07 19:48:38 +00:00
parent 455a0f4ba7
commit 4791333dc0

View File

@ -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
}