Commits

Alan Falloon committed 0d2fb4c

Implementing the check and {quick,verbose}Check functions

Comments (0)

Files changed (1)

 module Random = struct
   include Random
+  let int n = int (max n 1)
   let char : char -> char =
     fun lim ->
       let l = Char.code lim in
           ret_gen (v1,v2,v3)
 end
 
-module Aribitrary_list(Elt:ARBITRARY) = struct
+module Arbitrary_list(Elt:ARBITRARY) = struct
   type t = Elt.t list
   let arbitrary =
     sized choose_int0 >>= vector Elt.arbitrary
   every   = (fun f (n, _) -> Format.fprintf f "%d" n) 
 }
 
+let verbose = {
+  quick with
+    every = begin fun f (n, args) ->
+      let pargs fmt l =
+        List.iter (fun a -> Format.fprintf fmt "@ %a" a ()) l
+      in
+      Format.fprintf f "@[%d:@[<hov 2>%a@]@]@;" n pargs args
+    end
+}
+
 let done_ : string -> int -> string list list -> unit =
   fun mesg ntest stamps ->
     let percentage n m =
                 ntest p result.arguments
       end
 
+module Check(T:TESTABLE) = struct
+  module E=Evaluate(T)
+  let check : config -> T.t -> unit =
+    fun config a ->
+      tests config (E.evaluate a) 0 0 []
+  let test = check quick
+  let quickCheck = test
+  let verboseCheck = check verbose
+end
 
 (* (set (make-local-variable 'flymake-ocaml-build-file) "Makefile") *)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.