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

#include <test000060.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug_1026 ()
 

Static Protected Attributes

static const char * MODEL_STRING1
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_bug_1026)
 
 CPPUNIT_TEST_SUITE (test000060)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

This test checks if the constant and boundaryCondition flags are set correctly when a FIXED metabolite is changed back to status REACTIONS.

Definition at line 31 of file test000060.h.

Member Function Documentation

test000060::CPPUNIT_TEST ( test_bug_1026  )
private
test000060::CPPUNIT_TEST_SUITE ( test000060  )
private
test000060::CPPUNIT_TEST_SUITE_END ( )
private
void test000060::setUp ( )

Definition at line 36 of file test000060.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 * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000060.h:39
void test000060::tearDown ( )

Definition at line 44 of file test000060.cpp.

References CCopasiRootContainer::destroy().

void test000060::test_bug_1026 ( )

Definition at line 49 of file test000060.cpp.

References CModel::buildInitialRefreshSequence(), CCopasiDataModel::exportSBMLToString(), CCopasiDataModel::getCurrentSBMLDocument(), CModel::getMetabolites(), CCopasiDataModel::getModel(), CCopasiDataModel::importSBMLFromString(), MODEL_STRING1, pCOPASIDATAMODEL, CModelEntity::REACTIONS, and CCopasiVector< T >::size().

50 {
51  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
52  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000060::MODEL_STRING1));
53  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
54  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
55  const Model* pSBMLModel = pDocument->getModel();
56  CPPUNIT_ASSERT(pSBMLModel != NULL);
57  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 0);
58  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
59  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
60  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 0);
61  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
62  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 0);
63  // check if the species is constant and has boundaryCondition set to true
64  const Species* pSpecies = pSBMLModel->getSpecies(0);
65  CPPUNIT_ASSERT(pSpecies != NULL);
66  CPPUNIT_ASSERT(pSpecies->getConstant() == true);
67  CPPUNIT_ASSERT(pSpecies->getBoundaryCondition() == true);
68  // now change the status of the species in the underlying COPASI model
69  CPPUNIT_ASSERT(pDataModel->getModel()->getMetabolites().size() == 1);
70  CMetab* pMetab = pDataModel->getModel()->getMetabolites()[0];
71  pMetab->setStatus(CModelEntity::REACTIONS);
72  std::set<const CCopasiObject*> changedObjects;
73  changedObjects.insert(pMetab);
74  std::vector<Refresh*> refreshes = pDataModel->getModel()->buildInitialRefreshSequence(changedObjects);
75  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
76 
77  while (refreshIt != refreshEndit)
78  {
79  (**refreshIt++)();
80  }
81 
82  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
83  pDocument = pDataModel->getCurrentSBMLDocument();
84  pSBMLModel = pDocument->getModel();
85  CPPUNIT_ASSERT(pSBMLModel != NULL);
86  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 0);
87  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
88  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
89  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 0);
90  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
91  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 0);
92  // check if the species is constant and has boundaryCondition set to false
93  pSpecies = pSBMLModel->getSpecies(0);
94  CPPUNIT_ASSERT(pSpecies != NULL);
95  CPPUNIT_ASSERT(pSpecies->getConstant() == false);
96  CPPUNIT_ASSERT(pSpecies->getBoundaryCondition() == false);
97 }
SBMLDocument * getCurrentSBMLDocument()
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
virtual size_t size() const
Definition: CMetab.h:178
static const char * MODEL_STRING1
Definition: test000060.h:38
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000060.h:39
std::vector< Refresh * > buildInitialRefreshSequence(std::set< const CCopasiObject * > &changedObjects)
Definition: CModel.cpp:4164

Member Data Documentation

const char * test000060::MODEL_STRING1
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sbml xmlns=\"http://www.sbml.org/sbml/level2\" metaid=\"_000000\" level=\"2\" version=\"1\">\n"
" <model metaid=\"_000001\" id=\"bug_1026\" name=\"bug_1026\">\n"
" <listOfCompartments>\n"
" <compartment metaid=\"_000005\" id=\"compartment_1\" name=\"compartment_1\" size=\"1e-16\">\n"
" </compartment>\n"
" </listOfCompartments>\n"
" <listOfSpecies>\n"
" <species metaid=\"_000006\" id=\"species_1\" name=\"species_1\" compartment=\"compartment_1\" initialAmount=\"1.0\" constant=\"true\" boundaryCondition=\"true\" />\n"
" </listOfSpecies> \n"
" </model>\n"
"</sbml>\n"

Definition at line 38 of file test000060.h.

Referenced by test_bug_1026().

CCopasiDataModel * test000060::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 39 of file test000060.h.

Referenced by setUp(), and test_bug_1026().


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