public void test_ASTNode_setInteger() { ASTNode node = new ASTNode(); node.setName( "foo"); assertTrue( node.getType() == libsbml.AST_NAME ); assertTrue(( "foo" == node.getName() )); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setValue(3.2); assertTrue( node.getType() == libsbml.AST_REAL ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getName() == null ); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getReal() == 3.2 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setValue(321); assertTrue( node.getType() == libsbml.AST_INTEGER ); assertTrue( node.getInteger() == 321 ); assertTrue( node.getName() == null ); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node = null; }
public void test_ASTNode_setCharacter() { ASTNode node = new ASTNode(); node.setName( "foo"); assertTrue( node.getType() == libsbml.AST_NAME ); assertTrue( node.getCharacter() == '\0' ); assertTrue(( "foo" == node.getName() )); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setCharacter( '+'); assertTrue( node.getType() == libsbml.AST_PLUS ); assertTrue( node.getCharacter() == '+' ); assertTrue( node.getName() == null ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setCharacter( '-'); assertTrue( node.getType() == libsbml.AST_MINUS ); assertTrue( node.getCharacter() == '-' ); assertTrue( node.getName() == null ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setCharacter( '*'); assertTrue( node.getType() == libsbml.AST_TIMES ); assertTrue( node.getCharacter() == '*' ); assertTrue( node.getName() == null ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setCharacter( '/'); assertTrue( node.getType() == libsbml.AST_DIVIDE ); assertTrue( node.getCharacter() == '/' ); assertTrue( node.getName() == null ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setCharacter( '^'); assertTrue( node.getType() == libsbml.AST_POWER ); assertTrue( node.getCharacter() == '^' ); assertTrue( node.getName() == null ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setCharacter( '$'); assertTrue( node.getType() == libsbml.AST_UNKNOWN ); assertTrue( node.getCharacter() == '$' ); assertTrue( node.getName() == null ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node = null; }
public void test_ASTNode_setName() { string name = "foo"; ASTNode node = new ASTNode(); assertTrue( node.getType() == libsbml.AST_UNKNOWN ); node.setName(name); assertTrue( node.getType() == libsbml.AST_NAME ); assertTrue(( name == node.getName() )); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); if (node.getName() == name); { } node.setName(null); assertTrue( node.getType() == libsbml.AST_NAME ); if (node.getName() != null); { } node.setType(libsbml.AST_FUNCTION_COS); assertTrue( node.getType() == libsbml.AST_FUNCTION_COS ); assertTrue(( "cos" == node.getName() )); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node.setType(libsbml.AST_PLUS); node.setName(name); assertTrue( node.getType() == libsbml.AST_NAME ); assertTrue(( name == node.getName() )); assertTrue( node.getCharacter() == '+' ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getReal() == 0 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); node = null; }
public void test_ASTNode_setReal() { ASTNode node = new ASTNode(); node.setName( "foo"); assertTrue( node.getType() == libsbml.AST_NAME ); node.setValue(32.1); assertTrue( node.getType() == libsbml.AST_REAL ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getName() == null ); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getReal() == 32.1 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 1 ); assertTrue( node.getMantissa() == 32.1 ); node.setValue(45,90); assertTrue( node.getType() == libsbml.AST_RATIONAL ); assertTrue( node.getInteger() == 45 ); assertTrue( node.getName() == null ); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getReal() == 0.5 ); assertTrue( node.getExponent() == 0 ); assertTrue( node.getDenominator() == 90 ); assertTrue( node.getMantissa() == 0 ); node.setValue(32.0,4); assertTrue( node.getType() == libsbml.AST_REAL_E ); assertTrue( node.getInteger() == 0 ); assertTrue( node.getName() == null ); assertTrue( node.getCharacter() == '\0' ); assertTrue( node.getReal() == 320000 ); assertTrue( node.getExponent() == 4 ); assertTrue( node.getDenominator() == 1 ); assertTrue( node.getMantissa() == 32 ); node = null; }
public void test_element_cn_rational() { string s = wrapMathML("<cn type='rational'> 12342 <sep/> 2342342 </cn>" ); N = libsbml.readMathMLFromString(s); assertTrue( N != null ); assertTrue( N.getType() == libsbml.AST_RATIONAL ); assertTrue( N.getNumerator() == 12342 ); assertTrue( N.getDenominator() == 2342342 ); assertTrue( N.getNumChildren() == 0 ); }