neuper@52112
|
1 |
(* Title: tests for the interface
|
neuper@52112
|
2 |
Author: Mathias Lehnfeld 2013
|
neuper@52112
|
3 |
Use is subject to license terms.
|
neuper@42321
|
4 |
*)
|
neuper@37906
|
5 |
|
walther@59800
|
6 |
"-----------------------------------------------------------------------------------------------";
|
walther@59800
|
7 |
"table of contents -----------------------------------------------------------------------------";
|
walther@59800
|
8 |
"-----------------------------------------------------------------------------------------------";
|
walther@59800
|
9 |
"-----------------------------------------------------------------------------------------------";
|
walther@59800
|
10 |
"-------- test_applyFormula --------------------------------------------------------------------";
|
walther@59983
|
11 |
"-------- ME_Misc.get_interval from ctree with move_dn:modspec.sml -------------------";
|
neuper@52112
|
12 |
"-----------------------------------------------------------------------------";
|
neuper@52112
|
13 |
"-----------------------------------------------------------------------------";
|
neuper@37906
|
14 |
|
neuper@37906
|
15 |
|
walther@59800
|
16 |
"-------- test_applyFormula --------------------------------------------------------------------";
|
walther@59800
|
17 |
"-------- test_applyFormula --------------------------------------------------------------------";
|
walther@59800
|
18 |
"-------- test_applyFormula --------------------------------------------------------------------";
|
s1210629013@52131
|
19 |
"----- this shows the principle how Isac's math-engine is made parallel ------";
|
s1210629013@52131
|
20 |
(* a store of simplified states *)
|
s1210629013@52131
|
21 |
val test_states = Unsynchronized.ref ([]: (int * string list) list)
|
s1210629013@52131
|
22 |
|
s1210629013@52131
|
23 |
(* a simplified getter *)
|
s1210629013@52131
|
24 |
fun test_get_calc cI =
|
walther@59686
|
25 |
case LibraryC.assoc (!test_states, cI) of
|
Walther@60549
|
26 |
NONE => error ("States.get_calc " ^ string_of_int cI ^ " not existent")
|
s1210629013@52131
|
27 |
| SOME c => c;
|
s1210629013@52131
|
28 |
|
s1210629013@52131
|
29 |
(* a simplified updater *)
|
s1210629013@52131
|
30 |
fun test_upd_calc cI cs =
|
walther@59686
|
31 |
(if is_none (LibraryC.assoc (!test_states, cI))
|
Walther@60549
|
32 |
then writeln ("States.upd_calc created new calculation " ^ string_of_int cI)
|
s1210629013@52131
|
33 |
else ();
|
s1210629013@52131
|
34 |
test_states := overwrite (!test_states, (cI, cs)))
|
s1210629013@52131
|
35 |
|
s1210629013@52131
|
36 |
(* a dummy call of the math-engine *)
|
s1210629013@52131
|
37 |
fun test_math_engine cs = cs |> split_last ||> (fn x => x ^ "-CHECKED") ||> single |-> (curry op @);
|
s1210629013@52131
|
38 |
|
s1210629013@52131
|
39 |
test_states :=
|
s1210629013@52131
|
40 |
[(1, ["calc1-line1", "calc1-line2", "calc1-line3"]),
|
s1210629013@52131
|
41 |
(2, ["calc2-line1"]),
|
s1210629013@52131
|
42 |
(3, ["calc3-line1", "calc3-line2"])];
|
s1210629013@52131
|
43 |
test_states := [];
|
s1210629013@52131
|
44 |
|
s1210629013@52131
|
45 |
val cI = 123;
|
s1210629013@52131
|
46 |
test_upd_calc cI ["initialize 123"];
|
walther@59800
|
47 |
appendFormula cI;
|
walther@59800
|
48 |
|
walther@59983
|
49 |
"-------- ME_Misc.get_interval from ctree with move_dn:modspec.sml -------------------";
|
walther@59983
|
50 |
"-------- ME_Misc.get_interval from ctree with move_dn:modspec.sml -------------------";
|
walther@59983
|
51 |
"-------- ME_Misc.get_interval from ctree with move_dn:modspec.sml -------------------";
|
walther@59800
|
52 |
"=====new ctree 1: crippled by cut_level_'_ ======================";
|
Walther@60549
|
53 |
States.reset ();
|
Walther@60571
|
54 |
CalcTree @{context}
|
walther@60242
|
55 |
[(["equality (x/(x \<up> 2 - 6*x+9) - 1/(x \<up> 2 - 3*x) =1/x)",
|
walther@59997
|
56 |
"solveFor x", "solutions L"],
|
Walther@60590
|
57 |
("PolyEq"(*SHOULD BE RatEq*),["univariate", "equation"],["no_met"]))];
|
walther@59800
|
58 |
Iterator 1; moveActiveRoot 1;
|
walther@59800
|
59 |
autoCalculate 1 CompleteCalc;
|
walther@59800
|
60 |
|
walther@59800
|
61 |
getTactic 1 ([1],Res);(*Rewrite_Set RatEq_simplify*)
|
walther@59800
|
62 |
getTactic 1 ([2],Res);(*Rewrite_Set norm_Rational*)
|
walther@59800
|
63 |
getTactic 1 ([3],Res);(*Rewrite_Set RatEq_eliminate*)
|
walther@59800
|
64 |
getTactic 1 ([4,1],Res);(*Rewrite all_left*)
|
walther@59800
|
65 |
getTactic 1 ([4,2],Res);(*Rewrite_Set expand_binoms*)
|
walther@59800
|
66 |
getTactic 1 ([4,3],Res);(*Rewrite_Set_Inst make_ratpoly_in*)
|
walther@59800
|
67 |
|
walther@59800
|
68 |
moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
|
walther@59800
|
69 |
moveActiveFormula 1 ([2],Res)(**ME_Isa: 'expand' not known*);
|
walther@59800
|
70 |
moveActiveFormula 1 ([3],Res)(*3.1.*);
|
walther@59800
|
71 |
moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
|
walther@59800
|
72 |
moveActiveFormula 1 ([4,3],Res)(**one_scr_arg: called by Program Stepwise t_=*);
|
walther@59800
|
73 |
|
walther@59800
|
74 |
moveActiveFormula 1 ([1],Res)(*1.1...1.4*);
|
walther@59800
|
75 |
interSteps 1 ([1],Res)(*..is activeFormula !?!*);
|
walther@59800
|
76 |
|
walther@59800
|
77 |
getTactic 1 ([1,1],Res);(*Rewrite real_diff_minus*)
|
walther@59800
|
78 |
getTactic 1 ([1,2],Res);(*Rewrite real_diff_minus*)
|
walther@59800
|
79 |
getTactic 1 ([1,3],Res);(*Rewrite real_diff_minus*)
|
walther@59800
|
80 |
getTactic 1 ([1,4],Res);(*Rewrite real_rat_mult_1*)
|
walther@59800
|
81 |
|
walther@59800
|
82 |
moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
|
walther@59800
|
83 |
interSteps 1 ([4,2],Res)(*..is activeFormula !?!*);
|
Walther@60549
|
84 |
val ((pt,_),_) = States.get_calc 1;
|
Walther@60608
|
85 |
writeln(pr_ctree ctxt pr_short pt);
|
walther@59800
|
86 |
(*delete [4,1] in order to make pos [4],[4,4] for pblobjs differen [4],[4,3]:
|
walther@59800
|
87 |
###########################################################################*)
|
walther@60278
|
88 |
val (pt, _) = cut_level__ [] [] pt ([4,1],Frm); (*#*)
|
walther@59800
|
89 |
(*##########################################################################*)
|
Walther@60608
|
90 |
writeln(pr_ctree ctxt pr_short pt);
|
walther@59800
|
91 |
(*##########################################################################
|
walther@59800
|
92 |
attention: the ctree in states is still the old (perfect) !!!
|
walther@59800
|
93 |
############################################################################*)
|
walther@59800
|
94 |
|
Walther@60608
|
95 |
writeln(pr_ctree ctxt pr_short pt);
|
Walther@60595
|
96 |
writeln(Test_Tool.posterms2str @{context} (ME_Misc.get_interval ctxt ([],Frm) ([],Res) 99999 pt));
|
walther@59800
|
97 |
|
Walther@60577
|
98 |
case map fst3 (ME_Misc.get_interval ctxt ([],Frm) ([],Res) 99999 pt) of
|
walther@59800
|
99 |
[([], Frm),
|
walther@59800
|
100 |
([1], Frm),
|
walther@59800
|
101 |
([1, 1], Frm),
|
walther@59800
|
102 |
([1, 1], Res),
|
walther@59800
|
103 |
([1, 2], Res),
|
walther@59800
|
104 |
([1, 3], Res),
|
walther@59800
|
105 |
([1, 4], Res),
|
walther@59800
|
106 |
([1], Res),
|
walther@59800
|
107 |
([2], Res),
|
walther@59800
|
108 |
([3], Res),
|
walther@59800
|
109 |
([4], Pbl),
|
walther@59800
|
110 |
([4, 1], Frm),
|
walther@59800
|
111 |
([4, 1, 1], Frm),
|
walther@59800
|
112 |
([4, 1, 1], Res),
|
walther@59800
|
113 |
([4, 1], Res),
|
walther@59800
|
114 |
([4, 2], Res),
|
walther@59800
|
115 |
([4, 3], Pbl),
|
walther@59800
|
116 |
([4, 3, 1], Frm),
|
walther@59800
|
117 |
([4, 3, 1], Res),
|
walther@59800
|
118 |
([4, 3, 2], Res),
|
walther@59800
|
119 |
([4, 3, 3], Res),
|
walther@59800
|
120 |
([4, 3, 4], Res),
|
walther@59800
|
121 |
([4, 3, 5], Res),
|
walther@59800
|
122 |
([4, 3], Res),
|
walther@59800
|
123 |
([4], Res),
|
walther@59800
|
124 |
([5], Res),
|
walther@59800
|
125 |
([], Res)] => ()
|
walther@59983
|
126 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1f";
|
Walther@60577
|
127 |
case map fst3 (ME_Misc.get_interval ctxt ([],Frm) ([],Res) 1 pt) of
|
walther@59800
|
128 |
[([], Frm),
|
walther@59800
|
129 |
([1], Frm),
|
walther@59800
|
130 |
([1], Res),
|
walther@59800
|
131 |
([2], Res),
|
walther@59800
|
132 |
([3], Res),
|
walther@59800
|
133 |
([4], Pbl),
|
walther@59800
|
134 |
([4], Res),
|
walther@59800
|
135 |
([5], Res),
|
walther@59800
|
136 |
([], Res)] => ()
|
walther@59983
|
137 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1f";
|
Walther@60577
|
138 |
case map fst3 (ME_Misc.get_interval ctxt ([],Frm) ([],Res) 0 pt) of
|
walther@59800
|
139 |
[([], Frm),
|
walther@59800
|
140 |
([], Res)] => ()
|
walther@59983
|
141 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1f";
|
walther@59800
|
142 |
|
Walther@60577
|
143 |
case map fst3 (ME_Misc.get_interval ctxt ([1,3],Res) ([4,1,1],Frm) 99999 pt) of
|
walther@59800
|
144 |
[([1, 3], Res),
|
walther@59800
|
145 |
([1, 4], Res),
|
walther@59800
|
146 |
([1], Res),
|
walther@59800
|
147 |
([2], Res),
|
walther@59800
|
148 |
([3], Res),
|
walther@59800
|
149 |
([4], Pbl),
|
walther@59800
|
150 |
([4, 1], Frm),
|
walther@59800
|
151 |
([4, 1, 1], Frm)] => ()
|
walther@59983
|
152 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1a";
|
walther@59800
|
153 |
|
walther@59800
|
154 |
(*this pos' is not generated bu move_dn:......vvv: goes to end of calc*)
|
Walther@60577
|
155 |
case map fst3 (ME_Misc.get_interval ctxt ([2],Res) ([4,3,2],Frm) 99999 pt) of
|
walther@59800
|
156 |
[([2], Res),
|
walther@59800
|
157 |
([3], Res),
|
walther@59800
|
158 |
([4], Pbl),
|
walther@59800
|
159 |
([4, 1], Frm),
|
walther@59800
|
160 |
([4, 1, 1], Frm),
|
walther@59800
|
161 |
([4, 1, 1], Res),
|
walther@59800
|
162 |
([4, 1], Res),
|
walther@59800
|
163 |
([4, 2], Res),
|
walther@59800
|
164 |
([4, 3], Pbl),
|
walther@59800
|
165 |
([4, 3, 1], Frm),
|
walther@59800
|
166 |
([4, 3, 1], Res),
|
walther@59800
|
167 |
([4, 3, 2], Res),
|
walther@59800
|
168 |
([4, 3, 3], Res),(*this is beyond 'to'*)
|
walther@59800
|
169 |
([4, 3, 4], Res),(*this is beyond 'to'*)
|
walther@59800
|
170 |
([4, 3, 5], Res),(*this is beyond 'to'*)
|
walther@59800
|
171 |
([4, 3], Res), (*this is beyond 'to'*)
|
walther@59800
|
172 |
([4], Res), (*this is beyond 'to'*)
|
walther@59800
|
173 |
([5], Res), (*this is beyond 'to'*)
|
walther@59800
|
174 |
([], Res)] => () (*this is beyond 'to'*)
|
walther@59983
|
175 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1b";
|
Walther@60577
|
176 |
case map fst3 (ME_Misc.get_interval ctxt ([1,4],Res) ([4,3,1],Frm) 99999 pt) of
|
walther@59800
|
177 |
[([1, 4], Res),
|
walther@59800
|
178 |
([1], Res),
|
walther@59800
|
179 |
([2], Res),
|
walther@59800
|
180 |
([3], Res),
|
walther@59800
|
181 |
([4], Pbl),
|
walther@59800
|
182 |
([4, 1], Frm),
|
walther@59800
|
183 |
([4, 1, 1], Frm),
|
walther@59800
|
184 |
([4, 1, 1], Res),
|
walther@59800
|
185 |
([4, 1], Res),
|
walther@59800
|
186 |
([4, 2], Res),
|
walther@59800
|
187 |
([4, 3], Pbl),
|
walther@59800
|
188 |
([4, 3, 1], Frm)] => ()
|
walther@59983
|
189 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1c";
|
Walther@60577
|
190 |
case map fst3 (ME_Misc.get_interval ctxt ([4,2],Res) ([5],Res) 99999 pt) of
|
walther@59800
|
191 |
[([4, 2], Res),
|
walther@59800
|
192 |
([4, 3], Pbl),
|
walther@59800
|
193 |
([4, 3, 1], Frm),
|
walther@59800
|
194 |
([4, 3, 1], Res),
|
walther@59800
|
195 |
([4, 3, 2], Res),
|
walther@59800
|
196 |
([4, 3, 3], Res),
|
walther@59800
|
197 |
([4, 3, 4], Res),
|
walther@59800
|
198 |
([4, 3, 5], Res),
|
walther@59800
|
199 |
([4, 3], Res),
|
walther@59800
|
200 |
([4], Res),
|
walther@59800
|
201 |
([5], Res)]=>()
|
walther@59983
|
202 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1d";
|
Walther@60577
|
203 |
case map fst3 (ME_Misc.get_interval ctxt ([],Frm) ([4,3,2],Res) 99999 pt) of
|
walther@59800
|
204 |
[([], Frm),
|
walther@59800
|
205 |
([1], Frm),
|
walther@59800
|
206 |
([1, 1], Frm),
|
walther@59800
|
207 |
([1, 1], Res),
|
walther@59800
|
208 |
([1, 2], Res),
|
walther@59800
|
209 |
([1, 3], Res),
|
walther@59800
|
210 |
([1, 4], Res),
|
walther@59800
|
211 |
([1], Res),
|
walther@59800
|
212 |
([2], Res),
|
walther@59800
|
213 |
([3], Res),
|
walther@59800
|
214 |
([4], Pbl),
|
walther@59800
|
215 |
([4, 1], Frm),
|
walther@59800
|
216 |
([4, 1, 1], Frm),
|
walther@59800
|
217 |
([4, 1, 1], Res),
|
walther@59800
|
218 |
([4, 1], Res),
|
walther@59800
|
219 |
([4, 2], Res),
|
walther@59800
|
220 |
([4, 3], Pbl),
|
walther@59800
|
221 |
([4, 3, 1], Frm),
|
walther@59800
|
222 |
([4, 3, 1], Res),
|
walther@59800
|
223 |
([4, 3, 2], Res)] => ()
|
walther@59983
|
224 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1e";
|
Walther@60577
|
225 |
case map fst3 (ME_Misc.get_interval ctxt ([4,3],Frm) ([4,3],Res) 99999 pt) of
|
walther@59800
|
226 |
[([4, 3], Frm),
|
walther@59800
|
227 |
([4, 3, 1], Frm),
|
walther@59800
|
228 |
([4, 3, 1], Res),
|
walther@59800
|
229 |
([4, 3, 2], Res),
|
walther@59800
|
230 |
([4, 3, 3], Res),
|
walther@59800
|
231 |
([4, 3, 4], Res),
|
walther@59800
|
232 |
([4, 3, 5], Res),
|
walther@59800
|
233 |
([4, 3], Res)] => ()
|
walther@59983
|
234 |
| _ => error "diff.behav.in ctree.sml: ME_Misc.get_interval lev 1g";
|