QuickCheck 2 有什么新功能?
QuickCheck 1 和 QuickCheck 2 之间的主要区别是什么?通过查看 Haddock 文档,我可以看到它分为更多模块,co Arbitrary
已被新的 Fun
类型和 FunArbitrary
类取代(这对我来说似乎更容易理解),并且现在支持测试单子代码。我还应该注意什么?
What are the major differences between QuickCheck 1 and QuickCheck 2? From looking at Haddock docs I can see that it is split across more modules, coarbitrary
has been replaced by the new Fun
type and FunArbitrary
class (which seems easier to understand to me), and testing monadic code is now supported. What else should I be aware of?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 QuickCheck 2 中看到了一项重大进步,我认为它与单子代码测试一样重要,甚至更重要:
这真的非常棒。收缩方法是可选的,但如果您可以提供一个“可能为空”的类型缩减列表,那么当 QuickCheck 发现错误检查时,它会尝试通过收缩来将错误数据减少到最少,然后重新进行重新排序。 -测试一下。只要失败它就会缩小。
一个小样本可以让您信服,无需缩小:
带有:
更短的失败示例意味着更快的调试:-)
I've seen one major advancement in QuickCheck 2, I think as important as monadic code testing, if not more :
This, is really awesome. The shrink method is optional, but if you can provide a list of "possibly empty" reduction of your type, then when QuickCheck find a faulty check, it will try to reduce your faulty data to the minimum by trying to shrink it and then re-test it. It shrink it as long as it fails.
A little sample to convince you, Without shrinking :
With :
Shorter fail example mean quicker debug :-)