
On Fri, 29 Jun 2012 08:43:33 +0100
Lorenzo Bolla
Are the examples in the package distribution of any help? https://github.com/batterseapower/test-framework/blob/master/example/Test/Fr...
L.
I was thinking more about parametres set in Haskell code itself. There is something like TestOptions (http://hackage.haskell.org/packages/archive/test-framework/0.6/doc/html/Test...) and RunnerOptions (http://hackage.haskell.org/packages/archive/test-framework/0.6/doc/html/Test...) but I do not find any examples of using them. Similarly, I do not know how to set them up.
On Fri, Jun 29, 2012 at 6:30 AM, Mateusz Neumann
wrote: Hi,
I am currently writing testing routines for my project. I have came across an interesting test-framework (http://hackage.haskell.org/package/test-framework-0.6). Do you know it? I use QuickCheck2 provider (Test.Framework.Providers.QuickCheck2) to property tests. And here is my problem: I find configuring the provider very confusing, I cannot set (in Haskell code) for example number of tests to run or other QuickCheck parameters. Could you please help?
Thanks
-- Mateusz
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Mateusz

On 06/29/12 03:58, Mateusz Neumann wrote:
On Fri, 29 Jun 2012 08:43:33 +0100 Lorenzo Bolla
wrote: Are the examples in the package distribution of any help? https://github.com/batterseapower/test-framework/blob/master/example/Test/Fr...
L.
I was thinking more about parametres set in Haskell code itself. There is something like TestOptions (http://hackage.haskell.org/packages/archive/test-framework/0.6/doc/html/Test...) and RunnerOptions (http://hackage.haskell.org/packages/archive/test-framework/0.6/doc/html/Test...) but I do not find any examples of using them. Similarly, I do not know how to set them up.
Here's an example main function that also uses test-framework-doctest. There's only one trick used: because TestOptions/RunnerOptions are instances of monoid, we can use "mempty" to get an empty set of options. This is a little more fun than creating an empty record by hand. main :: IO () main = do dt <- docTest ["src/Everything.hs"] ["-isrc"] let empty_test_opts = mempty :: TestOptions let my_test_opts = empty_test_opts { topt_maximum_generated_tests = Just 500 } let empty_runner_opts = mempty :: RunnerOptions let my_runner_opts = empty_runner_opts { ropt_test_options = Just my_test_opts } defaultMainWithOpts ([dt] ++ tests) my_runner_opts

On Fri, 29 Jun 2012 11:50:13 -0400
Michael Orlitzky
On 06/29/12 03:58, Mateusz Neumann wrote:
On Fri, 29 Jun 2012 08:43:33 +0100 Lorenzo Bolla
wrote: Are the examples in the package distribution of any help? https://github.com/batterseapower/test-framework/blob/master/example/Test/Fr...
L.
I was thinking more about parametres set in Haskell code itself. There is something like TestOptions (http://hackage.haskell.org/packages/archive/test-framework/0.6/doc/html/Test...) and RunnerOptions (http://hackage.haskell.org/packages/archive/test-framework/0.6/doc/html/Test...) but I do not find any examples of using them. Similarly, I do not know how to set them up.
Here's an example main function that also uses test-framework-doctest.
There's only one trick used: because TestOptions/RunnerOptions are instances of monoid, we can use "mempty" to get an empty set of options. This is a little more fun than creating an empty record by hand.
main :: IO () main = do dt <- docTest ["src/Everything.hs"] ["-isrc"]
let empty_test_opts = mempty :: TestOptions let my_test_opts = empty_test_opts { topt_maximum_generated_tests = Just 500 }
let empty_runner_opts = mempty :: RunnerOptions let my_runner_opts = empty_runner_opts { ropt_test_options = Just my_test_opts }
defaultMainWithOpts ([dt] ++ tests) my_runner_opts
Thanks a lot. That works just as I wanted it to do :) Just for the record, the relevant part of my code looks like this: main :: IO () main = defaultMainWithOpts tests runnerOpts where testOpts = (mempty :: TestOptions) { topt_maximum_generated_tests = Just 500 } runnerOpts = (mempty :: RunnerOptions) { ropt_test_options = Just testOpts }
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Mateusz
participants (2)
-
Mateusz Neumann
-
Michael Orlitzky