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

#include <test000065.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_import_reaction_with_unsuitable_kinetic_1 ()
 
void test_import_reaction_with_unsuitable_kinetic_2 ()
 

Static Protected Attributes

static const char * MODEL_STRING1
 
static const char * MODEL_STRING2
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_import_reaction_with_unsuitable_kinetic_1)
 
 CPPUNIT_TEST (test_import_reaction_with_unsuitable_kinetic_2)
 
 CPPUNIT_TEST_SUITE (test000065)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 26 of file test000065.h.

Member Function Documentation

test000065::CPPUNIT_TEST ( test_import_reaction_with_unsuitable_kinetic_1  )
private
test000065::CPPUNIT_TEST ( test_import_reaction_with_unsuitable_kinetic_2  )
private
test000065::CPPUNIT_TEST_SUITE ( test000065  )
private
test000065::CPPUNIT_TEST_SUITE_END ( )
private
void test000065::setUp ( )

Definition at line 44 of file test000065.cpp.

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

45 {
46  // Create the root container.
47  CCopasiRootContainer::init(0, NULL, false);
48  // Create the global data model.
50 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000065.h:36
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000065::tearDown ( )

Definition at line 52 of file test000065.cpp.

References CCopasiRootContainer::destroy().

void test000065::test_import_reaction_with_unsuitable_kinetic_1 ( )

Definition at line 57 of file test000065.cpp.

References CEvaluationNodeOperator::DIVIDE, CModelEntity::FIXED, CCopasiNode< _Data >::getChild(), CCopasiNode< _Data >::getData(), CCopasiDataModel::getModel(), CEvaluationNode::getType(), CCopasiDataModel::importSBMLFromString(), CModel::ml, CModel::mMol, MODEL_STRING1, CEvaluationNodeOperator::MULTIPLY, CEvaluationNode::OPERATOR, pCOPASIDATAMODEL, CEvaluationNodeOperator::PLUS, CModel::s, CEvaluationNode::subType(), TriUnspecified, CEvaluationNode::type(), CEvaluationTree::UserDefined, and CEvaluationNode::VARIABLE.

58 {
59  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
60  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING1));
61  CModel* pModel = pDataModel->getModel();
62  CPPUNIT_ASSERT(pModel != NULL);
63  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CModel::mMol);
64  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CModel::ml);
65  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CModel::s);
66  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
67  const CCompartment* pCompartment = pModel->getCompartments()[0];
68  CPPUNIT_ASSERT(pCompartment != NULL);
69  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::FIXED);
70  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 4);
71  CPPUNIT_ASSERT(pModel->getReactions().size() == 1);
72  const CReaction* pReaction = pModel->getReactions()[0];
73  CPPUNIT_ASSERT(pReaction != NULL);
74  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 2);
75  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 2);
76  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
77  CPPUNIT_ASSERT(pReaction->isReversible() == false);
78  const CFunction* pFunction = pReaction->getFunction();
79  CPPUNIT_ASSERT(pFunction != NULL);
80  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
81  CPPUNIT_ASSERT(pFunction->isReversible() == TriUnspecified);
82  // just to be sure also check the tree
83  const CEvaluationNode* pRoot = pFunction->getRoot();
84  CPPUNIT_ASSERT(pRoot != NULL);
85  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
87  const CEvaluationNode* pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
88  CPPUNIT_ASSERT(pChild != NULL);
89  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::OPERATOR);
91  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
92  CPPUNIT_ASSERT(pChild != NULL);
93  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
94  const CEvaluationNodeVariable* pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
95  CPPUNIT_ASSERT(pVariableNode != NULL);
96  CPPUNIT_ASSERT(pVariableNode->getData() == "Vmax");
97  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
98  CPPUNIT_ASSERT(pChild != NULL);
99  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
100  pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
101  CPPUNIT_ASSERT(pVariableNode != NULL);
102  // can't check the variable name here since I don't know what name has been
103  // created for it
104  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild()->getSibling());
105  CPPUNIT_ASSERT(pChild != NULL);
106  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::OPERATOR);
108  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
109  CPPUNIT_ASSERT(pChild != NULL);
110  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
111  pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
112  CPPUNIT_ASSERT(pVariableNode != NULL);
113  CPPUNIT_ASSERT(pVariableNode->getData() == "Km");
114  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
115  CPPUNIT_ASSERT(pChild != NULL);
116  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
117  pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
118  CPPUNIT_ASSERT(pVariableNode != NULL);
119  // can't check the variable name here since I don't know what name has been
120  // created for it
121 }
const Type & getType() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000065.h:36
static Type type(const Type &type)
static const char * MODEL_STRING1
Definition: test000065.h:34
static Type subType(const Type &type)
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
virtual const Data & getData() const
Definition: CCopasiNode.h:118
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
void test000065::test_import_reaction_with_unsuitable_kinetic_2 ( )

