Exemplo n.º 1
0
END_TEST


START_TEST (test_AssignmentRule_setVariable)
{
  const char *variable = "x";


  Rule_setVariable(AR, variable);

  fail_unless( !strcmp(Rule_getVariable(AR), variable) );
  fail_unless( Rule_isSetVariable(AR) );

  if (Rule_getVariable(AR) == variable)
  {
    fail("Rule_setVariable(...) did not make a copy of string.");
  }

  /* Reflexive case (pathological) */
  Rule_setVariable(AR, Rule_getVariable(AR));
  fail_unless( !strcmp(Rule_getVariable(AR), variable) );

  Rule_setVariable(AR, NULL);
  fail_unless( !Rule_isSetVariable(AR) );

  if (Rule_getVariable(AR) != NULL)
  {
    fail("Rule_setVariable(AR, NULL) did not clear string.");
  }
}
Exemplo n.º 2
0
END_TEST


START_TEST (test_ParameterRule_setName)
{
  const char *name = "cell";
  const char *c;


  Rule_setVariable(PR, name);

  fail_unless( !strcmp(Rule_getVariable(PR), name));
  fail_unless( Rule_isSetVariable(PR) );

  if (Rule_getVariable(PR) == name)
  {
    fail( "ParameterRule_setName(...) did not make a copy of string." );
          
  }

  /* Reflexive case (pathological) */
  c = Rule_getVariable(PR);
  Rule_setVariable(PR, c);
  fail_unless( !strcmp(Rule_getVariable(PR), name),
               NULL );

  Rule_setVariable(PR, NULL);
  fail_unless( !Rule_isSetVariable(PR) );

  if (Rule_getVariable(PR) != NULL)
  {
    fail( "Rule_setVariable(PR, NULL)"
          " did not clear string." );
  }
}
Exemplo n.º 3
0
END_TEST


START_TEST (test_Rule_setVariable2)
{
  int i = Rule_setVariable(R, "mole");

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( Rule_isSetVariable(R)   );

  i = Rule_setVariable(R, "");

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( !Rule_isSetVariable(R)   );
}
Exemplo n.º 4
0
END_TEST


START_TEST (test_Rule_setVariable1)
{
  int i = Rule_setVariable(R, "1mole");

  fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE);
  fail_unless( !Rule_isSetVariable(R)   );
}
Exemplo n.º 5
0
END_TEST


START_TEST (test_Rule_setVariable3)
{
  Rule_t *R1 = 
    Rule_createAlgebraic(1, 2);
  
  int i = Rule_setVariable(R1, "r");

  fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE);
  fail_unless( !Rule_isSetVariable(R1)   );

  Rule_free(R1);
}
END_TEST


START_TEST (test_SpeciesConcentrationRule_setSpecies)
{
  const char       *species = "s2";
  const char *s;


  Rule_setVariable(SCR, species);

  fail_unless( !strcmp(Rule_getVariable(SCR), species),
               NULL );
  fail_unless( Rule_isSetVariable(SCR) );

  if (Rule_getVariable(SCR) == species)
  {
    fail( "SpeciesConcentrationRule_setSpecies(...)"
          " did not make a copy of string." );
  }

  /* Reflexive case (pathological) */
  s = Rule_getVariable(SCR);
  Rule_setVariable(SCR, s);
  fail_unless( !strcmp(Rule_getVariable(SCR), species),
               NULL );

  Rule_setVariable(SCR, NULL);
  fail_unless( !Rule_isSetVariable(SCR) );

  if (Rule_getVariable(SCR) != NULL)
  {
    fail( "SpeciesConcentrationRule_setSpecies(SCR, NULL)"
          " did not clear string." );
  }
}
END_TEST


START_TEST (test_CompartmentVolumeRule_setCompartment)
{
  const char *c;
  const char *compartment = "cell";


  Rule_setVariable(CVR, compartment);

  fail_unless( !strcmp(Rule_getVariable(CVR), compartment),
               NULL );
  fail_unless( Rule_isSetVariable(CVR) );

  if (Rule_getVariable(CVR) == compartment)
  {
    fail( "Rule_setVariable(...)"
          " did not make a copy of string." );
  }

  /* Reflexive case (pathological) */
  c = Rule_getVariable(CVR);
  Rule_setVariable(CVR, c);
  fail_unless( !strcmp(Rule_getVariable(CVR), compartment),
               NULL );

  Rule_setVariable(CVR, NULL);
  fail_unless( !Rule_isSetVariable(CVR) );

  if (Rule_getVariable(CVR) != NULL)
  {
    fail( "Rule_setVariable(CVR, NULL)"
          " did not clear string." );
  }
}