END_TEST


START_TEST ( test_SpeciesReference_Reactant_parent_add )
{
    SpeciesReference *sr = new SpeciesReference(2, 4);
    Reaction *r = new Reaction(2, 4);

    sr->setSpecies("s");
    r->addReactant(sr);

    delete sr;

    ListOf *lo = r->getListOfReactants();

    fail_unless(lo == r->getReactant(0)->getParentSBMLObject());
    fail_unless(r == lo->getParentSBMLObject());
}
Ejemplo n.º 2
0
void CrfLoader::loadReaction (Reaction &reaction)
{
   int i;
   int nreactants = _scanner.readPackedUInt();
   int nproducts = _scanner.readPackedUInt();
   byte flags = _scanner.readByte();
   int ncatalyst = 0;
   if (flags & CrfFeatureFlags::CRF_CATALYST)
      ncatalyst = _scanner.readPackedUInt();

   reaction.clear();

   _bond_rc_flags = 0;
   _atom_stereo_flags = 0;
   _aam = 0;

   bool have_aam = (flags != 0);

   for (i = 0; i < nreactants; i++)
   {
      int index = reaction.addReactant();
      _loadReactionMolecule(reaction, index, have_aam);
   }

   for (i = 0; i < nproducts; i++)
   {
      int index = reaction.addProduct();
      _loadReactionMolecule(reaction, index, have_aam);
   }

   for (i = 0; i < ncatalyst; i++)
   {
      int index = reaction.addCatalyst();
      _loadReactionMolecule(reaction, index, have_aam);
   }
}