KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > tests > MathMLTest


1 package JSci.tests;
2
3 import JSci.io.*;
4
5 public class MathMLTest extends junit.framework.TestCase {
6         public static void main(String JavaDoc arg[]) {
7                 junit.textui.TestRunner.run(MathMLTest.class);
8         }
9         public MathMLTest(String JavaDoc name) {
10                 super(name);
11         }
12     public void testParse() throws Exception JavaDoc {
13         MathMLParser parser = new MathMLParser();
14         parser.parse(getClass().getResource("test.mml").toString());
15
16         Object JavaDoc[] list = parser.translateToJSciObjects();
17         for(int i=0; i<list.length; i+=2) {
18             Object JavaDoc actual = list[i];
19             Object JavaDoc expected = list[i+1];
20             if(actual instanceof MathMLExpression)
21                 actual = ((MathMLExpression) actual).evaluate();
22             assertEquals(expected, actual);
23         }
24     }
25 }
26
Popular Tags