如何让Haskell QuickCheck 2.4增加#测试? [英] How to get Haskell QuickCheck 2.4 to increase # tests?

查看:148
本文介绍了如何让Haskell QuickCheck 2.4增加#测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,正如我通过上一个问题所了解的那样,RWH书已经没有了日期为QuickCheck。尽管我读过的所有帖子都告诉我如何使用QuickCheck非常简单,但我找不到任何地方告诉我如何更改测试的数量以运行属性。



RWH表示:

  handyCheck限制=检查defaultConfig {
configMaxTest =限制
,configEvery = \__ - >
}

如何使用QuickCheck 2.4执行此操作?更重要的是,我将如何发现自己?请不要告诉我,我应该可以从API文档中找到它。 你正在寻找for:

  quickCheckWith stdArgs {maxSuccess = 5000} someProp 

我如何找到


  1. 我去了 API文档

  2. 我在 quickCheck 后面看到的第二件事是 Args 类型,其中 maxSuccess 字段。

  3. 我不想写所有的字段,所以我查找了 Args - 找到 stdArgs 。 (使用你的浏览器搜索功能 - 通常按Ctrl - F)。 OTOH,我可以使用 hoogle

  4. 我需要使用我的 Args 类型的地方,所以我一直在寻找。下一行是 quickCheckWith - 宾果!另一方面,我可以使用 hoogle

您还可以找出其他方式 p>

正如我上面所说的,假设您意识到 Args 类型,您可以使用hoogle来查找很多函数是你需要的核心(来自haddocks)。



否则,你可能会减少看其他软件包的功能,这意味着你需要知道其他软件包软件包值得一看。 QuickCheck中的示例文件夹似乎很明显,但并非所有软件包都包含这些示例。使用反向依赖关系,您通常可以找到一个包来查看,但对于QC批次包,没有显式的依赖关系。


Okay, as I learned via my previous question, the RWH book is already out of date for QuickCheck. And despite all the posts I've read that tell me how incredibly simple it is to use QuickCheck, I cannot find any place that tells me how to change the number of tests to run for a property.

RWH says:

handyCheck limit = check defaultConfig {
                     configMaxTest = limit
                   , configEvery   = \_ _ -> ""
                   }

How to do this with QuickCheck 2.4? More importantly, how would I have found out myself? Please don't tell me that I should've been able to figure it out from the API documentation.

解决方案

You are looking for:

quickCheckWith stdArgs { maxSuccess = 5000 } someProp

How I found out

  1. I went to the API documentation.
  2. The 2nd thing I saw, after quickCheck was the Args type with a maxSuccess field.
  3. I didn't want to write all the fields, so I looked for a value of type Args - finding stdArgs. (Use your browsers search function - ctrl-f usually). OTOH, I could have used hoogle.
  4. I needed to use my Args type somewhere so I kept looking. The next line was quickCheckWith - bingo! On the other hand, I could have used hoogle.

How Else Can You Find Out

As I stated above, you could have used hoogle to find a lot of the functions, assuming you realize the Args type is the core of what you need (from the haddocks).

Otherwise, you are probably reduced to looking at what other packages do, which means you need to know what other packages are worth looking at. The examples folder in QuickCheck seems obvious, but not all packages include such examples. Using reverse dependencies you can often find a package to look at, but for QC lots of packages don't have explicit dependencies.

这篇关于如何让Haskell QuickCheck 2.4增加#测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