Ejemplo n.º 1
0
END_TEST


START_TEST (test_AssignmentRule_createWithFormula)
{
  const ASTNode_t *math;
  char *formula;

  Rule_t *ar = Rule_createAssignment(2, 4);
  Rule_setVariable(ar, "s");
  Rule_setFormula(ar, "1 + 1");


  fail_unless( SBase_getTypeCode  ((SBase_t *) ar) == SBML_ASSIGNMENT_RULE );
  fail_unless( SBase_getMetaId    ((SBase_t *) ar) == NULL );
  fail_unless( !strcmp(Rule_getVariable(ar), "s") );

  math = Rule_getMath((Rule_t *) ar);
  fail_unless(math != NULL);

  formula = SBML_formulaToString(math);
  fail_unless( formula != NULL );
  fail_unless( !strcmp(formula, "1 + 1") );

  fail_unless( !strcmp(Rule_getFormula((Rule_t *) ar), formula) );

  Rule_free(ar);
  safe_free(formula);
}
Ejemplo n.º 2
0
void
RuleTest1_setup (void)
{
  R = Rule_createAssignment(2, 4);

  if (R == NULL)
  {
    fail("Rule_create() returned a NULL pointer.");
  }
}
Ejemplo n.º 3
0
void
AssignmentRuleTest_setup (void)
{
  AR = Rule_createAssignment(2, 4);

  if (AR == NULL)
  {
    fail("Rule_createAssignment() returned a NULL pointer.");
  }
}
void
SpeciesConcentrationRuleTest_setup (void)
{
  SCR = Rule_createAssignment(1, 2);
  Rule_setL1TypeCode(SCR, SBML_SPECIES_CONCENTRATION_RULE);

  if (SCR == NULL)
  {
    fail("Rule_createAssignment() returned a NULL pointer.");
  }
}
void
CompartmentVolumeRuleTest_setup (void)
{
  CVR = Rule_createAssignment(1, 2);
  Rule_setL1TypeCode(CVR, SBML_COMPARTMENT_VOLUME_RULE);

  if (CVR == NULL)
  {
    fail("Rule_create() returned a NULL pointer.");
  }
}
Ejemplo n.º 6
0
void
ParameterRuleTest_setup (void)
{
  PR = Rule_createAssignment(1, 2);
  Rule_setL1TypeCode(PR, SBML_PARAMETER_RULE);

  if (PR == NULL)
  {
    fail("Rule_createAssignment() returned a NULL pointer.");
  }
}
Ejemplo n.º 7
0
END_TEST


START_TEST (test_AssignmentRule_createWithMath)
{
  ASTNode_t       *math = SBML_parseFormula("1 + 1");

  Rule_t *ar = Rule_createAssignment(2, 4);
  Rule_setVariable(ar, "s");
  Rule_setMath(ar, math);


  fail_unless( SBase_getTypeCode  ((SBase_t *) ar) == SBML_ASSIGNMENT_RULE );
  fail_unless( SBase_getMetaId    ((SBase_t *) ar) == NULL );
  fail_unless( !strcmp(Rule_getVariable(ar), "s") );
  fail_unless( !strcmp(Rule_getFormula((Rule_t *) ar), "1 + 1") );
  fail_unless( Rule_getMath((Rule_t *) ar) != math );

  Rule_free(ar);
}
Ejemplo n.º 8
0
END_TEST


START_TEST (test_Rule_setUnits4)
{
  Rule_t *R1 = 
    Rule_createAssignment(1, 2);
  Rule_setL1TypeCode(R1, SBML_PARAMETER_RULE);

  int i = Rule_setUnits(R1, "second");

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( Rule_isSetUnits(R1)   );

  i = Rule_setUnits(R1, NULL);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( !Rule_isSetUnits(R1)   );

  Rule_free(R1);
}
Ejemplo n.º 9
0
END_TEST


START_TEST (test_Rule_setUnits3)
{
  Rule_t *R1 = 
    Rule_createAssignment(1, 2);
  Rule_setL1TypeCode(R1, SBML_PARAMETER_RULE);
  
  int i = Rule_setUnits(R1, "1second");

  fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE);
  fail_unless( !Rule_isSetUnits(R1)   );

  i = Rule_unsetUnits(R1);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( !Rule_isSetUnits(R1)   );

  Rule_free(R1);
}