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

#include <test000081.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug1205 ()
 

Static Protected Attributes

static const char * MODEL_STRING1
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_bug1205)
 
 CPPUNIT_TEST_SUITE (test000081)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 30 of file test000081.h.

Member Function Documentation

test000081::CPPUNIT_TEST ( test_bug1205  )
private
test000081::CPPUNIT_TEST_SUITE ( test000081  )
private
test000081::CPPUNIT_TEST_SUITE_END ( )
private
void test000081::setUp ( )

Test for bug 1205

Definition at line 36 of file test000081.cpp.

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

37 {
38  // Create the root container.
39  CCopasiRootContainer::init(0, NULL, false);
40  // Create the global data model.
42 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000081.h:39
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000081::tearDown ( )

Definition at line 44 of file test000081.cpp.

References CCopasiRootContainer::destroy().

void test000081::test_bug1205 ( )

Definition at line 49 of file test000081.cpp.

References CCopasiDataModel::exportSBMLToString(), CCopasiDataModel::getCurrentSBMLDocument(), CCopasiDataModel::getModel(), load_cps_model_from_stream(), MODEL_STRING1, and pCOPASIDATAMODEL.

50 {
51  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
52  std::istringstream iss(test000081::MODEL_STRING1);
53  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
54  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
55  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
56  CPPUNIT_ASSERT(pDocument == NULL);
57  std::string sbmlString;
58 
59  try
60  {
61  sbmlString = pDataModel->exportSBMLToString(NULL, 2, 1);
62  }
63  catch (...)
64  {
65  // fail if an uncaught exception occurs during export
66  CPPUNIT_ASSERT(false);
67  }
68 
69  CPPUNIT_ASSERT(!sbmlString.empty());
70  // check if the exported SBML model has three compartments
71  pDocument = pDataModel->getCurrentSBMLDocument();
72  CPPUNIT_ASSERT(pDocument != NULL);
73  const Model* pModel = pDocument->getModel();
74  CPPUNIT_ASSERT(pModel != NULL);
75  unsigned int iMax = pModel->getListOfCompartments()->size();
76  CPPUNIT_ASSERT(iMax == 3);
77  // check that the compartment named compartment_2 has the id compartment_1
78  const Compartment* pCompartment = pModel->getCompartment("compartment_1");
79  CPPUNIT_ASSERT(pCompartment != NULL);
80  CPPUNIT_ASSERT(pCompartment->getName() == "compartment_2");
81 
82  // check if the exported SBML model has three species
83  iMax = pModel->getListOfSpecies()->size();
84  CPPUNIT_ASSERT(iMax == 3);
85  // check that the species named species_2 has the id species_1
86  const Species* pSpecies = pModel->getSpecies("species_1");
87  CPPUNIT_ASSERT(pSpecies != NULL);
88  CPPUNIT_ASSERT(pSpecies->getName() == "species_2");
89 
90  // check if the exported SBML model has three parameters
91  iMax = pModel->getListOfParameters()->size();
92  CPPUNIT_ASSERT(iMax == 3);
93  // check that the parameter named quantity_2 has the id parameter_1
94  const Parameter* pParameter = pModel->getParameter("parameter_1");
95  CPPUNIT_ASSERT(pParameter != NULL);
96  CPPUNIT_ASSERT(pParameter->getName() == "quantity_2");
97 
98  // check if the exported SBML model has three reactions
99  iMax = pModel->getListOfReactions()->size();
100  CPPUNIT_ASSERT(iMax == 3);
101  // check that the reaction named reaction_2 has the id reaction_1
102  const Reaction* pReaction = pModel->getReaction("reaction_1");
103  CPPUNIT_ASSERT(pReaction != NULL);
104  CPPUNIT_ASSERT(pReaction->getName() == "reaction_2");
105 }
SBMLDocument * getCurrentSBMLDocument()
static const char * MODEL_STRING1
Definition: test000081.h:40
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000081.h:39
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
Definition: utilities.cpp:21

Member Data Documentation

const char * test000081::MODEL_STRING1
staticprotected

Definition at line 40 of file test000081.h.

Referenced by test_bug1205().

CCopasiDataModel * test000081::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 39 of file test000081.h.

Referenced by setUp(), and test_bug1205().


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