Definition at line 123 of file test000065.cpp.

References CEvaluationNodeOperator::DIVIDE, CModelEntity::FIXED, CCopasiNode< _Data >::getChild(), CCopasiNode< _Data >::getData(), CCopasiDataModel::getModel(), CEvaluationNode::getType(), CCopasiDataModel::importSBMLFromString(), CModel::ml, CModel::mMol, MODEL_STRING2, CEvaluationNodeOperator::MULTIPLY, CEvaluationNode::OPERATOR, pCOPASIDATAMODEL, CEvaluationNodeOperator::PLUS, CModel::s, CEvaluationNode::subType(), TriUnspecified, CEvaluationNode::type(), CEvaluationTree::UserDefined, and CEvaluationNode::VARIABLE.

124 {
125  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
126  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING2));
127  CModel* pModel = pDataModel->getModel();
128  CPPUNIT_ASSERT(pModel != NULL);
129  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CModel::mMol);
130  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CModel::ml);
131  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CModel::s);
132  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
133  const CCompartment* pCompartment = pModel->getCompartments()[0];
134  CPPUNIT_ASSERT(pCompartment != NULL);
135  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::FIXED);
136  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 4);
137  CPPUNIT_ASSERT(pModel->getReactions().size() == 1);
138  const CReaction* pReaction = pModel->getReactions()[0];
139  CPPUNIT_ASSERT(pReaction != NULL);
140  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 2);
141  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 2);
142  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
143  CPPUNIT_ASSERT(pReaction->isReversible() == false);
144  const CFunction* pFunction = pReaction->getFunction();
145  CPPUNIT_ASSERT(pFunction != NULL);
146  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
147  CPPUNIT_ASSERT(pFunction->isReversible() == TriUnspecified);
148  // just to be sure also check the tree
149  const CEvaluationNode* pRoot = pFunction->getRoot();
150  CPPUNIT_ASSERT(pRoot != NULL);
151  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
153  const CEvaluationNode* pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
154  CPPUNIT_ASSERT(pChild != NULL);
155  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::OPERATOR);
157  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
158  CPPUNIT_ASSERT(pChild != NULL);
159  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
160  const CEvaluationNodeVariable* pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
161  CPPUNIT_ASSERT(pVariableNode != NULL);
162  CPPUNIT_ASSERT(pVariableNode->getData() == "Vmax");
163  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
164  CPPUNIT_ASSERT(pChild != NULL);
165  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
166  pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
167  CPPUNIT_ASSERT(pVariableNode != NULL);
168  // can't check the variable name here since I don't know what name has been
169  // created for it
170  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild()->getSibling());
171  CPPUNIT_ASSERT(pChild != NULL);
172  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::OPERATOR);
174  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
175  CPPUNIT_ASSERT(pChild != NULL);
176  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
177  pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
178  CPPUNIT_ASSERT(pVariableNode != NULL);
179  CPPUNIT_ASSERT(pVariableNode->getData() == "Km");
180  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
181  CPPUNIT_ASSERT(pChild != NULL);
182  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
183  pVariableNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
184  CPPUNIT_ASSERT(pVariableNode != NULL);
185  // can't check the variable name here since I don't know what name has been
186  // created for it
187 }
const Type & getType() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000065.h:36
static Type type(const Type &type)
static Type subType(const Type &type)
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_STRING2
Definition: test000065.h:35
virtual const Data & getData() const
Definition: CCopasiNode.h:118
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210

Member Data Documentation

const char * test000065::MODEL_STRING1
staticprotected

Definition at line 34 of file test000065.h.

Referenced by test_import_reaction_with_unsuitable_kinetic_1().

const char * test000065::MODEL_STRING2
staticprotected

Definition at line 35 of file test000065.h.

Referenced by test_import_reaction_with_unsuitable_kinetic_2().

CCopasiDataModel * test000065::pCOPASIDATAMODEL = NULL
staticprotected

These tests are supposed to make sure that assignments on a species with the hasOnlySubstanceUnits flag set are exported correctly. It tests rules and event assignments with and without the flag set.

Definition at line 36 of file test000065.h.

Referenced by setUp(), test_import_reaction_with_unsuitable_kinetic_1(), and test_import_reaction_with_unsuitable_kinetic_2().


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