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

#include <test000045.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_stoichiometricExpression ()
 

Static Protected Attributes

static const char * MODEL_STRING
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_stoichiometricExpression)
 
 CPPUNIT_TEST_SUITE (test000045)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000045.h.

Member Function Documentation

test000045::CPPUNIT_TEST ( test_stoichiometricExpression  )
private
test000045::CPPUNIT_TEST_SUITE ( test000045  )
private
test000045::CPPUNIT_TEST_SUITE_END ( )
private
void test000045::setUp ( )

Definition at line 28 of file test000045.cpp.

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

29 {
30  // Create the root container.
31  CCopasiRootContainer::init(0, NULL, false);
32  // Create the global data model.
34 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000045.h:32
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000045::tearDown ( )

Definition at line 36 of file test000045.cpp.

References CCopasiRootContainer::destroy().

void test000045::test_stoichiometricExpression ( )

Definition at line 41 of file test000045.cpp.

References CModelEntity::FIXED, CChemEq::getCompartmentNumber(), CCopasiMessage::getLastMessage(), CCopasiDataModel::getModel(), CChemEq::getModifiers(), CChemEq::getProducts(), CChemEq::getSubstrates(), CCopasiDataModel::importSBMLFromString(), CModel::ml, CModel::mMol, MODEL_STRING, pCOPASIDATAMODEL, CModelEntity::REACTIONS, CModel::s, CCopasiVector< T >::size(), and CCopasiMessage::WARNING.

42 {
43  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
44  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING));
45  CModel* pModel = pDataModel->getModel();
46  CPPUNIT_ASSERT(pModel != NULL);
47  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CModel::mMol);
48  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CModel::ml);
49  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CModel::s);
50  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
51  const CCompartment* pCompartment = pModel->getCompartments()[0];
52  CPPUNIT_ASSERT(pCompartment != NULL);
53  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::FIXED);
54  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 2);
55  CMetab* pA = pModel->getMetabolites()[0];
56  CPPUNIT_ASSERT(pA != NULL);
57  CPPUNIT_ASSERT(pA->getStatus() == CModelEntity::REACTIONS);
58  const CMetab* pB = pModel->getMetabolites()[1];
59  CPPUNIT_ASSERT(pB != NULL);
60  CPPUNIT_ASSERT(pB->getStatus() == CModelEntity::REACTIONS);
61  CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
62  const CModelValue* pModelValue = pModel->getModelValues()[0];
63  CPPUNIT_ASSERT(pModelValue != NULL);
64  CPPUNIT_ASSERT(pModelValue->getStatus() == CModelEntity::FIXED);
65 
66  CPPUNIT_ASSERT(pModel->getReactions().size() == 1);
67  const CReaction* pReaction1 = pModel->getReactions()[0];
68  CPPUNIT_ASSERT(pReaction1 != NULL);
69  CPPUNIT_ASSERT(pReaction1->isReversible() == true);
70  // check the kinetic law
71  const CFunction* pKineticFunction = pReaction1->getFunction();
72  CPPUNIT_ASSERT(pKineticFunction != NULL);
73  const CMassAction* pMassAction = dynamic_cast<const CMassAction*>(pKineticFunction);
74  CPPUNIT_ASSERT(pMassAction != NULL);
75  const CChemEq* pChemEq = &pReaction1->getChemEq();
76  CPPUNIT_ASSERT(pChemEq != NULL);
77  CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
78  CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
79  const CChemEqElement* pElement = pChemEq->getSubstrates()[0];
80  CPPUNIT_ASSERT(pElement != NULL);
81  CPPUNIT_ASSERT(fabs((pElement->getMultiplicity() - 3.0) / 3.0) < 1e-3);
82  CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
83  CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
84  pElement = pChemEq->getProducts()[0];
85  CPPUNIT_ASSERT(pElement != NULL);
86  CPPUNIT_ASSERT(fabs((pElement->getMultiplicity() - 1.3) / 1.3) < 1e-3);
87  CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
88  CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
89  //CPPUNIT_ASSERT(CCopasiMessage::size() == 5);
91  CPPUNIT_ASSERT(message.getType() == CCopasiMessage::WARNING);
92  std::string s = message.getText();
93  CPPUNIT_ASSERT(!s.empty());
94  CPPUNIT_ASSERT(s.find(std::string("One or more stoichiometric expressions were evaluated and converted to constants values.")) != std::string::npos);
95  // the other four messages are libSBML unit warnings I don't care about right
96  // now.
97 }
size_t getCompartmentNumber() const
Definition: CChemEq.cpp:110
virtual size_t size() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000045.h:32
Definition: CMetab.h:178
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
const CCopasiVector< CChemEqElement > & getModifiers() const
Definition: CChemEq.cpp:66
static CCopasiMessage getLastMessage()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
Definition: CModel.h:50
static const char * MODEL_STRING
Definition: test000045.h:31

Member Data Documentation

const char * test000045::MODEL_STRING
staticprotected

Definition at line 31 of file test000045.h.

Referenced by test_stoichiometricExpression().

CCopasiDataModel * test000045::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 32 of file test000045.h.

Referenced by setUp(), and test_stoichiometricExpression().


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