END_TEST


START_TEST (test_Reaction_setKineticLaw3)
{
  KineticLaw_t *kl = 
    KineticLaw_create(1, 2);

  int i = Reaction_setKineticLaw(R, kl);

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

  KineticLaw_free(kl);
}
END_TEST


START_TEST (test_Reaction_setKineticLaw4)
{
  int i = Reaction_setKineticLaw(R, NULL);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( !Reaction_isSetKineticLaw(R) );

  i = Reaction_unsetKineticLaw(R);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( !Reaction_isSetKineticLaw(R) );
}
END_TEST


START_TEST (test_Reaction_setKineticLaw2)
{
  KineticLaw_t *kl = 
    KineticLaw_create(1, 1);

  int i = Reaction_setKineticLaw(R, kl);

  fail_unless( i == LIBSBML_VERSION_MISMATCH );
  fail_unless( !Reaction_isSetKineticLaw(R) );

  KineticLaw_free(kl);
}
Esempio n. 4
0
File: doc.c Progetto: cran/rsbml
static Reaction_t *
rsbml_build_doc_reaction(SEXP r_reaction)
{
  Reaction_t * reaction;
  SEXP kineticLaw = GET_SLOT(r_reaction, install("kineticLaw"));
  
  reaction = Reaction_create();
  
  rsbml_build_doc_s_base((SBase_t *)reaction, r_reaction);
  
  SET_ATTR(Reaction, reaction, Id, id, STRING);
  SET_ATTR(Reaction, reaction, Name, name, STRING);
  ADD_LIST(Reaction, reaction, Reactant, reactants, species_reference);
  ADD_LIST(Reaction, reaction, Product, products, species_reference);
  ADD_LIST(Reaction, reaction, Modifier, modifiers, modifier_species_reference);
  if (GET_LENGTH(kineticLaw))
    Reaction_setKineticLaw(reaction, rsbml_build_doc_kinetic_law(kineticLaw));
  SET_ATTR(Reaction, reaction, Reversible, reversible, LOGICAL);
  SET_ATTR(Reaction, reaction, Fast, fast, LOGICAL);
  
  return reaction;
}