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

#include <test000052.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug988 ()
 

Static Protected Attributes

static const char * MODEL_STRING
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_bug988)
 
 CPPUNIT_TEST_SUITE (test000052)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000052.h.

Member Function Documentation

test000052::CPPUNIT_TEST ( test_bug988  )
private
test000052::CPPUNIT_TEST_SUITE ( test000052  )
private
test000052::CPPUNIT_TEST_SUITE_END ( )
private
void test000052::setUp ( )

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

Definition at line 44 of file test000052.cpp.

References CCopasiRootContainer::destroy().

void test000052::test_bug988 ( )

Definition at line 49 of file test000052.cpp.

References CModelEntity::ASSIGNMENT, CEvaluationNodeNumber::DOUBLE, CModelEntity::FIXED, CCopasiNode< _Data >::getChild(), CCopasiDataModel::getModel(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CCopasiNode< _Data >::getSibling(), CEvaluationNode::getType(), CCopasiDataModel::importSBMLFromString(), CCopasiObject::isReference(), CEvaluationNodeLogical::LT, CModel::ml, CModel::mMol, MODEL_STRING, CCopasiDataModel::ObjectFromName(), pCOPASIDATAMODEL, CModel::s, and CEvaluationNode::subType().

50 {
51  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
52  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING));
53  CModel* pModel = pDataModel->getModel();
54  CPPUNIT_ASSERT(pModel != NULL);
55  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CModel::mMol);
56  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CModel::ml);
57  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CModel::s);
58  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
59  const CCompartment* pCompartment = pModel->getCompartments()[0];
60  CPPUNIT_ASSERT(pCompartment != NULL);
61  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::FIXED);
62  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
63  CMetab* pA = pModel->getMetabolites()[0];
64  CPPUNIT_ASSERT(pA != NULL);
65  CPPUNIT_ASSERT(pA->getStatus() == CModelEntity::ASSIGNMENT);
66  const CExpression* pExpr = pA->getExpressionPtr();
67  // check the expression
68  const CEvaluationNode* pNode = pExpr->getRoot();
69  CPPUNIT_ASSERT(pNode != NULL);
70  const CEvaluationNodeChoice* pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pNode);
71  CPPUNIT_ASSERT(pChoiceNode != NULL);
72  pNode = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
73  CPPUNIT_ASSERT(pNode != NULL);
74  const CEvaluationNodeLogical* pLogicalNode = dynamic_cast<const CEvaluationNodeLogical*>(pNode);
75  CPPUNIT_ASSERT(pLogicalNode != NULL);
77  const CEvaluationNodeObject* pObjectNode = dynamic_cast<const CEvaluationNodeObject*>(pLogicalNode->getChild());
78  CPPUNIT_ASSERT(pObjectNode != NULL);
79  CCopasiObjectName objectCN = pObjectNode->getObjectCN();
80  CPPUNIT_ASSERT(!objectCN.empty());
81  std::vector<CCopasiContainer*> listOfContainers;
82  listOfContainers.push_back(pModel);
83  const CCopasiObject* pObject = pCOPASIDATAMODEL->ObjectFromName(listOfContainers, objectCN);
84  CPPUNIT_ASSERT(pObject != NULL);
85  CPPUNIT_ASSERT(pObject->isReference() == true);
86  CPPUNIT_ASSERT(pObject->getObjectName() == std::string("Time"));
87  CPPUNIT_ASSERT(pObject->getObjectParent() == pModel);
88  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pObjectNode->getSibling());
89  CPPUNIT_ASSERT(pNumberNode != NULL);
91  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 5.0) / 5.0) < 1e-3);
92  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pLogicalNode->getSibling());
93  CPPUNIT_ASSERT(pNumberNode != NULL);
95  CPPUNIT_ASSERT(pNumberNode->getValue() < 1e-3);
96  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pNumberNode->getSibling());
97  CPPUNIT_ASSERT(pNumberNode != NULL);
99  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 10.0) / 10.0) < 1e-3);
100 
101  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
102  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
103 }
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000052.h:32
const std::string & getObjectName() const
const Type & getType() const
Definition: CMetab.h:178
bool isReference() const
static Type subType(const Type &type)
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
static const char * MODEL_STRING
Definition: test000052.h:31

Member Data Documentation

const char * test000052::MODEL_STRING
staticprotected

Definition at line 31 of file test000052.h.

Referenced by test_bug988().

CCopasiDataModel * test000052::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 32 of file test000052.h.

Referenced by setUp(), and test_bug988().


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