Skip to content

Commit

Permalink
add unit test for infinity and NaN from MathML
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Nov 15, 2024
1 parent 8acdb85 commit 355c69e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions vcell-math/src/test/java/cbit/vcell/parser/MathMLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@ public void testMathMLParsing_XOR() throws IOException, ExpressionException {
assertTrue(equiv, msg);
}

@Test
public void testNaN_MathmlParsing() throws ExpressionException {
String nanMathML = "<notanumber/>";
Expression exp = new ExpressionMathMLParser(null).fromMathML(nanMathML, "t");
Expression expectedExp = new Expression("0/0");
boolean equiv = ExpressionUtils.functionallyEquivalent(exp, expectedExp, true);
String msg = "not equivalent: origExp='"+exp.infix()+"', expMathML='"+expectedExp.infix()+"'";
assertTrue(equiv, msg);
}

@Test
public void testInfinity_MathmlParsing() throws ExpressionException {
String nanMathML = "<infinity/>";
Expression exp = new ExpressionMathMLParser(null).fromMathML(nanMathML, "t");
Expression expectedExp = new Expression(Double.MAX_VALUE);
boolean equiv = ExpressionUtils.functionallyEquivalent(exp, expectedExp, true);
String msg = "not equivalent: origExp='"+exp.infix()+"', expMathML='"+expectedExp.infix()+"'";
assertTrue(equiv, msg);
}


@ParameterizedTest
@MethodSource("testCases")
Expand Down

0 comments on commit 355c69e

Please sign in to comment.