[Haskell-cafe] Using quickcheck with test-framework (collect doesn't work)

Rafael Almeida almeidaraf at gmail.com
Sat Jun 7 18:50:36 UTC 2014


Hello,

I'm trying to use quickcheck with test-framework. QuickCheck site says I
can use a function called collect to see statistics of data generation. The
function "collect" doesn't seem to print anything, though. This is the
output I get after running cabal test:

Running 1 test suites...
Test suite reference: RUNNING...
Test suite reference: PASS
Test suite logged to: dist/test/100doors-0.1-reference.log
1 of 1 test suites (1 of 1 test cases) passed.

This is what I see inside the log:

Test suite reference: RUNNING...
Main:
  flipped door is different state: [OK, passed 100 tests]
  flipDoors creates a different list of doors unless empty: [OK, passed 100
tests]

         Properties  Total
 Passed  2           2
 Failed  0           0
 Total   2           2
Test suite reference: PASS
Test suite logged to: dist/test/100doors-0.1-reference.log

This is my test code (stripping out the boring parts):
instance Arbitrary Door where
    arbitrary = elements [Opened, Closed]

prop_flipped_door_is_different_state door = door /= flipDoor door

prop_flipDoors_creates_a_different_list_of_doors_unless_empty n doors =
collect n $ (not $ null doors) ==> doors /= (flipDoors n doors)

[]'s
Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140607/9be211de/attachment.html>


More information about the Haskell-Cafe mailing list