如何在 Haskell 的测试框架中打印测试种子?
How to print the test seed in Haskell's test-framework?
test-framework
docs 声明它支持 "Reporting of the seed used upon a failed QuickCheck run, so you can reproduce the failure if necessary." 但是默认输出不显示这个,我找不到任何命令行选项可以打开它。
在 test-framework
中有没有办法做到这一点,还是我必须从 QuickCheck 手动打印 usedSeed
?
因为我也对这个问题的答案很感兴趣,所以我想到了这个搜索结果,是测试的详细输出。这让我得到了 hoogle 上的答案:
https://www.haskell.org/hoogle/?hoogle=verboseCheck
所以不用quickCheck :: Testable prop => prop -> IO ()
main = quickCheck propertyToTest
仅给出输出:
+++ OK, passed 100 tests.
使用verboseCheck :: Testable prop => prop -> IO ()
main = verboseCheck propertyToTest
像这个例子一样为每个测试提供冗长、详细的输出(通过:100 次):
Passed:
[-83,-52,7,-3,-92,-52,21,18,48,-72,-93,74,-30,-1,88,57,39,-20,-92,-98,-85,8,-92,22,-83,82,-39,49,70,65,-35,-7,66,38,-76,92,0,-94,-28,68,43,21,-70,25,76,39,-31,-37,-30,-1,-39,-34,14,-5,-19,54,-21,-19,-3,10,68,74,50,13,-9,54,41,-78,-77,28,-17,76,-41,-51,17,-90,56,25,58,90]
... 99 others ...
+++ OK, passed 100 tests.
由于这个问题没有答案,是我自己得到的,所以我在这里创建了一个帐户并分享它
test-framework
docs 声明它支持 "Reporting of the seed used upon a failed QuickCheck run, so you can reproduce the failure if necessary." 但是默认输出不显示这个,我找不到任何命令行选项可以打开它。
在 test-framework
中有没有办法做到这一点,还是我必须从 QuickCheck 手动打印 usedSeed
?
因为我也对这个问题的答案很感兴趣,所以我想到了这个搜索结果,是测试的详细输出。这让我得到了 hoogle 上的答案: https://www.haskell.org/hoogle/?hoogle=verboseCheck
所以不用quickCheck :: Testable prop => prop -> IO ()
main = quickCheck propertyToTest
仅给出输出:
+++ OK, passed 100 tests.
使用verboseCheck :: Testable prop => prop -> IO ()
main = verboseCheck propertyToTest
像这个例子一样为每个测试提供冗长、详细的输出(通过:100 次):
Passed:
[-83,-52,7,-3,-92,-52,21,18,48,-72,-93,74,-30,-1,88,57,39,-20,-92,-98,-85,8,-92,22,-83,82,-39,49,70,65,-35,-7,66,38,-76,92,0,-94,-28,68,43,21,-70,25,76,39,-31,-37,-30,-1,-39,-34,14,-5,-19,54,-21,-19,-3,10,68,74,50,13,-9,54,41,-78,-77,28,-17,76,-41,-51,17,-90,56,25,58,90]... 99 others ...
+++ OK, passed 100 tests.
由于这个问题没有答案,是我自己得到的,所以我在这里创建了一个帐户并分享它