Ejemplo n.º 1
0
END_TEST


START_TEST (test_Compartment_initDefaults)
{
  Compartment_t *c = Compartment_create(2, 4);
    
  Compartment_setId(c, "A");
  Compartment_initDefaults(c);

  fail_unless( !strcmp(Compartment_getId     (c), "A"));
  fail_unless( Compartment_getName   (c) == NULL );
  fail_unless( Compartment_getUnits  (c) == NULL );
  fail_unless( Compartment_getOutside(c) == NULL );

  fail_unless( Compartment_getSpatialDimensions(c) == 3   );
  fail_unless( Compartment_getVolume           (c) == 1.0 );
  fail_unless( Compartment_getConstant         (c) == 1   );

  fail_unless( Compartment_isSetId     (c) );
  fail_unless( !Compartment_isSetName   (c) );
  fail_unless( !Compartment_isSetSize   (c) );
  fail_unless( !Compartment_isSetVolume (c) );
  fail_unless( !Compartment_isSetUnits  (c) );
  fail_unless( !Compartment_isSetOutside(c) );
  fail_unless( Compartment_isSetSpatialDimensions(c) );
  fail_unless( Compartment_isSetConstant(c) );
  
  Compartment_free(c);
}
Ejemplo n.º 2
0
END_TEST


START_TEST (test_Compartment_getSpatialDimensions)
{
  fail_unless( Compartment_isSetSpatialDimensions(C) );
  fail_unless( Compartment_getSpatialDimensions(C) == 3);
  Compartment_setSpatialDimensions(C, 1);

  fail_unless( Compartment_getSpatialDimensions(C) == 1);
  fail_unless( Compartment_isSetSpatialDimensions(C) );

  fail_unless( Compartment_unsetSpatialDimensions(C) == LIBSBML_UNEXPECTED_ATTRIBUTE);
  fail_unless( Compartment_getSpatialDimensions(C) == 3);
  fail_unless( Compartment_isSetSpatialDimensions(C) );
}
Ejemplo n.º 3
0
END_TEST


START_TEST (test_L3_Compartment_spatialDimensions)
{
  fail_unless( !Compartment_isSetSpatialDimensions(C));
  fail_unless( util_isNaN(Compartment_getSpatialDimensionsAsDouble(C)));

  Compartment_setSpatialDimensionsAsDouble(C, 1.5);

  fail_unless( Compartment_isSetSpatialDimensions(C));
  fail_unless( Compartment_getSpatialDimensionsAsDouble(C) == 1.5);

  Compartment_unsetSpatialDimensions(C);

  fail_unless( !Compartment_isSetSpatialDimensions(C));
  fail_unless( util_isNaN(Compartment_getSpatialDimensionsAsDouble(C)));
}
Ejemplo n.º 4
0
END_TEST


START_TEST (test_L3_Compartment_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);

  Compartment_t *c = 
    Compartment_createWithNS (sbmlns);


  fail_unless( SBase_getTypeCode  ((SBase_t *) c) == SBML_COMPARTMENT );
  fail_unless( SBase_getMetaId    ((SBase_t *) c) == NULL );
  fail_unless( SBase_getNotes     ((SBase_t *) c) == NULL );
  fail_unless( SBase_getAnnotation((SBase_t *) c) == NULL );

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

  fail_unless( Compartment_getNamespaces     (c) != NULL );
  fail_unless( XMLNamespaces_getLength(Compartment_getNamespaces(c)) == 2 );


  fail_unless( Compartment_getId     (c) == NULL );
  fail_unless( Compartment_getName   (c) == NULL );
  fail_unless( Compartment_getUnits  (c) == NULL );
  fail_unless( Compartment_getOutside(c) == NULL );

  fail_unless( util_isNaN(Compartment_getSpatialDimensionsAsDouble(c))   );
  fail_unless( util_isNaN(Compartment_getVolume(c)));
  fail_unless( Compartment_getConstant(c) == 1   );

  fail_unless( !Compartment_isSetId     (c) );
  fail_unless( !Compartment_isSetSpatialDimensions (c) );
  fail_unless( !Compartment_isSetName   (c) );
  fail_unless( !Compartment_isSetSize   (c) );
  fail_unless( !Compartment_isSetVolume (c) );
  fail_unless( !Compartment_isSetUnits  (c) );
  fail_unless( !Compartment_isSetOutside(c) );
  fail_unless( !Compartment_isSetConstant(c) );

  Compartment_free(c);
  XMLNamespaces_free(xmlns);
  SBMLNamespaces_free(sbmlns);
}