isac-java/src/java-tests/isac/gui/mawen/scalaterm/TestUtil.scala
author Walther Neuper <walther.neuper@jku.at>
Fri, 26 Mar 2021 10:45:05 +0100
changeset 5239 b4e3883d7b66
parent 5229 6bf0e95981e3
permissions -rw-r--r--
reset mathematics-engine to Isabelle2015

note: for this version libisabelle was available,
which connects front-end (Java) and back-end (Isabelle/ML)
     1 package isac.gui.mawen.scalaterm
     2 
     3 import isac.gui.mawen.syntax.Ast
     4 import edu.tum.cs.isabelle.pure._
     5 import junit.framework.TestCase
     6 import java.lang.String
     7 import org.junit.Assert._
     8 
     9 class TestUtil extends TestCase {
    10 
    11   def test_string_of() {
    12     println("/--BEGIN isac.gui.mawen.scalaterm.TestUtil#test_string_of");
    13 
    14     assertEquals(Util.string_of(TestsDATA.t1), "aaa + bbb = processed_by_Isabelle_Isac")
    15     assertEquals(Util.string_of(TestsDATA.t2), "a + 2 * b + 3 * (c + d)")
    16 
    17     assertEquals(Util.string_of(TestsDATA.t31), "aaa + bbb + ccc")
    18     assertEquals(Util.string_of(TestsDATA.t32), "aaa + (bbb + ccc)")
    19 
    20     assertEquals(Util.string_of(TestsDATA.t41), "Diff (x + sin (x ^ 2), x)")
    21     assertEquals(Util.string_of(TestsDATA.t42), "d_d x (x + sin (x ^ 2))")
    22     
    23     // MAWEN example for reference No.1
    24     assertEquals(Util.string_of(TestsDATA.tt1()), "Simplify (1 + 2 * x * (y + 3) / (4 * z * (y + 3)) + 5)")
    25     assertEquals(Util.string_of(TestsDATA.tt3()), "1 + 2 * x * (y + 3) / (4 * z * (y + 3)) + 5")
    26     assertEquals(Util.string_of(TestsDATA.tt4()), "1 + 2 * x / (4 * z) + 5")
    27     assertEquals(Util.string_of(TestsDATA.tt5()), "1 + x / (2 * z) + 5")
    28     assertEquals(Util.string_of(TestsDATA.tt6()), "6 + x / (2 * z)")
    29     
    30     println("\\--END isac.gui.mawen.scalaterm.TestUtil#test_string_of");
    31   }
    32   
    33    /**
    34    * tested on validity with: http://www-archive.mozilla.org/projects/mathml/demo/tester.html
    35    */
    36   def test_mathml_of() {
    37     println("/--BEGIN isac.gui.mawen.scalaterm.TestUtil#mathml_of"); 
    38     assertEquals(Util.mathml_of(TestsDATA.tt3), TestsDATA.tt3_math());
    39     println("\\--END isac.gui.mawen.scalaterm.TestUtil#mathml_of");
    40   }
    41   
    42 }