END_TEST


START_TEST (test_SBMLConvert_convertFromL3)
{
  SBMLDocument_t *d = SBMLDocument_createWithLevelAndVersion(3, 1);
  Model_t        *m = SBMLDocument_createModel(d);

  const char   *sid = "C";
  Compartment_t  *c = Model_createCompartment(m);

  Compartment_setId   ( c, sid );
  Compartment_setSize ( c, 1.2 ); 
  Compartment_setConstant( c, 1);
  Compartment_setSpatialDimensionsAsDouble(c, 3.4);

  fail_unless(SBMLDocument_setLevelAndVersion(d, 1, 1) == 0);
  fail_unless(SBMLDocument_setLevelAndVersion(d, 1, 2) == 0);
  fail_unless(SBMLDocument_setLevelAndVersion(d, 2, 1) == 0);
  fail_unless(SBMLDocument_setLevelAndVersion(d, 2, 2) == 0);
  fail_unless(SBMLDocument_setLevelAndVersion(d, 2, 3) == 0);
  fail_unless(SBMLDocument_setLevelAndVersion(d, 2, 4) == 0);
  fail_unless(SBMLDocument_setLevelAndVersion(d, 3, 1) == 1);

}
END_TEST


START_TEST (test_Compartment_setSpatialDimensions5)
{
  Compartment_t *c = 
    Compartment_create(2, 2);

  int i = Compartment_setSpatialDimensionsAsDouble(c, 2.2);

  fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
  fail_unless( Compartment_getSpatialDimensions(c) == 3 );

  Compartment_free(c);
}
END_TEST


START_TEST (test_Compartment_setSpatialDimensions4)
{
  Compartment_t *c = 
    Compartment_create(2, 2);

  int i = Compartment_setSpatialDimensionsAsDouble(c, 2.0);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( Compartment_getSpatialDimensions(c) == 2 );

  Compartment_free(c);
}
Exemplo n.º 4
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)));
}