test/Tools/isac/Interpret/mathengine.sml
author Walther Neuper <neuper@ist.tugraz.at>
Tue, 28 Sep 2010 09:06:56 +0200
branchisac-update-Isa09-2
changeset 38031 460c24a6a6ba
parent 37960 ec20007095f2
child 38058 ad0485155c0e
permissions -rw-r--r--
tuned error and writeln

# raise error --> error
# writeln in atomtyp, atomty, atomt and xmlsrc
     1 (* test for sml/ME/mathengine.sml
     2    authors: Walther Neuper 2000, 2006
     3    (c) due to copyright terms
     4 
     5 use"../smltest/ME/mathengine.sml";
     6 use"mathengine.sml";
     7 *)
     8 
     9 "-----------------------------------------------------------------";
    10 "table of contents -----------------------------------------------";
    11 "-----------------------------------------------------------------";
    12 "----------- debugging setContext..pbl_ --------------------------";
    13 "----------- tryrefine -------------------------------------------";
    14 "-----------------------------------------------------------------";
    15 "-----------------------------------------------------------------";
    16 "-----------------------------------------------------------------";
    17 
    18 
    19 
    20 "----------- debugging setContext..pbl_ --------------------------";
    21 "----------- debugging setContext..pbl_ --------------------------";
    22 "----------- debugging setContext..pbl_ --------------------------";
    23 states:=[];
    24 CalcTree
    25 [(["equality (x+1=2)", "solveFor x","solutions L"], 
    26   ("Test.thy", 
    27    ["sqroot-test","univariate","equation","test"],
    28    ["Test","squ-equ-test-subpbl1"]))];
    29 Iterator 1;
    30 moveActiveRoot 1; modelProblem 1;
    31 
    32 val pos as (p,_) = ([],Pbl);
    33 val guh = "pbl_equ_univ";
    34 checkContext 1 pos guh;
    35 val ((pt,_),_) = get_calc 1;
    36 val pp = par_pblobj pt p;
    37 val keID = guh2kestoreID guh;
    38 case context_pbl keID pt pp of (true,["univariate", "equation"],_,_,_)=>()
    39 | _ => error "mathengine.sml: context_pbl .. pbl_equ_univ checked";
    40 
    41 case get_obj g_spec pt p of (_, ["e_pblID"], _) => ()
    42 | _ => error "mathengine.sml: context_pbl .. pbl still empty";
    43 setContext 1 pos guh;
    44 val ((pt,_),_) = get_calc 1;
    45 case get_obj g_spec pt p of (_, ["univariate", "equation"], _) => ()
    46 | _ => error "mathengine.sml: context_pbl .. pbl set";
    47 
    48 
    49 setContext 1 pos "met_eq_lin";
    50 val ((pt,_),_) = get_calc 1;
    51 case get_obj g_spec pt p of (_,  _, ["LinEq", "solve_lineq_equation"]) => ()
    52 | _ => error "mathengine.sml: context_pbl .. pbl set";
    53 
    54 
    55 "----------- tryrefine -------------------------------------------";
    56 "----------- tryrefine -------------------------------------------";
    57 "----------- tryrefine -------------------------------------------";
    58 states:=[];
    59 CalcTree [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)", 
    60 	    "solveFor x", "solutions L"],
    61 	   ("RatEq.thy",["univariate","equation"],["no_met"]))];
    62 Iterator 1;
    63 moveActiveRoot 1; autoCalculate 1 CompleteCalc;
    64 
    65 refineProblem 1 ([1],Res) "pbl_equ_univ" 
    66 (*gives "pbl_equ_univ_rat" correct*);
    67 
    68 refineProblem 1 ([1],Res) (pblID2guh ["linear","univariate","equation"])
    69 (*ives "pbl_equ_univ_lin" incorrect*);