Ejemplo n.º 1
0
END_TEST


START_TEST (test_Species_getsetHasOnlySubstanceUnits)
{
  // defaults
  fail_unless( Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless( Species_isSetHasOnlySubstanceUnits(S) == 1);

  Species_setHasOnlySubstanceUnits(S, 1);

  fail_unless( Species_getHasOnlySubstanceUnits(S) == 1);
  fail_unless( Species_isSetHasOnlySubstanceUnits(S) == 1);

  int ret = Species_unsetHasOnlySubstanceUnits(S);

  fail_unless(ret == LIBSBML_UNEXPECTED_ATTRIBUTE);
  fail_unless( Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless( Species_isSetHasOnlySubstanceUnits(S) == 1);

  Species_setHasOnlySubstanceUnits(S, 0);

  fail_unless( Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless( Species_isSetHasOnlySubstanceUnits(S) == 1);

  ret = Species_unsetHasOnlySubstanceUnits(S);

  fail_unless(ret == LIBSBML_UNEXPECTED_ATTRIBUTE);
  fail_unless( Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless( Species_isSetHasOnlySubstanceUnits(S) == 1);
}
Ejemplo n.º 2
0
END_TEST


START_TEST (test_L3_Species_hasOnlySubstanceUnits)
{
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 0);

  Species_setHasOnlySubstanceUnits(S, 1);

  fail_unless(Species_getHasOnlySubstanceUnits(S) == 1);
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 1);

  int ret = Species_unsetHasOnlySubstanceUnits(S);

  fail_unless(ret == LIBSBML_OPERATION_SUCCESS);
  fail_unless(Species_getHasOnlySubstanceUnits(S) == 1);
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 0);

  Species_setHasOnlySubstanceUnits(S, 0);

  fail_unless(Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 1);

  ret = Species_unsetHasOnlySubstanceUnits(S);

  fail_unless(ret == LIBSBML_OPERATION_SUCCESS);
  fail_unless(Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 0);
}
Ejemplo n.º 3
0
END_TEST


START_TEST (test_L3_Species_initDefaults)
{
  Species_t *s = Species_create(3,1);

  fail_unless( Species_getId     (s) == NULL );
  fail_unless( Species_getName   (s) == NULL );
  fail_unless( Species_getCompartment  (s) == NULL );
  fail_unless( util_isNaN(Species_getInitialAmount (s)) );
  fail_unless( util_isNaN(Species_getInitialConcentration (s)) );
  fail_unless( Species_getSubstanceUnits  (s) == NULL );
  fail_unless( Species_getHasOnlySubstanceUnits(s) == 0   );
  fail_unless( Species_getBoundaryCondition(s) == 0   );
  fail_unless( Species_getConstant(s) == 0   );
  fail_unless( Species_getConversionFactor  (s) == NULL );

  fail_unless( !Species_isSetId     (s) );
  fail_unless( !Species_isSetName   (s) );
  fail_unless( !Species_isSetCompartment (s) );
  fail_unless( !Species_isSetInitialAmount (s) );
  fail_unless( !Species_isSetInitialConcentration (s) );
  fail_unless( !Species_isSetSubstanceUnits  (s) );
  fail_unless( !Species_isSetHasOnlySubstanceUnits(s)   );
  fail_unless( !Species_isSetBoundaryCondition(s)   );
  fail_unless( !Species_isSetConstant(s)   );
  fail_unless( !Species_isSetConversionFactor  (s) );

  Species_initDefaults(s);

  fail_unless( Species_getId     (s) == NULL );
  fail_unless( Species_getName   (s) == NULL );
  fail_unless( Species_getCompartment  (s) == NULL );
  fail_unless( util_isNaN(Species_getInitialAmount (s)) );
  fail_unless( util_isNaN(Species_getInitialConcentration (s)) );
  fail_unless( !strcmp(Species_getSubstanceUnits  (s),"mole" ));
  fail_unless( Species_getHasOnlySubstanceUnits(s) == 0   );
  fail_unless( Species_getBoundaryCondition(s) == 0   );
  fail_unless( Species_getConstant(s) == 0   );
  fail_unless( Species_getConversionFactor  (s) == NULL );

  fail_unless( !Species_isSetId     (s) );
  fail_unless( !Species_isSetName   (s) );
  fail_unless( !Species_isSetCompartment (s) );
  fail_unless( !Species_isSetInitialAmount (s) );
  fail_unless( !Species_isSetInitialConcentration (s) );
  fail_unless( Species_isSetSubstanceUnits  (s) );
  fail_unless( Species_isSetHasOnlySubstanceUnits(s)   );
  fail_unless( Species_isSetBoundaryCondition(s)   );
  fail_unless( Species_isSetConstant(s)   );
  fail_unless( !Species_isSetConversionFactor  (s) );

  Species_free(s);
}
Ejemplo n.º 4
0
END_TEST


START_TEST (test_L3_Species_hasOnlySubstanceUnits)
{
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 0);

  Species_setHasOnlySubstanceUnits(S, 1);

  fail_unless(Species_getHasOnlySubstanceUnits(S) == 1);
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 1);

  Species_setHasOnlySubstanceUnits(S, 0);

  fail_unless(Species_getHasOnlySubstanceUnits(S) == 0);
  fail_unless(Species_isSetHasOnlySubstanceUnits(S) == 1);

}
Ejemplo n.º 5
0
END_TEST


