2 * @author Walther Neuper
3 * Copyright (c) due to license terms
4 * Created on Aug 28, 2015
5 * Institute for Softwaretechnology, Graz University of Technology, Austria.
7 package isac.bridge.xml
9 import edu.tum.cs.isabelle.api.XML
10 import edu.tum.cs.isabelle.pure._ // DEFINES type Term
13 * Compile test data for TestDataTypes.java.
15 * This setup has been chosen after <Run As> <Scala JUnit Test> could not
16 * made working with standard examples neither from within Eclipse
17 * * http://scala-ide.org/docs/2.0.x/testingframeworks.html
18 * * http://scala-ide.org/docs/current-user-doc/features/test-finder/index.html
20 * * http://www.scalatest.org/download
21 * * http://www.scalatest.org/user_guide/using_scalatest_with_eclipse
25 //---------------------------------- for TestXMLout.java#test_match
26 def create_AAA (): XML.Tree =
27 XML.Elem(("AAA", Nil), Nil)
28 def create_BBB (): XML.Tree =
29 XML.Elem(("BBB", Nil), Nil)
30 def create_CCCddd (): XML.Tree =
31 XML.Elem(("CCC", Nil), List(
32 XML.Elem(("ddd", Nil), Nil)))
33 def create_DDDeeeFFF (): XML.Tree =
34 XML.Elem(("DDD", Nil), List(
35 XML.Elem(("eee", Nil), List(XML.Text("FFF")))))
36 def create_EEEfffGGGhhhIII (): XML.Tree =
37 XML.Elem(("EEE", Nil), List(
38 XML.Elem(("fff", Nil), List(XML.Text("GGG"))),
39 XML.Elem(("hhh", Nil), List(XML.Text("III")))))
41 def match_ABC(t: XML.Tree): java.lang.String = t match {
43 XML.Elem(("AAA", Nil), Nil) => "AAA"
45 XML.Elem(("BBB", Nil), Nil) => "BBB"
47 XML.Elem(("CCC", Nil), List(
48 XML.Elem(("ddd", Nil), Nil))) => "CCCddd"
50 XML.Elem(("DDD", Nil), List(
51 XML.Elem(("eee", Nil), List(XML.Text("FFF")))))
54 XML.Elem(("EEE", Nil), List(
55 XML.Elem(("fff", Nil), List(XML.Text("GGG"))),
56 XML.Elem(("hhh", Nil), List(XML.Text("III")))))
59 XML.Elem(("SYSERROR", Nil), List(
60 XML.Elem(("CALCID", Nil), List(XML.Text(_))),
61 XML.Elem(("ERROR", Nil), List(XML.Text(_)))))
66 //---------------------------------- for TestXMLout.java#test_is_message
67 def create_SYSERROR (): XML.Tree =
68 XML.Elem(("SYSERROR", Nil), List(
69 XML.Elem(("CALCID", Nil), List(XML.Text("1"))),
70 XML.Elem(("ERROR", Nil), List(XML.Text("no Rewrite_Set...")))))
72 * intermediateSteps xml_out = <SYSERROR><CALCID>1</CALCID><ERROR>no Rewrite_Set...</ERROR></SYSERROR>
76 //---------------------------------- for ../TestPIDE.java#testTermTransfer
77 //----- see Isabelle_Isac/test/../mathml.sml--- create testdata for TestPIDE.java#testTermTransfer ---
78 // https://intra.ist.tugraz.at/hg/isa/rev/5ce72a592f7f
79 // val t = @{term "aaa + bbb::real"}
81 // ( ( Const ("Groups.plus_class.plus", "real ⇒ real ⇒ real") $ Free ("aaa", "real") ) $ Free ("bbb", "real") )
82 // ... gives in SML with left-associativity:
86 // Const ("Groups.plus_class.plus", _) $
87 // Free ("aaa", _) ) $
88 // Free ("bbb", _) ) = t
89 // ... gives in SML with explicit typ:
92 // Const ("Groups.plus_class.plus", Type ("fun", [
93 // Type ("Real.real", []),
95 // Type ("Real.real", []),
96 // Type ("Real.real", [])])])) $
97 // Free ("aaa", Type ("Real.real", [])) ) $
98 // Free ("bbb", Type ("Real.real", [])) )
99 def test_term (): Term =
102 Const ("Groups.plus_class.plus", Type("fun", List(
103 Type("Real.real", List()),
105 Type("Real.real", List()),
106 Type("Real.real", List())))))),
107 Free ("aaa", Type ("Real.real", List()))),
108 Free ("bbb", Type ("Real.real", List())))
111 * "solve (x + 1 = (2::real), (x::real))" parsed via <code>ScalaTermFromString</code> to
112 * App(Const("Equation.solve",Type("fun",List(Type("Product_Type.prod",List(Type("HOL.bool",List()), Type("Real.real",List()))), Type(List.list,List(Type("HOL.bool",List())))))),App(App(Const("Product_Type.Pair",Type("fun",List(Type("HOL.bool",List()), Type("fun",List(Type("Real.real",List()), Type("Product_Type.prod",List(Type("HOL.bool",List()), Type("Real.real",List())))))))),App(App(Const("HOL.eq",Type("fun",List(Type("Real.real",List()), Type("fun",List(Type("Real.real",List()), Type("HOL.bool",List())))))),App(App(Const("Groups.plus_class.plus",Type("fun",List(Type("Real.real",List()), Type("fun",List(Type("Real.real",List()), Type("Real.real",List())))))),Free("x",Type("Real.real",List()))),Free("1",Type("Real.real",List())))),Free("2",Type(Real.real,List())))),Free("x",Type("Real.real",List()))))
114 def term_mini_subpbl_1 (): Term = {
115 App(Const("Equation.solve",Type("fun",List(Type("Product_Type.prod",List(Type("HOL.bool",List()), Type("Real.real",List()))), Type("List.list",List(Type("HOL.bool",List())))))),App(App(Const("Product_Type.Pair",Type("fun",List(Type("HOL.bool",List()), Type("fun",List(Type("Real.real",List()), Type("Product_Type.prod",List(Type("HOL.bool",List()), Type("Real.real",List())))))))),App(App(Const("HOL.eq",Type("fun",List(Type("Real.real",List()), Type("fun",List(Type("Real.real",List()), Type("HOL.bool",List())))))),App(App(Const("Groups.plus_class.plus",Type("fun",List(Type("Real.real",List()), Type("fun",List(Type("Real.real",List()), Type("Real.real",List())))))),Free("x",Type("Real.real",List()))),Free("1",Type("Real.real",List())))),Free("2",Type("Real.real",List())))),Free("x",Type("Real.real",List()))))