public void test_L3_Unit_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(3,1); sbmlns.addNamespaces(xmlns); Unit u = new Unit(sbmlns); assertTrue( u.getTypeCode() == libsbml.SBML_UNIT ); assertTrue( u.getMetaId() == "" ); assertTrue( u.getNotes() == null ); assertTrue( u.getAnnotation() == null ); assertTrue( u.getLevel() == 3 ); assertTrue( u.getVersion() == 1 ); assertTrue( u.getNamespaces() != null ); assertTrue( u.getNamespaces().getLength() == 2 ); assertTrue( u.getKind() == libsbml.UNIT_KIND_INVALID ); assertEquals( true, isnan(u.getExponentAsDouble()) ); assertEquals( true, isnan(u.getMultiplier()) ); assertEquals( false, u.isSetKind() ); assertEquals( false, u.isSetExponent() ); assertEquals( false, u.isSetMultiplier() ); assertEquals( false, u.isSetScale() ); u = null; }
public void test_Unit_copyConstructor() { Unit o1 = new Unit(2,4); o1.setKind(libsbml.UNIT_KIND_MOLE); assertTrue( o1.getKind() == libsbml.UNIT_KIND_MOLE ); Unit o2 = new Unit(o1); assertTrue( o2.getKind() == libsbml.UNIT_KIND_MOLE ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_UnitDefinition_getUnit() { Unit mole = new Unit(2,4); Unit litre = new Unit(2,4); Unit second = new Unit(2,4); mole.setKind(libsbml.UnitKind_forName("mole")); litre.setKind(libsbml.UnitKind_forName("litre")); second.setKind(libsbml.UnitKind_forName("second")); mole.setScale(-3); litre.setExponent(-1); second.setExponent(-1); UD.addUnit(mole); UD.addUnit(litre); UD.addUnit(second); mole = null; litre = null; second = null; assertTrue( UD.getNumUnits() == 3 ); mole = UD.getUnit(0); litre = UD.getUnit(1); second = UD.getUnit(2); assertTrue( mole.getKind() == libsbml.UNIT_KIND_MOLE ); assertTrue( litre.getKind() == libsbml.UNIT_KIND_LITRE ); assertTrue( second.getKind() == libsbml.UNIT_KIND_SECOND ); assertTrue( mole.getScale() == -3 ); assertTrue( litre.getExponent() == -1 ); assertTrue( second.getExponent() == -1 ); }
public void test_Unit_assignmentOperator() { Unit o1 = new Unit(2,4); o1.setKind(libsbml.UNIT_KIND_MOLE); assertTrue( o1.getKind() == libsbml.UNIT_KIND_MOLE ); Unit o2 = new Unit(2,4); o2 = o1; assertTrue( o2.getKind() == libsbml.UNIT_KIND_MOLE ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_Unit_set_get() { Unit u = new Unit(2,4); assertTrue( u.getKind() == libsbml.UNIT_KIND_INVALID ); assertTrue( u.getExponent() == 1 ); assertTrue( u.getScale() == 0 ); assertTrue( u.getMultiplier() == 1.0 ); assertEquals( false, u.isSetKind() ); u.setKind(libsbml.UNIT_KIND_WATT); assertTrue( u.getKind() == libsbml.UNIT_KIND_WATT ); u.setExponent(3); assertTrue( u.getExponent() == 3 ); u.setScale(4); assertTrue( u.getScale() == 4 ); u.setMultiplier(3.2); assertTrue( u.getMultiplier() == 3.2 ); u = null; }