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

#include <test000078.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_l2v4_import_unordered_functions ()
 

Static Protected Attributes

static const char * MODEL_STRING1
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_l2v4_import_unordered_functions)
 
 CPPUNIT_TEST_SUITE (test000078)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 26 of file test000078.h.

Member Function Documentation

test000078::CPPUNIT_TEST ( test_l2v4_import_unordered_functions  )
private
test000078::CPPUNIT_TEST_SUITE ( test000078  )
private
test000078::CPPUNIT_TEST_SUITE_END ( )
private
void test000078::setUp ( )

Definition at line 38 of file test000078.cpp.

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

39 {
40  // Create the root container.
41  CCopasiRootContainer::init(0, NULL, false);
42  // Create the global data model.
44 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000078.h:34
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000078::tearDown ( )

Definition at line 46 of file test000078.cpp.

References CCopasiRootContainer::destroy().

void test000078::test_l2v4_import_unordered_functions ( )

Definition at line 51 of file test000078.cpp.

References CEvaluationNodeVariable::ANY, CModelEntity::ASSIGNMENT, CEvaluationNode::CALL, CEvaluationNodeOperator::DIVIDE, CEvaluationNodeNumber::DOUBLE, CModelEntity::FIXED, CEvaluationNodeCall::FUNCTION, CModel::getCompartments(), CEvaluationNodeCall::getData(), CCopasiNode< _Data >::getData(), CCopasiRootContainer::getFunctionList(), CModel::getMetabolites(), CCopasiDataModel::getModel(), CModel::getModelValues(), CModel::getQuantityUnitEnum(), CModel::getReactions(), CEvaluationTree::getRoot(), CModel::getTimeUnitEnum(), CEvaluationNode::getType(), CEvaluationNode::getValue(), CFunction::getVariables(), CModel::getVolumeUnitEnum(), CCopasiDataModel::importSBMLFromString(), CModel::l, CEvaluationNodeOperator::MINUS, MODEL_STRING1, CModel::Mol, CEvaluationNodeOperator::MULTIPLY, CEvaluationNode::NUMBER, CModelEntity::ODE, CEvaluationNode::OPERATOR, pCOPASIDATAMODEL, CEvaluationNodeOperator::PLUS, CModelEntity::REACTIONS, CModel::s, CFunctionParameters::size(), CCopasiVector< T >::size(), CEvaluationNode::subType(), CEvaluationNode::type(), CEvaluationTree::UserDefined, and CEvaluationNode::VARIABLE.

52 {
53  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
54 
55  try
56  {
57  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING1));
58  }
59  catch (...)
60  {
61  // there should not be any exceptions
62  CPPUNIT_ASSERT(false);
63  }
64 
65  CModel* pModel = pDataModel->getModel();
66  CPPUNIT_ASSERT(pModel != NULL);
67  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CModel::Mol);
68  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CModel::l);
69  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CModel::s);
70  // check if the function definitions were imported correctly
72  const CEvaluationTree* pFun = pFunDB->findFunction("function_1");
73  CPPUNIT_ASSERT(pFun != NULL);
74  const CKinFunction* pKinFun = dynamic_cast<const CKinFunction*>(pFun);
75  CPPUNIT_ASSERT(pKinFun != NULL);
76  // 1 parameter called k
77  // expression is 3.0 * k
78  const CFunctionParameters* pFunParams = &pKinFun->getVariables();
79  CPPUNIT_ASSERT(pFunParams != NULL);
80  CPPUNIT_ASSERT(pFunParams->size() == 1);
81  const CFunctionParameter* pFunParam = (*pFunParams)[0];
82  CPPUNIT_ASSERT(pFunParam != NULL);
83  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("k"));
84  const CEvaluationNode* pRoot = pKinFun->getRoot();
85  CPPUNIT_ASSERT(pRoot != NULL);
86  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
88  const CEvaluationNode* pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
89  CPPUNIT_ASSERT(pChild != NULL);
90  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::NUMBER);
92  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild);
93  CPPUNIT_ASSERT(pNumberNode != NULL);
94  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
95  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
96  CPPUNIT_ASSERT(pChild != NULL);
97  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
99  const CEvaluationNodeVariable* pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
100  CPPUNIT_ASSERT(pVarNode != NULL);
101  CPPUNIT_ASSERT(pVarNode->getData() == std::string("k"));
102  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
103  CPPUNIT_ASSERT(pChild == NULL);
104 
105  pFun = pFunDB->findFunction("function_2");
106  CPPUNIT_ASSERT(pFun != NULL);
107  pKinFun = dynamic_cast<const CKinFunction*>(pFun);
108  CPPUNIT_ASSERT(pKinFun != NULL);
109  // 2 parameters called A and B
110  // expression is A + B
111  pFunParams = &pKinFun->getVariables();
112  CPPUNIT_ASSERT(pFunParams != NULL);
113  CPPUNIT_ASSERT(pFunParams->size() == 2);
114  pFunParam = (*pFunParams)[0];
115  CPPUNIT_ASSERT(pFunParam != NULL);
116  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("A"));
117  pFunParam = (*pFunParams)[1];
118  CPPUNIT_ASSERT(pFunParam != NULL);
119  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("B"));
120  pRoot = pKinFun->getRoot();
121  CPPUNIT_ASSERT(pRoot != NULL);
122  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
124  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
125  CPPUNIT_ASSERT(pChild != NULL);
126  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
128  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
129  CPPUNIT_ASSERT(pVarNode != NULL);
130  CPPUNIT_ASSERT(pVarNode->getData() == std::string("B"));
131  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
132  CPPUNIT_ASSERT(pChild != NULL);
133  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
135  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
136  CPPUNIT_ASSERT(pVarNode != NULL);
137  CPPUNIT_ASSERT(pVarNode->getData() == std::string("A"));
138  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
139  CPPUNIT_ASSERT(pChild == NULL);
140 
141  pFun = pFunDB->findFunction("function_3");
142  CPPUNIT_ASSERT(pFun != NULL);
143  pKinFun = dynamic_cast<const CKinFunction*>(pFun);
144  CPPUNIT_ASSERT(pKinFun != NULL);
145  // 2 parameters called k and C
146  // expression is C - (k * 1.3)
147  pFunParams = &pKinFun->getVariables();
148  CPPUNIT_ASSERT(pFunParams != NULL);
149  CPPUNIT_ASSERT(pFunParams->size() == 2);
150  pFunParam = (*pFunParams)[0];
151  CPPUNIT_ASSERT(pFunParam != NULL);
152  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("k"));
153  pFunParam = (*pFunParams)[1];
154  CPPUNIT_ASSERT(pFunParam != NULL);
155  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("C"));
156  pRoot = pKinFun->getRoot();
157  CPPUNIT_ASSERT(pRoot != NULL);
158  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
160  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
161  CPPUNIT_ASSERT(pChild != NULL);
162  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
164  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
165  CPPUNIT_ASSERT(pVarNode != NULL);
166  CPPUNIT_ASSERT(pVarNode->getData() == std::string("C"));
167  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
168  CPPUNIT_ASSERT(pChild != NULL);
169  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::OPERATOR);
171  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
172  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
173  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
175  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
176  CPPUNIT_ASSERT(pVarNode != NULL);
177  CPPUNIT_ASSERT(pVarNode->getData() == std::string("k"));
178  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
179  CPPUNIT_ASSERT(pChild != NULL);
180  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::NUMBER);
182  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild);
183  CPPUNIT_ASSERT(pNumberNode != NULL);
184  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.3) / 1.3) < 1e-6);
185  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
186 
187  pFun = pFunDB->findFunction("function_4");
188  CPPUNIT_ASSERT(pFun != NULL);
189  pKinFun = dynamic_cast<const CKinFunction*>(pFun);
190  CPPUNIT_ASSERT(pKinFun != NULL);
191  // 2 parameters called x and y
192  // expression is function_2(x,y)/2.0
193  pFunParams = &pKinFun->getVariables();
194  CPPUNIT_ASSERT(pFunParams != NULL);
195  CPPUNIT_ASSERT(pFunParams->size() == 2);
196  pFunParam = (*pFunParams)[0];
197  CPPUNIT_ASSERT(pFunParam != NULL);
198  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("x"));
199  pFunParam = (*pFunParams)[1];
200  CPPUNIT_ASSERT(pFunParam != NULL);
201  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("y"));
202  pRoot = pKinFun->getRoot();
203  CPPUNIT_ASSERT(pRoot != NULL);
204  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
206  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
207  CPPUNIT_ASSERT(pChild != NULL);
208  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::CALL);
210  const CEvaluationNodeCall* pCallNode = dynamic_cast<const CEvaluationNodeCall*>(pChild);
211  CPPUNIT_ASSERT(pCallNode != NULL);
212  CPPUNIT_ASSERT(pCallNode->getData() == std::string("function_2"));
213  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
214  CPPUNIT_ASSERT(pChild != NULL);
215  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
217  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
218  CPPUNIT_ASSERT(pVarNode != NULL);
219  CPPUNIT_ASSERT(pVarNode->getData() == std::string("x"));
220  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
221  CPPUNIT_ASSERT(pChild != NULL);
222  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
224  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
225  CPPUNIT_ASSERT(pVarNode != NULL);
226  CPPUNIT_ASSERT(pVarNode->getData() == std::string("y"));
227  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
228  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild()->getSibling());
229  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::NUMBER);
231  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild);
232  CPPUNIT_ASSERT(pNumberNode != NULL);
233  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 2.0) / 2.0) < 1e-6);
234  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
235  CPPUNIT_ASSERT(pChild == NULL);
236 
237  pFun = pFunDB->findFunction("function_5");
238  CPPUNIT_ASSERT(pFun != NULL);
239  pKinFun = dynamic_cast<const CKinFunction*>(pFun);
240  CPPUNIT_ASSERT(pKinFun != NULL);
241  // 3 parameters called a, b and c
242  // expression is function_3(c,a) + (function_1(b) - 5.23)
243  pFunParams = &pKinFun->getVariables();
244  CPPUNIT_ASSERT(pFunParams != NULL);
245  CPPUNIT_ASSERT(pFunParams->size() == 3);
246  pFunParam = (*pFunParams)[0];
247  CPPUNIT_ASSERT(pFunParam != NULL);
248  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("a"));
249  pFunParam = (*pFunParams)[1];
250  CPPUNIT_ASSERT(pFunParam != NULL);
251  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("b"));
252  pFunParam = (*pFunParams)[2];
253  CPPUNIT_ASSERT(pFunParam != NULL);
254  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("c"));
255  pRoot = pKinFun->getRoot();
256  CPPUNIT_ASSERT(pRoot != NULL);
257  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::OPERATOR);
259  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
260  CPPUNIT_ASSERT(pChild != NULL);
261  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::CALL);
263  pCallNode = dynamic_cast<const CEvaluationNodeCall*>(pChild);
264  CPPUNIT_ASSERT(pCallNode != NULL);
265  CPPUNIT_ASSERT(pCallNode->getData() == std::string("function_3"));
266  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
267  CPPUNIT_ASSERT(pChild != NULL);
268  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
270  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
271  CPPUNIT_ASSERT(pVarNode != NULL);
272  CPPUNIT_ASSERT(pVarNode->getData() == std::string("c"));
273  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
274  CPPUNIT_ASSERT(pChild != NULL);
275  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
277  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
278  CPPUNIT_ASSERT(pVarNode != NULL);
279  CPPUNIT_ASSERT(pVarNode->getData() == std::string("a"));
280  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
281  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild()->getSibling());
282  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::OPERATOR);
284  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
285  CPPUNIT_ASSERT(pChild != NULL);
286  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::CALL);
288  pCallNode = dynamic_cast<const CEvaluationNodeCall*>(pChild);
289  CPPUNIT_ASSERT(pCallNode != NULL);
290  CPPUNIT_ASSERT(pCallNode->getData() == std::string("function_1"));
291  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getChild());
292  CPPUNIT_ASSERT(pChild != NULL);
293  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
295  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
296  CPPUNIT_ASSERT(pVarNode != NULL);
297  CPPUNIT_ASSERT(pVarNode->getData() == std::string("b"));
298  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
299  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild()->getSibling()->getChild()->getSibling());
300  CPPUNIT_ASSERT(pChild != NULL);
301  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::NUMBER);
303  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild);
304  CPPUNIT_ASSERT(pNumberNode != NULL);
305  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 5.23) / 5.23) < 1e-6);
306  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
307 
308  pFun = pFunDB->findFunction("function_6");
309  CPPUNIT_ASSERT(pFun != NULL);
310  pKinFun = dynamic_cast<const CKinFunction*>(pFun);
311  CPPUNIT_ASSERT(pKinFun != NULL);
312  // 3 parameters called k1, k2 and k3
313  // expression is function_5(k1,k2,k3)
314  pFunParams = &pKinFun->getVariables();
315  CPPUNIT_ASSERT(pFunParams != NULL);
316  CPPUNIT_ASSERT(pFunParams->size() == 3);
317  pFunParam = (*pFunParams)[0];
318  CPPUNIT_ASSERT(pFunParam != NULL);
319  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("k1"));
320  pFunParam = (*pFunParams)[1];
321  CPPUNIT_ASSERT(pFunParam != NULL);
322  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("k2"));
323  pFunParam = (*pFunParams)[2];
324  CPPUNIT_ASSERT(pFunParam != NULL);
325  CPPUNIT_ASSERT(pFunParam->getObjectName() == std::string("k3"));
326  pRoot = pKinFun->getRoot();
327  CPPUNIT_ASSERT(pRoot != NULL);
328  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::CALL);
330  pCallNode = dynamic_cast<const CEvaluationNodeCall*>(pRoot);
331  CPPUNIT_ASSERT(pCallNode != NULL);
332  CPPUNIT_ASSERT(pCallNode->getData() == std::string("function_5"));
333  pChild = dynamic_cast<const CEvaluationNode*>(pRoot->getChild());
334  CPPUNIT_ASSERT(pChild != NULL);
335  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
337  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
338  CPPUNIT_ASSERT(pVarNode != NULL);
339  CPPUNIT_ASSERT(pVarNode->getData() == std::string("k1"));
340  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
341  CPPUNIT_ASSERT(pChild != NULL);
342  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
344  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
345  CPPUNIT_ASSERT(pVarNode != NULL);
346  CPPUNIT_ASSERT(pVarNode->getData() == std::string("k2"));
347  pChild = dynamic_cast<const CEvaluationNode*>(pChild->getSibling());
348  CPPUNIT_ASSERT(pChild != NULL);
349  CPPUNIT_ASSERT(CEvaluationNode::type(pChild->getType()) == CEvaluationNode::VARIABLE);
351  pVarNode = dynamic_cast<const CEvaluationNodeVariable*>(pChild);
352  CPPUNIT_ASSERT(pVarNode != NULL);
353  CPPUNIT_ASSERT(pVarNode->getData() == std::string("k3"));
354  CPPUNIT_ASSERT(pChild->getSibling() == NULL);
355 
356  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
357  const CCompartment* pCompartment = pModel->getCompartments()[0];
358  CPPUNIT_ASSERT(pCompartment != NULL);
359  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::FIXED);
360  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 6);
361  // check metabolites
362  const CMetab* pMetab = pModel->getMetabolites()[0];
363  CPPUNIT_ASSERT(pMetab != NULL);
364  CPPUNIT_ASSERT(pMetab->getObjectName() == "A");
365  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::REACTIONS);
366  pMetab = pModel->getMetabolites()[1];
367  CPPUNIT_ASSERT(pMetab != NULL);
368  CPPUNIT_ASSERT(pMetab->getObjectName() == "B");
369  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::REACTIONS);
370 
371  pMetab = pModel->getMetabolites()[2];
372  CPPUNIT_ASSERT(pMetab != NULL);
373  CPPUNIT_ASSERT(pMetab->getObjectName() == "C");
374  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ASSIGNMENT);
375  // check assignment
376  const CEvaluationTree* pTree = pMetab->getExpressionPtr();
377  CPPUNIT_ASSERT(pTree != NULL);
378  pRoot = pTree->getRoot();
379  CPPUNIT_ASSERT(pRoot != NULL);
380  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot) != NULL);
381  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot)->getData() == "function_5");
382 
383  pMetab = pModel->getMetabolites()[3];
384  CPPUNIT_ASSERT(pMetab != NULL);
385  CPPUNIT_ASSERT(pMetab->getObjectName() == "D");
386  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ODE);
387  // check ode
388  pTree = pMetab->getExpressionPtr();
389  CPPUNIT_ASSERT(pTree != NULL);
390  pRoot = pTree->getRoot();
391  CPPUNIT_ASSERT(pRoot != NULL);
392  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot) != NULL);
393  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot)->getData() == "function_2");
394 
395  pMetab = pModel->getMetabolites()[4];
396  CPPUNIT_ASSERT(pMetab != NULL);
397  CPPUNIT_ASSERT(pMetab->getObjectName() == "E");
398  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ODE);
399  // check ode
400  pTree = pMetab->getExpressionPtr();
401  CPPUNIT_ASSERT(pTree != NULL);
402  pRoot = pTree->getRoot();
403  CPPUNIT_ASSERT(pRoot != NULL);
404  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot) != NULL);
405  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot)->getData() == "function_4");
406 
407  pMetab = pModel->getMetabolites()[5];
408  CPPUNIT_ASSERT(pMetab != NULL);
409  CPPUNIT_ASSERT(pMetab->getObjectName() == "F");
410  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ODE);
411  // check ode
412  pTree = pMetab->getExpressionPtr();
413  CPPUNIT_ASSERT(pTree != NULL);
414  pRoot = pTree->getRoot();
415  CPPUNIT_ASSERT(pRoot != NULL);
416  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot) != NULL);
417  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot)->getData() == "function_6");
418 
419  // check model values
420  CPPUNIT_ASSERT(pModel->getModelValues().size() == 3);
421  const CModelValue* pModelValue = pModel->getModelValues()[0];
422  CPPUNIT_ASSERT(pModelValue != NULL);
423  CPPUNIT_ASSERT(pModelValue->getObjectName() == "K1");
424  CPPUNIT_ASSERT(pModelValue->getStatus() == CModelEntity::ASSIGNMENT);
425  // check assignment
426  pTree = pModelValue->getExpressionPtr();
427  CPPUNIT_ASSERT(pTree != NULL);
428  pRoot = pTree->getRoot();
429  CPPUNIT_ASSERT(pRoot != NULL);
430  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot) != NULL);
431  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot)->getData() == "function_1");
432 
433  pModelValue = pModel->getModelValues()[1];
434  CPPUNIT_ASSERT(pModelValue != NULL);
435  CPPUNIT_ASSERT(pModelValue->getObjectName() == "K2");
436  CPPUNIT_ASSERT(pModelValue->getStatus() == CModelEntity::FIXED);
437 
438  pModelValue = pModel->getModelValues()[2];
439  CPPUNIT_ASSERT(pModelValue != NULL);
440  CPPUNIT_ASSERT(pModelValue->getObjectName() == "K3");
441  // check assignment
442  pTree = pModelValue->getExpressionPtr();
443  CPPUNIT_ASSERT(pTree != NULL);
444  pRoot = pTree->getRoot();
445  CPPUNIT_ASSERT(pRoot != NULL);
446  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot) != NULL);
447  CPPUNIT_ASSERT(dynamic_cast<const CEvaluationNodeCall*>(pRoot)->getData() == "function_3");
448 
449  CPPUNIT_ASSERT(pModel->getReactions().size() == 6);
450  // check reactions
451  const CReaction* pReaction = pModel->getReactions()[0];
452  CPPUNIT_ASSERT(pReaction != NULL);
453  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 1);
454  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 1);
455  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
456  CPPUNIT_ASSERT(pReaction->isReversible() == true);
457  // check the kinetic law
458  CPPUNIT_ASSERT(pReaction->getParameters().size() == 1);
459  const CFunction* pFunction = pReaction->getFunction();
460  CPPUNIT_ASSERT(pFunction != NULL);
461  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
462  CPPUNIT_ASSERT(pFunction->getObjectName() == "Function for reaction1");
463  pRoot = pFunction->getRoot();
464  CPPUNIT_ASSERT(pRoot != NULL);
465 
466  pReaction = pModel->getReactions()[1];
467  CPPUNIT_ASSERT(pReaction != NULL);
468  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 1);
469  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 1);
470  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
471  CPPUNIT_ASSERT(pReaction->isReversible() == true);
472  // check the kinetic law
473  CPPUNIT_ASSERT(pReaction->getParameters().size() == 2);
474  pFunction = pReaction->getFunction();
475  CPPUNIT_ASSERT(pFunction != NULL);
476  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
477  CPPUNIT_ASSERT(pFunction->getObjectName() == "Function for reaction2");
478  pRoot = pFunction->getRoot();
479  CPPUNIT_ASSERT(pRoot != NULL);
480 
481  pReaction = pModel->getReactions()[2];
482  CPPUNIT_ASSERT(pReaction != NULL);
483  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 1);
484  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 1);
485  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
486  CPPUNIT_ASSERT(pReaction->isReversible() == true);
487  // check the kinetic law
488  CPPUNIT_ASSERT(pReaction->getParameters().size() == 1);
489  pFunction = pReaction->getFunction();
490  CPPUNIT_ASSERT(pFunction != NULL);
491  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
492  CPPUNIT_ASSERT(pFunction->getObjectName() == "Function for reaction3");
493  pRoot = pFunction->getRoot();
494  CPPUNIT_ASSERT(pRoot != NULL);
495 
496  pReaction = pModel->getReactions()[3];
497  CPPUNIT_ASSERT(pReaction != NULL);
498  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 1);
499  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 1);
500  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
501  CPPUNIT_ASSERT(pReaction->isReversible() == true);
502  // check the kinetic law
503  CPPUNIT_ASSERT(pReaction->getParameters().size() == 0);
504  pFunction = pReaction->getFunction();
505  CPPUNIT_ASSERT(pFunction != NULL);
506  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
507  CPPUNIT_ASSERT(pFunction->getObjectName() == "Function for reaction4");
508  pRoot = pFunction->getRoot();
509  CPPUNIT_ASSERT(pRoot != NULL);
510 
511  pReaction = pModel->getReactions()[4];
512  CPPUNIT_ASSERT(pReaction != NULL);
513  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 1);
514  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 1);
515  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
516  CPPUNIT_ASSERT(pReaction->isReversible() == true);
517  // check the kinetic law
518  CPPUNIT_ASSERT(pReaction->getParameters().size() == 2);
519  pFunction = pReaction->getFunction();
520  CPPUNIT_ASSERT(pFunction != NULL);
521  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
522  CPPUNIT_ASSERT(pFunction->getObjectName() == "Function for reaction5");
523  pRoot = pFunction->getRoot();
524  CPPUNIT_ASSERT(pRoot != NULL);
525 
526  pReaction = pModel->getReactions()[5];
527  CPPUNIT_ASSERT(pReaction != NULL);
528  CPPUNIT_ASSERT(pReaction->getChemEq().getSubstrates().size() == 1);
529  CPPUNIT_ASSERT(pReaction->getChemEq().getProducts().size() == 1);
530  CPPUNIT_ASSERT(pReaction->getChemEq().getModifiers().size() == 0);
531  CPPUNIT_ASSERT(pReaction->isReversible() == true);
532  // check the kinetic law
533  CPPUNIT_ASSERT(pReaction->getParameters().size() == 3);
534  pFunction = pReaction->getFunction();
535  CPPUNIT_ASSERT(pFunction != NULL);
536  CPPUNIT_ASSERT(pFunction->getType() == CEvaluationTree::UserDefined);
537  CPPUNIT_ASSERT(pFunction->getObjectName() == "Function for reaction6");
538  pRoot = pFunction->getRoot();
539  CPPUNIT_ASSERT(pRoot != NULL);
540 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000078.h:34
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
CModel::QuantityUnit getQuantityUnitEnum() const
Definition: CModel.cpp:2331
virtual size_t size() const
const C_FLOAT64 & getValue() const
const Type & getType() const
Definition: CMetab.h:178
static Type type(const Type &type)
virtual const Data & getData() const
static CFunctionDB * getFunctionList()
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
static Type subType(const Type &type)
CModel::TimeUnit getTimeUnitEnum() const
Definition: CModel.cpp:2243
static const char * MODEL_STRING1
Definition: test000078.h:33
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
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
Definition: CModel.h:50
virtual const Data & getData() const
Definition: CCopasiNode.h:118
CModel::VolumeUnit getVolumeUnitEnum() const
Definition: CModel.cpp:2175
CEvaluationNode * getRoot()
CFunctionParameters & getVariables()
Definition: CFunction.cpp:148

Member Data Documentation

const char * test000078::MODEL_STRING1
staticprotected

Definition at line 33 of file test000078.h.

Referenced by test_l2v4_import_unordered_functions().

CCopasiDataModel * test000078::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 34 of file test000078.h.

Referenced by setUp(), and test_l2v4_import_unordered_functions().


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