Version française
Home     About     Download     Resources     Contact us    
Browse thread
QuickCheck for OCaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: padiolea@i...
Subject: Re: [Caml-list] QuickCheck for OCaml?
> Hi,
>
> Are there any QuickCheck like tools for OCaml?  Searched on google, but
> nothing came up.  There are unit testing libraries like OUnit, but I
> haven't came across anything like QuickCheck yet.

I use this:
 lfs.irisa.fr/~pad/hacks/quickcheck.ml

All you have to do is include this library and then put in your code
rules such as

let _ = assert
 ((Quickcheck.laws "rev" (fun xs -> reverse (reverse xs) = xs)
   (Quickcheck.lg Quickcheck.ig)) = None)

the lg and ig functions are generators (list and integer generators).


By the way it also include a unit framework, but
it is just
  let testunitframework b = assert b   :)
that you use by writing for instance

let _ = testunitframework (List.map (fun x -> x +1) [1;2;3;4] = [2;3;4;5])






>
>
> Regards,
> Chris Campbell
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>