1.1 --- a/isac-java/src/java-tests/isac/gui/mawen/MockCalcTreeSIMPLIFY.java Thu May 12 16:08:50 2016 +0200
1.2 +++ b/isac-java/src/java-tests/isac/gui/mawen/MockCalcTreeSIMPLIFY.java Thu May 12 16:24:10 2016 +0200
1.3 @@ -1,9 +1,11 @@
1.4 package isac.gui.mawen;
1.5
1.6 +import isac.gui.mawen.scalaterm.TestsDATA;
1.7 import isac.util.formulae.CalcFormula;
1.8 import isac.util.formulae.Formula;
1.9 import isac.util.formulae.Position;
1.10
1.11 +import edu.tum.cs.isabelle.pure.*; // libisabelle type Term
1.12 import java.util.HashMap;
1.13 import java.util.Vector;
1.14
1.15 @@ -22,41 +24,41 @@
1.16 //<--ISA: "Simplify (1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5)"
1.17 Vector<Integer> p = new Vector<Integer>();
1.18 Position pos = new Position(p, "Pbl");
1.19 - Formula form = new Formula("Simplify (1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5)");
1.20 + Formula form = new Formula("Simplify (1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5::real)", TestsDATA.tt1());
1.21 calc_tree_.add(new CalcFormula(pos, form));
1.22
1.23 // getFormulaeFromTo will need ([],Met):
1.24 p = new Vector<Integer>();
1.25 pos = new Position(p, "Met");
1.26 - form = new Formula("Simplify (1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5)");
1.27 + form = new Formula("Simplify (1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5::real)", TestsDATA.tt1());
1.28 calc_tree_.add(new CalcFormula(pos, form));
1.29
1.30 //-->ISA: getFormulaeFromTo 1 ([],Met) ([1],Frm) 0 false;
1.31 //<--ISA: "1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5"
1.32 p = new Vector<Integer>(); p.add(1);
1.33 pos = new Position(p, "Frm");
1.34 - form = new Formula("1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5");
1.35 + form = new Formula("1 + (2 * x * (y + 3)) / (4 * z * (y + 3)) + 5::real", TestsDATA.tt3());
1.36 calc_tree_.add(new CalcFormula(pos, form));
1.37
1.38 //-->ISA: getFormulaeFromTo 1 ([1],Frm) ([1],Res) 0 false;
1.39 //<--ISA: "1 + (2 * x) / (4 * z) + 5"
1.40 p = new Vector<Integer>(); p.add(1);
1.41 pos = new Position(p, "Res");
1.42 - form = new Formula("1 + (2 * x) / (4 * z) + 5");
1.43 + form = new Formula("1 + (2 * x) / (4 * z) + 5::real", TestsDATA.tt4());
1.44 calc_tree_.add(new CalcFormula(pos, form));
1.45
1.46 //-->ISA: getFormulaeFromTo 1 ([1],Res) ([2],Res) 0 false;
1.47 //<--ISA: "1 + x / (2 * z) + 5"
1.48 p = new Vector<Integer>(); p.add(2);
1.49 pos = new Position(p, "Res");
1.50 - form = new Formula("1 + x / (2 * z) + 5");
1.51 + form = new Formula("1 + x / (2 * z) + 5::real", TestsDATA.tt5());
1.52 calc_tree_.add(new CalcFormula(pos, form));
1.53
1.54 //-->ISA: getFormulaeFromTo 1 ([2],Res) ([3],Res) 0 false;
1.55 //<--ISA: "6 + x / (2 * z)"
1.56 p = new Vector<Integer>(); p.add(3);
1.57 pos = new Position(p, "Res");
1.58 - form = new Formula("6 + x / (2 * z)");
1.59 + form = new Formula("6 + x / (2 * z::real)", TestsDATA.tt6());
1.60 calc_tree_.add(new CalcFormula(pos, form));
1.61 }
1.62
2.1 --- a/isac-java/src/java-tests/isac/gui/mawen/scalaterm/ScalaTermFromString.java Thu May 12 16:08:50 2016 +0200
2.2 +++ b/isac-java/src/java-tests/isac/gui/mawen/scalaterm/ScalaTermFromString.java Thu May 12 16:24:10 2016 +0200
2.3 @@ -52,7 +52,12 @@
2.4 }
2.5
2.6 @Test
2.7 - /* create terms of example for reference, see <code>MockCalcTreeSIMPLIFY</code> */
2.8 + /* create terms of example for reference, see <code>MockCalcTreeSIMPLIFY</code>
2.9 + * step 1: parse strings, detect syntax errors
2.10 + * step 2: copy from Console to comment in isac.gui.mawen.scalaterm.TestsDATA
2.11 + * step 3: in order not to destroy TestsDATA, in a separate editor <Replace All> (fun, WITH ("fun", etc
2.12 + * step 4: copy the terms back to where you need them (here: <code>MockCalcTreeSIMPLIFY</code>).
2.13 + */
2.14 public void testExampleForRef1() {
2.15 System.out.println("/--BEGIN isac.bridge.ScalaTermFromString#testCreateExpForReference1");
2.16
2.17 @@ -68,6 +73,30 @@
2.18 Formula form = DataTypes.xml_to_Formula_NEW(term);
2.19 System.out.println("1 " + form.getTerm());
2.20
2.21 + // "(1 + (2 * x * (y + 3)) / (4 * z * (y + 3))) + 5::real";
2.22 + term_str = "(1 + (2 * x * (y + 3)) / (4 * z * (y + 3))) + 5::real";
2.23 + term = sys.invoke(IsacOperations.SCALATERM_OF_STRING, term_str);
2.24 + form = DataTypes.xml_to_Formula_NEW(term);
2.25 + System.out.println("2 " + form.getTerm());
2.26 +
2.27 + // "(1 + (2 * x) / (4 * z)) + 5::real";
2.28 + term_str = "(1 + (2 * x) / (4 * z)) + 5::real";
2.29 + term = sys.invoke(IsacOperations.SCALATERM_OF_STRING, term_str);
2.30 + form = DataTypes.xml_to_Formula_NEW(term);
2.31 + System.out.println("3 " + form.getTerm());
2.32 +
2.33 + // "1 + x / (2 * z) + 5::real";
2.34 + term_str = "1 + x / (2 * z) + 5::real";
2.35 + term = sys.invoke(IsacOperations.SCALATERM_OF_STRING, term_str);
2.36 + form = DataTypes.xml_to_Formula_NEW(term);
2.37 + System.out.println("4 " + form.getTerm());
2.38 +
2.39 + // "6 + x / (2 * z::real)";
2.40 + term_str = "6 + x / (2 * z::real)";
2.41 + term = sys.invoke(IsacOperations.SCALATERM_OF_STRING, term_str);
2.42 + form = DataTypes.xml_to_Formula_NEW(term);
2.43 + System.out.println("5 " + form.getTerm());
2.44 +
2.45 System.out.println("\\--END isac.bridge.ScalaTermFromString#testCreateExpForReference1");
2.46 }
2.47