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