END_TEST



START_TEST ( test_SpeciesReference_Product_parent_add )
{
    SpeciesReference *sr = new SpeciesReference(2, 4);
    Reaction *r = new Reaction(2, 4);
    sr->setSpecies("p");

    r->addProduct(sr);

    delete sr;

    ListOf *lo = r->getListOfProducts();

    fail_unless(lo == r->getProduct(0)->getParentSBMLObject());
    fail_unless(r == lo->getParentSBMLObject());
}
Example #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);
   }
}