COPASI API  4.16.103
Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
test000099 Class Reference

#include <test000099.h>

Inheritance diagram for test000099:
Inheritance graph
[legend]
Collaboration diagram for test000099:
Collaboration graph
[legend]

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug1675 ()
 

Protected Attributes

CCopasiDataModelpDataModel
 

Static Protected Attributes

static const char * SBML_MODEL_BAD
 
static const char * SBML_MODEL_GOOD
 

Private Member Functions

 CPPUNIT_TEST (test_bug1675)
 
 CPPUNIT_TEST_SUITE (test000099)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 28 of file test000099.h.

Member Function Documentation

test000099::CPPUNIT_TEST ( test_bug1675  )
private
test000099::CPPUNIT_TEST_SUITE ( test000099  )
private
test000099::CPPUNIT_TEST_SUITE_END ( )
private
void test000099::setUp ( )

Definition at line 25 of file test000099.cpp.

References CCopasiRootContainer::addDatamodel(), CCopasiRootContainer::init(), and pDataModel.

26 {
27  // Create the root container.
28  CCopasiRootContainer::init(0, NULL, false);
30 }
CCopasiDataModel * pDataModel
Definition: test000099.h:41
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000099::tearDown ( )

Definition at line 32 of file test000099.cpp.

References CCopasiRootContainer::destroy().

void test000099::test_bug1675 ( )

Definition at line 39 of file test000099.cpp.

References CCopasiObject::getCN(), CCopasiDataModel::getModel(), CCopasiDataModel::importSBMLFromString(), CCopasiDataModel::ObjectFromName(), pDataModel, SBML_MODEL_BAD, and SBML_MODEL_GOOD.

40 {
41  CPPUNIT_ASSERT(pDataModel != NULL);
42  CModel* pModel = NULL;
43  std::vector< CCopasiContainer * > listOfContainer;
44 
45  // try to import the file which should lead to an exception
46  try
47  {
49  // importing should lead to an exception, so we should never
50  // reach this point
51  assert(false);
52  }
53  catch (...)
54  {
55  CPPUNIT_ASSERT(pModel == NULL);
56  const CModel * pModel2 =
57  dynamic_cast< const CModel * >(pDataModel->ObjectFromName(listOfContainer, CCopasiObjectName("CN=Root,Model=my test model")));
58  CPPUNIT_ASSERT(pModel2 == NULL);
59  }
60 
61  // import the good model
62  try
63  {
64  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(SBML_MODEL_GOOD) == true);
65  }
66  catch (...)
67  {
68  // this should not lead to an exception
69  assert(false);
70  }
71 
72  // now check if we find the object for the model name
73  pModel = pDataModel->getModel();
74  CPPUNIT_ASSERT(pModel != NULL);
75  const CModel * pModel2 =
76  dynamic_cast< const CModel * >(pDataModel->ObjectFromName(listOfContainer, pDataModel->getModel()->getCN()));
77  CPPUNIT_ASSERT(pModel == pModel2);
78 }
static const char * SBML_MODEL_BAD
Definition: test000099.h:36
virtual CCopasiObjectName getCN() const
static const char * SBML_MODEL_GOOD
Definition: test000099.h:39
CCopasiDataModel * pDataModel
Definition: test000099.h:41
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
Definition: CModel.h:50
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const

Member Data Documentation

CCopasiDataModel* test000099::pDataModel
protected

Definition at line 41 of file test000099.h.

Referenced by setUp(), and test_bug1675().

const char * test000099::SBML_MODEL_BAD
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
" <model name=\"my test model\">\n"
" <listOfCompartments>\n"
" <compartment id=\"compartment_1\" size=\"1.0\"/>\n"
" </listOfCompartments>\n"
" <listOfSpecies>\n"
" <species id=\"species_1\" compartment=\"compartment_1\" initialConcentration=\"1.0\"/>\n"
" <species id=\"species_2\" compartment=\"compartment_1\" initialConcentration=\"1.0\"/>\n"
" </listOfSpecies>\n"
" <listOfReactions>\n"
" <reaction id=\"reaction_1\">\n"
" <listOfReactants>\n"
" <speciesReference species=\"species_1\"/>\n"
" </listOfReactants>\n"
" <kineticLaw>\n"
" <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
" <apply>\n"
" <times/>\n"
" <ci> species_1 </ci>\n"
" <ci> species_2 </ci>\n"
" </apply>\n"
" </math>\n"
" </kineticLaw>\n"
" </reaction>\n"
" </listOfReactions>\n"
" </model>\n"
"</sbml>\n"

Definition at line 36 of file test000099.h.

Referenced by test_bug1675().

const char * test000099::SBML_MODEL_GOOD
staticprotected

Definition at line 39 of file test000099.h.

Referenced by test_bug1675().


The documentation for this class was generated from the following files: