X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=ocaml%2Ftest.ml;h=3b6d904fd1f231db2f585f3fbdaedd3810d216e2;hb=4ca74b77536dcd58dfff5e09996b6d8bb117c60a;hp=da6dbda7a7f813e0496ccb3d31d2647b4982c42f;hpb=b9e5cc50618b83f4069608c62be8c4a173c9446f;p=fireball-separation.git diff --git a/ocaml/test.ml b/ocaml/test.ml index da6dbda..3b6d904 100644 --- a/ocaml/test.ml +++ b/ocaml/test.ml @@ -12,24 +12,14 @@ let acaso2 l1 l2 = if n >= n1 then List.nth l2 (n - n1) else List.nth l1 n ;; -let rec take l n = +(* let rec take l n = if n = 0 then [] else match l with | [] -> [] | x::xs -> x :: (take xs (n-1)) -;; - -let test3 n vars = - let rec aux n inerts lams = - if n = 0 then take (Util.sort_uniq inerts) 5 - else let inerts, lams = if Random.int 2 = 0 - then inerts, ("(" ^ acaso vars ^ ". " ^ acaso2 inerts lams ^ ")") :: lams - else ("(" ^ acaso inerts ^ " " ^ acaso2 inerts lams^ ")") :: inerts, lams - in aux (n-1) inerts lams - in aux (2*n) vars [] -;; +;; *) -let test4 n vars = +let gen n vars = let rec take' l n = if n = 0 then [], [] else match l with @@ -47,17 +37,12 @@ let test4 n vars = let rec repeat f n = - prerr_endline "\n*************************** NEW TEST ***************************"; + prerr_endline "\n########################### NEW TEST ###########################"; f () ; if n > 0 then repeat f (n-1) ;; -(* let call_main3 tms = - let _ = ( - List.iter prerr_endline tms; prerr_newline (); - ) in Lambda3.main [Lambda3.magic tms ["*"]] -;; *) -let call_main4 div convs nums = +let solve div convs nums = let p = String.concat "\n" ( "$! randomly generated test" :: ("D " ^ div) :: @@ -74,16 +59,9 @@ let main = let complex = 200 in let vars = ["x"; "y"; "z"; "v" ; "w"; "a"; "b"; "c"] in - (* let open Parser in *) - - (* if three then repeat (fun _ -> - let tms = test3 complex vars in - call_main3 tms - ) num - else *) repeat (fun _ -> - let div, (conv, nums) = test4 complex vars in - call_main4 div conv nums + let div, (conv, nums) = gen complex vars in + solve div conv nums ) num ;