Beispiel #1
0
END_TEST


START_TEST (test_L3_Unit_hasRequiredAttributes )
{
  Unit_t *u = Unit_create (3, 1);

  fail_unless ( !Unit_hasRequiredAttributes(u));

  Unit_setKind(u, UNIT_KIND_MOLE);

  fail_unless ( !Unit_hasRequiredAttributes(u));

  Unit_setExponentAsDouble(u, 0);

  fail_unless ( !Unit_hasRequiredAttributes(u));

  Unit_setMultiplier(u, 0.45);

  fail_unless ( !Unit_hasRequiredAttributes(u));

  Unit_setScale(u, 2);
  fail_unless ( Unit_hasRequiredAttributes(u));

  Unit_free(u);
}
END_TEST


START_TEST (test_Unit_setExponent3)
{
  int i = Unit_setExponentAsDouble(U, 2.2);

  fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
  fail_unless( Unit_getExponent(U) == 1 );
}
END_TEST


START_TEST (test_Unit_setExponent2)
{
  int i = Unit_setExponentAsDouble(U, 2.0);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( Unit_getExponent(U) == 2 );
}
Beispiel #4
0
END_TEST


START_TEST (test_L3_Unit_exponent)
{
  double exponent = 0.2;

  fail_unless( !Unit_isSetExponent(U));
  fail_unless( isnan(Unit_getExponentAsDouble(U)));
  
  Unit_setExponentAsDouble(U, exponent);

  fail_unless( Unit_getExponentAsDouble(U) == exponent );
  fail_unless( Unit_isSetExponent(U) );
}