-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce default number of quickcheck tests in dejafu-tests
- Loading branch information
Showing
1 changed file
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |