Package com.singularsys.exttests
Class MathMLTest
java.lang.Object
com.singularsys.exttests.MathMLTest
General testing suite for mathml parser builder.
- Author:
- Richard Morris
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanPrints detail information about tests carried outstatic final booleanstatic final booleanSome tests depend on existence of a local style-sheet, set to null to disable testsstatic final booleanWhether to run slow tests which need network access -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassertEqNodes(String s, Node expected, Node actual) voidbiDirectionalTest(String eqn, Node node, String xml) voidbiDirectionalTest(String eqn, String xml) booleancompareRecursive(Node node1, Node node2) docToString(Document doc, Transformer t) voidjepToXmlTest(String eqn, Node node, String xml) voidjepToXmlTest(String eqn, String xml) voidsetUp()static voidvoidsimpleBuilderTest(String eqn, Node node, String xml, Transformer t) voidtestCN()Test <cn> numbers elements.voidvoidvoidvoidvoidSupport for Entities is currently broken.voidvoidvoidvoidvoidTests a declare elementvoidTests parsing of <vector> element.voidvoidTests that every jep function will be converted to mathml.voidvoidtestList()Converts "[1,[2,3]]" to/from nested <list> elements.voidtestLog()voidtestLog2()voidtestMath()voidTests using the MathML 2.0 DTD.voidConvert to/from mathml with a namespace (xmlns) attribute specified.voidConvert to/from mathml with a namespace (xmlns) attribute specified and a '"m" prefix for MathML elements.voidTests >matrix< element.voidvoidTests conversion of multiple <declare> elements.voidtestNaN()voidvoidvoidTests that every jep operator will be converted to mathml.voidtestPi()voidConversions of "x^2+4*x+4==0"voidConverts "x==(-b-sqrt(b^2.0-4.0*a*c))/(2.0*a)" to-from mathml.voidThis test is only run if LOCAL_STYLESHEETS_DIR is not null and the mmlctop2_0.xsl style sheet from http://www.orcca.on.ca/MathML/software/mmlctop2_0.zip stylesheet is installed there.voidTests parsing of deprecated <reln> element.voidtestRoot()"sqrt(x)" is converted to from <apply><root/><ci>x</ci></apply>voidTests a selector element for array indexingvoidTests parsing of mathml inside a <semantics> element.voidTests parsing of >set< element.voidtestSin()voidtestSqrt()voidvoidTests >vector< element.voidParses mathml embedded in an xhtml document.voidParses mathml embedded in an xhtml document.voidxmlToJepTest(String eqn, Node expected, String xml) voidxmlToJepTest(String eqn, String xml)
-
Field Details
-
PRINT_RESULTS
public static final boolean PRINT_RESULTS -
PRINT_ALL
public static final boolean PRINT_ALLPrints detail information about tests carried out -
RUN_NETWORK_TESTS
public static final boolean RUN_NETWORK_TESTSWhether to run slow tests which need network access- See Also:
-
RUN_KNOWN_FAILURES
public static final boolean RUN_KNOWN_FAILURESSome tests depend on existence of a local style-sheet, set to null to disable tests- See Also:
-
-
Constructor Details
-
MathMLTest
public MathMLTest()
-
-
Method Details
-
setUpBeforeClass
- Throws:
Exception
-
setUp
- Throws:
Exception
-
fixLineEndings
-
removeEmptySpace
-
docToString
- Throws:
TransformerException
-
simpleBuilderTest
public void simpleBuilderTest(String eqn, Node node, String xml, Transformer t) throws TransformerException, JepException - Throws:
TransformerExceptionJepException
-
compareRecursive
-
assertEqNodes
-
jepToXmlTest
public void jepToXmlTest(String eqn, Node node, String xml) throws TransformerException, JepException - Throws:
TransformerExceptionJepException
-
jepToXmlTest
- Throws:
TransformerExceptionJepException
-
xmlToJepTest
public void xmlToJepTest(String eqn, String xml) throws ParserConfigurationException, SAXException, IOException, ParseException -
xmlToJepTest
public void xmlToJepTest(String eqn, Node expected, String xml) throws ParserConfigurationException, SAXException, IOException - Parameters:
eqn-- Throws:
ParserConfigurationExceptionSAXExceptionIOException
-
biDirectionalTest
public void biDirectionalTest(String eqn, String xml) throws TransformerException, ParserConfigurationException, SAXException, IOException, JepException -
biDirectionalTest
public void biDirectionalTest(String eqn, Node node, String xml) throws TransformerException, ParserConfigurationException, SAXException, IOException, JepException -
testCN
Test <cn> numbers elements.- Throws:
Exception
-
testCNbaseXJ
- Throws:
Exception
-
testCNbase8XJ
- Throws:
Exception
-
testCNrealXJ
- Throws:
Exception
-
testCNe_notation
- Throws:
Exception
-
testCNinteger
- Throws:
Exception
-
testCNrationalXJ
- Throws:
Exception
-
testCNcomplex
- Throws:
Exception
-
testCNcomplexPolarXJ
- Throws:
Exception
-
testCNconstantPi
Support for Entities is currently broken.- Throws:
Exception
-
testNaN
- Throws:
Exception
-
testInfinity
- Throws:
Exception
-
testNegInfinityJX
- Throws:
Exception
-
testNegInfinityXJ
- Throws:
Exception
-
testPi
- Throws:
Exception
-
testUminus
- Throws:
Exception
-
testMinus
- Throws:
Exception
-
testLog
- Throws:
Exception
-
testLog2
- Throws:
Exception
-
testSin
- Throws:
Exception
-
testSqrt
- Throws:
Exception
-
testQuadratic
Conversions of "x^2+4*x+4==0"- Throws:
Exception
-
testQuadraticToPresentation
This test is only run if LOCAL_STYLESHEETS_DIR is not null and the mmlctop2_0.xsl style sheet from http://www.orcca.on.ca/MathML/software/mmlctop2_0.zip stylesheet is installed there.- Throws:
Exception
-
testQuadraticRoot
Converts "x==(-b-sqrt(b^2.0-4.0*a*c))/(2.0*a)" to-from mathml. Note no ± equivalent in jep, jep will parse 4*a*c as (4*a)*c.- Throws:
Exception
-
testRoot
"sqrt(x)" is converted to from <apply><root/><ci>x</ci></apply>- Throws:
Exception
-
testMatrix
Tests >matrix< element.- Throws:
Exception
-
testVector
Tests >vector< element.- Throws:
Exception
-
testList
Converts "[1,[2,3]]" to/from nested <list> elements.- Throws:
Exception
-
testSetXJ
Tests parsing of >set< element.- Throws:
Exception
-
testSelector
Tests a selector element for array indexing- Throws:
Exception
-
testDeclare
Tests a declare element- Throws:
Exception
-
testDeclareVector
Tests parsing of <vector> element. Reverse fails as it misses thetype="vector"attribute of the declared tag.- Throws:
Exception
-
testRelnXJ
Tests parsing of deprecated <reln> element. In reverse relations are children of apply elements as per v2.0 .- Throws:
Exception
-
testXHTML
Parses mathml embedded in an xhtml document.- Throws:
Exception
-
testXHTML2
Parses mathml embedded in an xhtml document.- Throws:
Exception
-
testMath
- Throws:
Exception
-
testMathNS
Convert to/from mathml with a namespace (xmlns) attribute specified.- Throws:
Exception
-
testMathNSP
Convert to/from mathml with a namespace (xmlns) attribute specified and a '"m" prefix for MathML elements.- Throws:
Exception
-
testSemantics
Tests parsing of mathml inside a <semantics> element.- Throws:
Exception
-
testExponent
- Throws:
Exception
-
testMultipleDeclarations
Tests conversion of multiple <declare> elements.- Throws:
Exception
-
testMathDTD
Tests using the MathML 2.0 DTD. This needs to download the mathml dtd to run the parsing part which is only run if RUN_NETWORK_TESTS is true.- Throws:
Exception
-
testFunctionsExists
@Test public void testFunctionsExists()Tests that every jep function will be converted to mathml. If RUN_KNOWN_FAILURES is true it will fail otherwise prints list of unknown functions. -
testOperatorsExists
@Test public void testOperatorsExists()Tests that every jep operator will be converted to mathml. If RUN_KNOWN_FAILURES is true it will fail otherwise prints list of unknown operators.
-