Skip to content

Commit c996f44

Browse files
committed
correcting type errors, yet still not compiling because of linking problems
1 parent b3f0fcf commit c996f44

File tree

1 file changed

+45
-30
lines changed

1 file changed

+45
-30
lines changed

tests/various_tests.ml

+45-30
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@ module L = List
1212
module Sy = Sys
1313
module D = Direct
1414
module S = String
15-
15+
(*
1616
module Sz3 = Solve.Solve(Smtz3.SMTz3)
1717
module Sminisat = Solve.Solve(Smtminisat.Smtmini)
18+
module Dummy = struct let truc = 1 end
19+
module SmtMsat = Solve.Solve(Smtmsat.SMTmsat(Dummy)) *)
1820

19-
module Dummy =
20-
struct
21-
let truc = 1
22-
end
2321

2422
let pf = Printf.printf
2523
let spf = Printf.sprintf
2624

25+
let max_var = 50;;
26+
2727
(*--------------------------------------------------------*)
2828
(* Génération aléatoire de formule *)
2929
(*--------------------------------------------------------*)
30-
let variables = ["p";"q";"p2";"q2";"r";"r2";"s";"s2"]
30+
(* let variables = ["p";"q";"p2";"q2";"r";"r2";"s";"s2"] *)
3131

32-
let tire_var () =
32+
let tire_var max_var =
3333
begin
3434
R.self_init ();
35-
L.nth variables (R.int 4);
35+
R.int max_var;
3636
end
3737

3838

39-
let rec tire_form n =
39+
let rec tire_form n max_var =
4040
begin
4141
R.self_init ();
4242
match n with
4343
| 0 ->
4444
begin
4545
match R.int 2 with
46-
| 0 -> M.Atom (tire_var () )
47-
| _ -> M.Not (M.Atom (tire_var () ))
46+
| 0 -> M.Atom (tire_var max_var )
47+
| _ -> M.Not (M.Atom (tire_var max_var ))
4848
end
4949
| n ->
5050
begin
5151
match (R.int 4) with
52-
| 0 -> M.Conj (tire_form (n-1),tire_form (n-1))
53-
| 1 -> M.Dij (tire_form (n-1),tire_form (n-1))
54-
| 2 -> M.Boxe (tire_form(n-1))
55-
| _ -> M.Diamond (tire_form (n-1))
52+
| 0 -> M.Conj (tire_form (n-1) max_var, tire_form (n-1) max_var)
53+
| 1 -> M.Dij (tire_form (n-1) max_var, tire_form (n-1) max_var)
54+
| 2 -> M.Boxe (tire_form(n-1) max_var)
55+
| _ -> M.Diamond (tire_form (n-1) max_var)
5656
end;
5757

5858
end
@@ -103,10 +103,10 @@ let get_logic () =
103103
(*--------------------------------------------------------*)
104104

105105
let handle = function
106-
| C.MeauvaisFormat s ->
106+
| C.WrongFormat s ->
107107
pf "Erreur : meauvais format \n %s \n" s
108-
| C.FreeVDM (v1,v2,s) ->
109-
pf "Erreur : les variables %s et %s ne matchent pas : \n %s \n" v1 v2 s
108+
| C.FreeVDontMatch (v1,v2,s) ->
109+
pf "Erreur : les variables %d et %d ne matchent pas : \n %s \n" v1 v2 s
110110
| _ -> ()
111111

112112
let print_debug s =
@@ -131,8 +131,16 @@ let get_arg () =
131131
begin
132132
pf "le second argument est la profondeur max \n";
133133
exit 1;
134-
end
135-
in (nb,n)
134+
end
135+
and max_var =
136+
try int_of_string (Sy.argv.(3))
137+
with
138+
| _ ->
139+
begin
140+
pf "le troisième argument est le nomre de variables \n";
141+
exit 1;
142+
end
143+
in (nb, n, max_var)
136144
(*
137145
let rec check_form = function
138146
| M.Atom _ -> true
@@ -147,7 +155,8 @@ let rec check_form = function
147155

148156

149157
let _ =
150-
let nb,n = get_arg ()
158+
let nb, n, max_var = get_arg ()
159+
and a,_ = get_logic ()
151160
and t0 = ref 0.
152161
and t_sz3 = ref 0.
153162
and t_direct = ref 0.
@@ -163,13 +172,19 @@ and res_minisat = ref true
163172
and res_direct = ref true
164173
and out = None (* Some (open_out "test.out") *)
165174
and res = open_out_gen [Open_append] 777 "resultatsz3.csv"
166-
and comp = ref 0
175+
and comp = ref 0 in
176+
let module Argument = struct let argument = a end in
177+
let module Decide = Decide.GetDecide(Argument) in
178+
let module Simplify = Simplify.GetSimplify(Argument) in
179+
let module SmtZ3 = Solve.Solve(Smtz3.SMTz3)(Decide)(Simplify) in
180+
let module SmtMinisat = Solve.Solve(Smtminisat.Smtmini)(Decide)(Simplify) in
181+
let module Dummy = struct let truc = 1 end in
182+
let module SmtMsat = Solve.Solve(Smtmsat.SMTmsat(Dummy))(Decide)(Simplify)
167183
in begin
168184
for i = 1 to nb do
169-
let f = tire_form n in
170-
let f0 = C.st "w" f
171-
and a,_ = get_logic () in
172-
let module Smsat = Solve.Solve(Smtmsat.SMTmsat(Dummy))
185+
let f = tire_form n max_var in
186+
let f0 = C.st 0 f in
187+
let module Smsat = Solve.Solve(Smtmsat.SMTmsat(Dummy))(Decide)(Simplify)
173188
in begin
174189
pf "========================= \n";
175190
(*
@@ -181,20 +196,20 @@ in begin
181196
On fait les résolutions avec les différents oracles
182197
*)
183198

184-
t0 := U.gettimeofday () ;
199+
(* t0 := U.gettimeofday () ;
185200
res_sz3 := Sz3.solve f0 a ;
186201
dt_sz3 := (U.gettimeofday () -. !t0);
187202
t_sz3 := !t_sz3 +. !dt_sz3;
188-
203+
*)
189204

190205
t0 := U.gettimeofday () ;
191-
res_msat := Smsat.solve f0 a ;
206+
res_msat := SmtMsat.solve f;
192207
dt_msat:= (U.gettimeofday () -. !t0);
193208
t_msat := !t_msat +. !dt_msat;
194209

195210

196211
t0 := U.gettimeofday () ;
197-
res_minisat := Sminisat.solve f0 a ;
212+
res_minisat := SmtMinisat.solve f;
198213
dt_minisat:= (U.gettimeofday () -. !t0);
199214
t_minisat := !t_minisat +. !dt_minisat;
200215

0 commit comments

Comments
 (0)