START_TEST (test_L3_Species_createWithNS )
{
  XMLNamespaces_t *xmlns = XMLNamespaces_create();
  XMLNamespaces_add(xmlns, "http://www.sbml.org", "testsbml");
  SBMLNamespaces_t *sbmlns = SBMLNamespaces_create(3,1);
  SBMLNamespaces_addNamespaces(sbmlns,xmlns);

  Species_t *s = 
    Species_createWithNS (sbmlns);


  fail_unless( SBase_getTypeCode  ((SBase_t *) s) == SBML_SPECIES );
  fail_unless( SBase_getMetaId    ((SBase_t *) s) == NULL );
  fail_unless( SBase_getNotes     ((SBase_t *) s) == NULL );
  fail_unless( SBase_getAnnotation((SBase_t *) s) == NULL );

  fail_unless( SBase_getLevel       ((SBase_t *) s) == 3 );
  fail_unless( SBase_getVersion     ((SBase_t *) s) == 1 );

  fail_unless( Species_getNamespaces     (s) != NULL );
  fail_unless( XMLNamespaces_getLength(Species_getNamespaces(s)) == 2 );


  fail_unless( Species_getId     (s) == NULL );
  fail_unless( Species_getName   (s) == NULL );
  fail_unless( Species_getCompartment  (s) == NULL );
  fail_unless( util_isNaN(Species_getInitialAmount (s)) );
  fail_unless( util_isNaN(Species_getInitialConcentration (s)) );
  fail_unless( Species_getSubstanceUnits  (s) == NULL );
  fail_unless( Species_getHasOnlySubstanceUnits(s) == 0   );
  fail_unless( Species_getBoundaryCondition(s) == 0   );
  fail_unless( Species_getConstant(s) == 0   );
  fail_unless( Species_getConversionFactor  (s) == NULL );

  fail_unless( !Species_isSetId     (s) );
  fail_unless( !Species_isSetName   (s) );
  fail_unless( !Species_isSetCompartment (s) );
  fail_unless( !Species_isSetInitialAmount (s) );
  fail_unless( !Species_isSetInitialConcentration (s) );
  fail_unless( !Species_isSetSubstanceUnits  (s) );
  fail_unless( !Species_isSetHasOnlySubstanceUnits(s)   );
  fail_unless( !Species_isSetBoundaryCondition(s)   );
  fail_unless( !Species_isSetConstant(s)   );
  fail_unless( !Species_isSetConversionFactor  (s) );

  Species_free(s);
  XMLNamespaces_free(xmlns);
  SBMLNamespaces_free(sbmlns);
}