wneuper@4804
|
1 |
/*
|
wneuper@4804
|
2 |
* @author Walther Neuper
|
wneuper@4804
|
3 |
* Copyright (c) due to license terms
|
wneuper@4804
|
4 |
* Created on Aug 18, 2015
|
wneuper@4804
|
5 |
* Institute for Softwaretechnology, Graz University of Technology, Austria.
|
wneuper@4804
|
6 |
*/
|
wneuper@4804
|
7 |
package isac.bridge.xml;
|
wneuper@4804
|
8 |
|
wneuper@4804
|
9 |
import isac.bridge.xml.TestsDATA; // DataTypes.scala
|
walther@5239
|
10 |
import edu.tum.cs.isabelle.api.XML;
|
wneuper@4804
|
11 |
import junit.framework.TestCase;
|
wneuper@4804
|
12 |
|
wneuper@4804
|
13 |
/**
|
wneuper@4804
|
14 |
* @author Walther Neuper Aug 18, 2015
|
wneuper@4804
|
15 |
* TODO
|
wneuper@4804
|
16 |
*/
|
wneuper@4804
|
17 |
public class TestXMLout extends TestCase {
|
wneuper@4804
|
18 |
|
wneuper@4804
|
19 |
/* test_is_message failed, so we prepare by increasing complexity stepwise:
|
wneuper@4804
|
20 |
* 1: def create_AAA (): XML.Tree = XML.Elem(Markup("AAA", Nil), Nil)
|
wneuper@4804
|
21 |
*/
|
wneuper@4804
|
22 |
public void test_match() throws Exception {
|
wneuper@4804
|
23 |
System.out.println(" ---------------------------------------------");
|
wneuper@4804
|
24 |
System.out.println("/--BEGIN isac.bridge.xml.TestXMLout#test_match");
|
wneuper@4804
|
25 |
|
wneuper@4804
|
26 |
XML.Tree xml_out = TestsDATA.create_AAA();
|
wneuper@4804
|
27 |
String found = TestsDATA.match_ABC(xml_out);
|
wneuper@4804
|
28 |
assertEquals("case simplest", found, "AAA");
|
wneuper@4804
|
29 |
|
wneuper@4804
|
30 |
xml_out = TestsDATA.create_BBB();
|
wneuper@4804
|
31 |
found = TestsDATA.match_ABC(xml_out);
|
wneuper@4804
|
32 |
assertEquals("case 2nd match", found, "BBB");
|
wneuper@4804
|
33 |
|
wneuper@4804
|
34 |
xml_out = TestsDATA.create_CCCddd();
|
wneuper@4804
|
35 |
found = TestsDATA.match_ABC(xml_out);
|
wneuper@4804
|
36 |
assertEquals("case 2 fields", found, "CCCddd");
|
wneuper@4804
|
37 |
|
wneuper@4804
|
38 |
xml_out = TestsDATA.create_DDDeeeFFF();
|
wneuper@4804
|
39 |
found = TestsDATA.match_ABC(xml_out);
|
wneuper@4804
|
40 |
assertEquals("case 3 fields", found, "DDDeeeFFF");
|
wneuper@4804
|
41 |
|
wneuper@4804
|
42 |
xml_out = TestsDATA.create_EEEfffGGGhhhIII();
|
wneuper@4804
|
43 |
found = TestsDATA.match_ABC(xml_out);
|
wneuper@4804
|
44 |
assertEquals("case 5 fields", found, "EEEfffGGGhhhIII");
|
wneuper@4804
|
45 |
|
wneuper@4804
|
46 |
xml_out = TestsDATA.create_SYSERROR();
|
wneuper@4804
|
47 |
found = TestsDATA.match_ABC(xml_out);
|
wneuper@4804
|
48 |
assertEquals("case SYSERROR, XML.Text(\"1\") ANDALSO XML.Text(_)", found, "SYSERROR");
|
wneuper@4804
|
49 |
|
wneuper@4804
|
50 |
System.out.println("\\--END isac.bridge.xml.TestXMLout#test_match");
|
wneuper@4804
|
51 |
|
wneuper@4804
|
52 |
}
|
wneuper@4804
|
53 |
|
wneuper@4804
|
54 |
/* found wrong () in IsaToJava.is_message */
|
wneuper@4804
|
55 |
public void test_is_message() throws Exception {
|
wneuper@4804
|
56 |
System.out.println(" ---------------------------------------------");
|
wneuper@4804
|
57 |
System.out.println("/--BEGIN isac.bridge.xml.TestXMLout#test_is_message");
|
wneuper@4804
|
58 |
|
wneuper@4804
|
59 |
XML.Tree xml_out = TestsDATA.create_SYSERROR();
|
wneuper@4804
|
60 |
Boolean is_msg = IsaToJava.is_message(xml_out);
|
wneuper@4804
|
61 |
assertTrue("<SYSERROR>... is recognised as a message.", is_msg);
|
wneuper@4804
|
62 |
|
wneuper@4804
|
63 |
System.out.println("\\--END isac.bridge.xml.TestXMLout#test_is_message");
|
wneuper@4804
|
64 |
|
wneuper@4804
|
65 |
}
|
walther@5239
|
66 |
}
|