[Haskell-cafe] reimplementing break (incorrectly) "quickcheck p list" gives me feedback that it breaks on list, but not what predicate test caused the breakage

Ketil Malde ketil at ii.uib.no
Fri Jul 6 02:56:33 EDT 2007


On Thu, 2007-07-05 at 19:37 -0400, Thomas Hartman wrote:

> I am a total quickcheck noob. Is there a way to find out what
> predicate test "<function>" is, below? 

> testMyBreak    = quickCheck $ \p l -> myBreak p (l :: [Int]) == break p l 

Well - you could try naming the qc property?  I.e.

	prop_myBreak p l = myBreak p l == break p l
	testMyBreak = quickCheck prop_myBreak

> Also, is there a way I can ask quickcheck to test lists of various
> built in types, not just Int? 

Yes.  You need to declare instances of 'Arbitrary' for custom data
types, which allows QuickCheck to manufacture random values of that
type.

-k

PS: Is this use of uPIO legal?  Sound?  Sensible?

	prop_serialize (E s) = 
	    let [s'] = unsafePerformIO (do writeFasta "/tmp/serialize_test" [s]
	                                   readFasta "/tmp/serialize_test")
 	    in s == s'




More information about the Haskell-Cafe mailing list