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

#include <test000047.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_delay ()
 

Static Protected Attributes

static const char * MODEL_STRING
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_delay)
 
 CPPUNIT_TEST_SUITE (test000047)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000047.h.

Member Function Documentation

test000047::CPPUNIT_TEST ( test_delay  )
private
test000047::CPPUNIT_TEST_SUITE ( test000047  )
private
test000047::CPPUNIT_TEST_SUITE_END ( )
private
void test000047::setUp ( )

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

Definition at line 36 of file test000047.cpp.

References CCopasiRootContainer::destroy().

void test000047::test_delay ( )

Definition at line 41 of file test000047.cpp.

References CModelEntity::ASSIGNMENT, CEvaluationNodeNumber::DOUBLE, CModelEntity::FIXED, CCopasiNode< _Data >::getChild(), CCopasiMessage::getLastMessage(), CCopasiDataModel::getModel(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CCopasiNode< _Data >::getSibling(), CCopasiDataModel::importSBMLFromString(), CCopasiObject::isReference(), CModel::ml, CModel::mMol, MODEL_STRING, CCopasiDataModel::ObjectFromName(), pCOPASIDATAMODEL, CModel::s, CEvaluationNode::subType(), 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  const CMetab* pB = pModel->getMetabolites()[1];
56  CPPUNIT_ASSERT(pB != NULL);
57  CPPUNIT_ASSERT(pB->getStatus() == CModelEntity::FIXED);
58  CMetab* pA = pModel->getMetabolites()[0];
59  CPPUNIT_ASSERT(pA != NULL);
60  CPPUNIT_ASSERT(pA->getStatus() == CModelEntity::ASSIGNMENT);
61  const CExpression* pExpr = pA->getExpressionPtr();
62  CPPUNIT_ASSERT(pExpr != NULL);
63  const CEvaluationNode* pNode = pExpr->getRoot();
64  CPPUNIT_ASSERT(pNode != NULL);
65  const CEvaluationNodeDelay* pDelayNode = dynamic_cast<const CEvaluationNodeDelay*>(pNode);
66  CPPUNIT_ASSERT(pDelayNode != NULL);
67  const CEvaluationNodeObject* pObjectNode = dynamic_cast<const CEvaluationNodeObject*>(pDelayNode->getChild());
68  CPPUNIT_ASSERT(pObjectNode != NULL);
69  CCopasiObjectName objectCN = pObjectNode->getObjectCN();
70  CPPUNIT_ASSERT(!objectCN.empty());
71  std::vector<CCopasiContainer*> listOfContainers;
72  listOfContainers.push_back(pModel);
73  const CCopasiObject* pObject = pCOPASIDATAMODEL->ObjectFromName(listOfContainers, objectCN);
74  CPPUNIT_ASSERT(pObject != NULL);
75  CPPUNIT_ASSERT(pObject->isReference() == true);
76  CPPUNIT_ASSERT(pObject->getObjectName() == std::string("Concentration"));
77  CPPUNIT_ASSERT(pObject->getObjectParent() == pB);
78  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pObjectNode->getSibling());
79  CPPUNIT_ASSERT(pNumberNode != NULL);
81  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.5) / 0.5) < 1e-3);
82 
83  CPPUNIT_ASSERT(pNumberNode->getSibling() == NULL);
84 
85  CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
86  const CModelValue* pModelValue = pModel->getModelValues()[0];
87  CPPUNIT_ASSERT(pModelValue != NULL);
88  CPPUNIT_ASSERT(pModelValue->getStatus() == CModelEntity::FIXED);
89  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
90  //CPPUNIT_ASSERT(CCopasiMessage::size() == 2);
92  CPPUNIT_ASSERT(message.getType() == CCopasiMessage::WARNING);
93  std::string s = message.getText();
94  CPPUNIT_ASSERT(!s.empty());
95  CPPUNIT_ASSERT(s.find(std::string("COPASI does not support time delays. Calculations on this model will most likely lead to unusable results.")) != std::string::npos);
96  // right now, we don't care about the last message since it is a units
97  // warning from libSBML
98 }
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
const std::string & getObjectName() const
const CRegisteredObjectName & getObjectCN() const
Definition: CMetab.h:178
bool isReference() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000047.h:32
static const char * MODEL_STRING
Definition: test000047.h:31
static Type subType(const Type &type)
static CCopasiMessage getLastMessage()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
Definition: CModel.h:50
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
CCopasiContainer * getObjectParent() const

Member Data Documentation

const char * test000047::MODEL_STRING
staticprotected

Definition at line 31 of file test000047.h.

Referenced by test_delay().

CCopasiDataModel * test000047::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 32 of file test000047.h.

Referenced by setUp(), and test_delay().


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