From: Claudio Sacerdoti Coen Date: Thu, 7 Jun 2018 17:43:58 +0000 (+0200) Subject: More randomness in test generation X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=ade646a9ae308c0ceacbfb82d85eb4552bec77b2;p=fireball-separation.git More randomness in test generation --- diff --git a/ocaml/simple_test.ml b/ocaml/simple_test.ml index 3ec4bb7..ed2c81c 100644 --- a/ocaml/simple_test.ml +++ b/ocaml/simple_test.ml @@ -36,23 +36,23 @@ let gen n vars = let rec repeat f n = print_endline "\n########################### NEW TEST ###########################"; - f () ; + f n ; if n > 0 then repeat f (n-1) ;; let main = Random.self_init (); - let num = 100 in - let complex = 100 in - let no_bound_vars = 10 in - let vars = Array.to_list - (Array.init no_bound_vars (fun x -> "x" ^ string_of_int x)) in - + let num = 1000 in + (*let complex = 100 in + let no_bound_vars = 10 in*) let file = Filename.temp_file ~temp_dir:"./problems/" "simple.constants.auto." "" in let oc = open_out file in print_endline ("\n\n---- " ^ file) ; - - repeat (fun _ -> + repeat (fun x -> + let complex = 100 + x / 10 in + let no_bound_vars = Random.int 20 + 1 in + let vars = Array.to_list + (Array.init no_bound_vars (fun x -> "x" ^ string_of_int x)) in let div, convs = gen complex vars in let str = " \nD " ^ div ^ String.concat "\nC " convs ^ "\n" in print_endline str; @@ -62,7 +62,6 @@ let main = let str = "$ failing test problem \n# Failed because: " ^ Printexc.to_string e ^ str in Printf.fprintf oc "%s\n" str ) num ; - close_out oc; print_endline ("\n\n---- " ^ file); let filesize filename =