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

#include <test000053.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test1_bug1000 ()
 
void test2_bug1000 ()
 
void test3_bug1000 ()
 
void test4_bug1000 ()
 
void test5_bug1000 ()
 

Static Protected Attributes

static const char * MODEL_STRING_1
 
static const char * MODEL_STRING_2
 
static const char * MODEL_STRING_3
 
static const char * MODEL_STRING_4
 
static const char * MODEL_STRING_5
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test1_bug1000)
 
 CPPUNIT_TEST (test2_bug1000)
 
 CPPUNIT_TEST (test3_bug1000)
 
 CPPUNIT_TEST (test4_bug1000)
 
 CPPUNIT_TEST (test5_bug1000)
 
 CPPUNIT_TEST_SUITE (test000053)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000053.h.

Member Function Documentation

test000053::CPPUNIT_TEST ( test1_bug1000  )
private
test000053::CPPUNIT_TEST ( test2_bug1000  )
private
test000053::CPPUNIT_TEST ( test3_bug1000  )
private
test000053::CPPUNIT_TEST ( test4_bug1000  )
private
test000053::CPPUNIT_TEST ( test5_bug1000  )
private
test000053::CPPUNIT_TEST_SUITE ( test000053  )
private
test000053::CPPUNIT_TEST_SUITE_END ( )
private
void test000053::setUp ( )

Definition at line 45 of file test000053.cpp.

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

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

Definition at line 53 of file test000053.cpp.

References CCopasiRootContainer::destroy().

void test000053::test1_bug1000 ( )

Definition at line 58 of file test000053.cpp.

References CModelEntity::ASSIGNMENT, CEvaluationNode::CHOICE, CEvaluationNodeNumber::DOUBLE, CCopasiNode< _Data >::getChild(), CCopasiDataModel::getModel(), CCopasiNode< _Data >::getSibling(), CEvaluationNode::getType(), CEvaluationNodeLogical::GT, CCopasiDataModel::importSBMLFromString(), CEvaluationNode::LOGICAL, MODEL_STRING_1, CEvaluationNode::NUMBER, pCOPASIDATAMODEL, CEvaluationNode::subType(), and CEvaluationNode::type().

59 {
60  // load the CPS file
61  // export to SBML
62  // check the resulting SBML model
63  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
64  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000053::MODEL_STRING_1));
65  const CModel* pModel = pDataModel->getModel();
66  CPPUNIT_ASSERT(pModel != NULL);
67  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
68  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
69  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
70  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
71  const CMetab* pMetab = pModel->getMetabolites()[0];
72  CPPUNIT_ASSERT(pMetab != NULL);
73  CPPUNIT_ASSERT(pMetab->getObjectName() == "A");
74  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ASSIGNMENT);
75  const CExpression* pExpr = pMetab->getExpressionPtr();
76  CPPUNIT_ASSERT(pExpr != NULL);
77  const CEvaluationNode* pRoot = pExpr->getRoot();
78  CPPUNIT_ASSERT(pRoot != NULL);
79  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::CHOICE);
80  const CEvaluationNodeChoice* pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pRoot);
81  CPPUNIT_ASSERT(pChoiceNode != NULL);
82  const CEvaluationNode* pChild1 = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
83  CPPUNIT_ASSERT(pChild1 != NULL);
84  const CEvaluationNode* pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
85  CPPUNIT_ASSERT(pChild2 != NULL);
86  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
88  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
89  CPPUNIT_ASSERT(pNumberNode != NULL);
90  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.5) / 0.5) < 1e-6);
91  const CEvaluationNode* pChild3 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
92  CPPUNIT_ASSERT(pChild3 != NULL);
93  CPPUNIT_ASSERT(CEvaluationNode::type(pChild3->getType()) == CEvaluationNode::NUMBER);
95  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild3);
96  CPPUNIT_ASSERT(pNumberNode != NULL);
97  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.5) / 1.5) < 1e-6);
98  CPPUNIT_ASSERT(pChild3->getSibling() == NULL);
99  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::LOGICAL);
101  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getChild());
102  CPPUNIT_ASSERT(pChild1 != NULL);
103  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::NUMBER);
105  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild1);
106  CPPUNIT_ASSERT(pNumberNode != NULL);
107  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
108  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
109  CPPUNIT_ASSERT(pChild2 != NULL);
110  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
112  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
113  CPPUNIT_ASSERT(pNumberNode != NULL);
114  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
115 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000053.h:40
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
static const char * MODEL_STRING_1
Definition: test000053.h:35
const Type & getType() const
Definition: CMetab.h:178
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)
Definition: CModel.h:50
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
void test000053::test2_bug1000 ( )

Definition at line 162 of file test000053.cpp.

References CEvaluationNodeConstant::_NaN, CModelEntity::ASSIGNMENT, CEvaluationNode::CONSTANT, CCopasiDataModel::getModel(), CEvaluationNode::getType(), CCopasiDataModel::importSBMLFromString(), MODEL_STRING_2, pCOPASIDATAMODEL, CEvaluationNode::subType(), and CEvaluationNode::type().

163 {
164  // load the CPS file
165  // export to SBML
166  // check the resulting SBML model
167  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
168  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000053::MODEL_STRING_2));
169  const CModel* pModel = pDataModel->getModel();
170  CPPUNIT_ASSERT(pModel != NULL);
171  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
172  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
173  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
174  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
175  const CMetab* pMetab = pModel->getMetabolites()[0];
176  CPPUNIT_ASSERT(pMetab != NULL);
177  CPPUNIT_ASSERT(pMetab->getObjectName() == "A");
178  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ASSIGNMENT);
179  const CExpression* pExpr = pMetab->getExpressionPtr();
180  CPPUNIT_ASSERT(pExpr != NULL);
181  const CEvaluationNode* pRoot = pExpr->getRoot();
182  CPPUNIT_ASSERT(pRoot != NULL);
183  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::CONSTANT);
184  const CEvaluationNodeConstant* pConstantNode = dynamic_cast<const CEvaluationNodeConstant*>(pRoot);
185  CPPUNIT_ASSERT(pConstantNode != NULL);
187 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000053.h:40
static const char * MODEL_STRING_2
Definition: test000053.h:36
const Type & getType() const
Definition: CMetab.h:178
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)
Definition: CModel.h:50
void test000053::test3_bug1000 ( )

Definition at line 223 of file test000053.cpp.

References CEvaluationNodeConstant::_NaN, CModelEntity::ASSIGNMENT, CEvaluationNode::CHOICE, CEvaluationNode::CONSTANT, CEvaluationNodeNumber::DOUBLE, CCopasiNode< _Data >::getChild(), CCopasiDataModel::getModel(), CCopasiNode< _Data >::getSibling(), CEvaluationNode::getType(), CCopasiDataModel::importSBMLFromString(), MODEL_STRING_3, CEvaluationNode::NUMBER, pCOPASIDATAMODEL, CEvaluationNode::subType(), and CEvaluationNode::type().

224 {
225  // load the CPS file
226  // export to SBML
227  // check the resulting SBML model
228  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
229  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000053::MODEL_STRING_3));
230  const CModel* pModel = pDataModel->getModel();
231  CPPUNIT_ASSERT(pModel != NULL);
232  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
233  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
234  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
235  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
236  const CMetab* pMetab = pModel->getMetabolites()[0];
237  CPPUNIT_ASSERT(pMetab != NULL);
238  CPPUNIT_ASSERT(pMetab->getObjectName() == "A");
239  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ASSIGNMENT);
240  const CExpression* pExpr = pMetab->getExpressionPtr();
241  CPPUNIT_ASSERT(pExpr != NULL);
242  const CEvaluationNode* pRoot = pExpr->getRoot();
243  CPPUNIT_ASSERT(pRoot != NULL);
244  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::CHOICE);
245  const CEvaluationNodeChoice* pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pRoot);
246  CPPUNIT_ASSERT(pChoiceNode != NULL);
247  const CEvaluationNode* pChild1 = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
248  CPPUNIT_ASSERT(pChild1 != NULL);
249  const CEvaluationNode* pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
250  CPPUNIT_ASSERT(pChild2 != NULL);
251  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
253  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
254  CPPUNIT_ASSERT(pNumberNode != NULL);
255  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.5) / 0.5) < 1e-6);
256  const CEvaluationNode* pChild3 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
257  CPPUNIT_ASSERT(pChild3 != NULL);
258  CPPUNIT_ASSERT(CEvaluationNode::type(pChild3->getType()) == CEvaluationNode::CONSTANT);
260  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getChild());
261  CPPUNIT_ASSERT(pChild1 != NULL);
262  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::NUMBER);
264  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild1);
265  CPPUNIT_ASSERT(pNumberNode != NULL);
266  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
267  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
268  CPPUNIT_ASSERT(pChild2 != NULL);
269  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
271  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
272  CPPUNIT_ASSERT(pNumberNode != NULL);
273  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
274 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000053.h:40
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
const Type & getType() const
Definition: CMetab.h:178
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)
Definition: CModel.h:50
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
static const char * MODEL_STRING_3
Definition: test000053.h:37
void test000053::test4_bug1000 ( )

Definition at line 318 of file test000053.cpp.

References CModelEntity::ASSIGNMENT, CEvaluationNodeNumber::DOUBLE, CCopasiDataModel::getModel(), CEvaluationNode::getType(), CCopasiDataModel::importSBMLFromString(), MODEL_STRING_4, CEvaluationNode::NUMBER, pCOPASIDATAMODEL, CEvaluationNode::subType(), and CEvaluationNode::type().

319 {
320  // load the CPS file
321  // export to SBML
322  // check the resulting SBML model
323  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
324  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000053::MODEL_STRING_4));
325  const CModel* pModel = pDataModel->getModel();
326  CPPUNIT_ASSERT(pModel != NULL);
327  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
328  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
329  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
330  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
331  const CMetab* pMetab = pModel->getMetabolites()[0];
332  CPPUNIT_ASSERT(pMetab != NULL);
333  CPPUNIT_ASSERT(pMetab->getObjectName() == "A");
334  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ASSIGNMENT);
335  const CExpression* pExpr = pMetab->getExpressionPtr();
336  CPPUNIT_ASSERT(pExpr != NULL);
337  const CEvaluationNode* pRoot = pExpr->getRoot();
338  CPPUNIT_ASSERT(pRoot != NULL);
339  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::NUMBER);
341  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pRoot);
342  CPPUNIT_ASSERT(pNumberNode != NULL);
343  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.5) / 1.5) < 1e-6);
344 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000053.h:40
static const char * MODEL_STRING_4
Definition: test000053.h:38
const Type & getType() const
Definition: CMetab.h:178
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)
Definition: CModel.h:50
void test000053::test5_bug1000 ( )

Definition at line 383 of file test000053.cpp.

References CModelEntity::ASSIGNMENT, CEvaluationNode::CHOICE, CEvaluationNodeNumber::DOUBLE, CEvaluationNodeLogical::EQ, CCopasiNode< _Data >::getChild(), CCopasiDataModel::getModel(), CCopasiNode< _Data >::getSibling(), CEvaluationNode::getType(), CEvaluationNodeLogical::GT, CCopasiDataModel::importSBMLFromString(), CEvaluationNodeLogical::LE, CEvaluationNode::LOGICAL, CEvaluationNodeLogical::LT, MODEL_STRING_5, CEvaluationNode::NUMBER, pCOPASIDATAMODEL, CEvaluationNode::subType(), and CEvaluationNode::type().

384 {
385  // load the CPS file
386  // export to SBML
387  // check the resulting SBML model
388  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
389  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000053::MODEL_STRING_5));
390  const CModel* pModel = pDataModel->getModel();
391  CPPUNIT_ASSERT(pModel != NULL);
392  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
393  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
394  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
395  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
396  const CMetab* pMetab = pModel->getMetabolites()[0];
397  CPPUNIT_ASSERT(pMetab != NULL);
398  CPPUNIT_ASSERT(pMetab->getObjectName() == "A");
399  CPPUNIT_ASSERT(pMetab->getStatus() == CModelEntity::ASSIGNMENT);
400  const CExpression* pExpr = pMetab->getExpressionPtr();
401  CPPUNIT_ASSERT(pExpr != NULL);
402  const CEvaluationNode* pRoot = pExpr->getRoot();
403  CPPUNIT_ASSERT(pRoot != NULL);
404  CPPUNIT_ASSERT(CEvaluationNode::type(pRoot->getType()) == CEvaluationNode::CHOICE);
405  const CEvaluationNodeChoice* pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pRoot);
406  CPPUNIT_ASSERT(pChoiceNode != NULL);
407  const CEvaluationNode* pChild1 = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
408  CPPUNIT_ASSERT(pChild1 != NULL);
409  const CEvaluationNode* pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
410  CPPUNIT_ASSERT(pChild2 != NULL);
411  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
413  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
414  CPPUNIT_ASSERT(pNumberNode != NULL);
415  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.1) / 0.1) < 1e-6);
416  const CEvaluationNode* pChild3 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
417  CPPUNIT_ASSERT(pChild3 != NULL);
418  CPPUNIT_ASSERT(CEvaluationNode::type(pChild3->getType()) == CEvaluationNode::CHOICE);
419  pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pChild3);
420  CPPUNIT_ASSERT(pChoiceNode);
421  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::LOGICAL);
423  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getChild());
424  CPPUNIT_ASSERT(pChild1 != NULL);
425  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::NUMBER);
427  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild1);
428  CPPUNIT_ASSERT(pNumberNode != NULL);
429  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
430  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
431  CPPUNIT_ASSERT(pChild2 != NULL);
432  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
434  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
435  CPPUNIT_ASSERT(pNumberNode != NULL);
436  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
437 
438  // second choice level (child3 of first choice level)
439  pChild1 = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
440  CPPUNIT_ASSERT(pChild1 != NULL);
441  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
442  CPPUNIT_ASSERT(pChild2 != NULL);
443  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
445  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
446  CPPUNIT_ASSERT(pNumberNode != NULL);
447  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.2) / 0.2) < 1e-6);
448  pChild3 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
449  CPPUNIT_ASSERT(pChild3 != NULL);
450  CPPUNIT_ASSERT(CEvaluationNode::type(pChild3->getType()) == CEvaluationNode::CHOICE);
451  pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pChild3);
452  CPPUNIT_ASSERT(pChoiceNode);
453  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::LOGICAL);
455  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getChild());
456  CPPUNIT_ASSERT(pChild1 != NULL);
457  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::NUMBER);
459  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild1);
460  CPPUNIT_ASSERT(pNumberNode != NULL);
461  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
462  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
463  CPPUNIT_ASSERT(pChild2 != NULL);
464  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
466  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
467  CPPUNIT_ASSERT(pNumberNode != NULL);
468  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
469 
470  // third choice level (child3 of second choice level)
471  pChild1 = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
472  CPPUNIT_ASSERT(pChild1 != NULL);
473  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
474  CPPUNIT_ASSERT(pChild2 != NULL);
475  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
477  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
478  CPPUNIT_ASSERT(pNumberNode != NULL);
479  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.3) / 0.3) < 1e-6);
480  pChild3 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
481  CPPUNIT_ASSERT(pChild3 != NULL);
482  CPPUNIT_ASSERT(CEvaluationNode::type(pChild3->getType()) == CEvaluationNode::CHOICE);
483  pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pChild3);
484  CPPUNIT_ASSERT(pChoiceNode);
485  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::LOGICAL);
487  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getChild());
488  CPPUNIT_ASSERT(pChild1 != NULL);
489  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::NUMBER);
491  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild1);
492  CPPUNIT_ASSERT(pNumberNode != NULL);
493  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
494  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
495  CPPUNIT_ASSERT(pChild2 != NULL);
496  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
498  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
499  CPPUNIT_ASSERT(pNumberNode != NULL);
500  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
501 
502  // fourth choice level (child3 of third choice level)
503  pChild1 = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
504  CPPUNIT_ASSERT(pChild1 != NULL);
505  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
506  CPPUNIT_ASSERT(pChild2 != NULL);
507  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
509  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
510  CPPUNIT_ASSERT(pNumberNode != NULL);
511  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.4) / 0.4) < 1e-6);
512  pChild3 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
513  CPPUNIT_ASSERT(pChild3 != NULL);
514  // the third child of the fourth choice level must be the otherwise element
515  CPPUNIT_ASSERT(CEvaluationNode::type(pChild3->getType()) == CEvaluationNode::NUMBER);
517  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild3);
518  CPPUNIT_ASSERT(pNumberNode != NULL);
519  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.5) / 1.5) < 1e-6);
520  CPPUNIT_ASSERT(pChild3->getSibling() == NULL);
521  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::LOGICAL);
523  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getChild());
524  CPPUNIT_ASSERT(pChild1 != NULL);
525  CPPUNIT_ASSERT(CEvaluationNode::type(pChild1->getType()) == CEvaluationNode::NUMBER);
527  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild1);
528  CPPUNIT_ASSERT(pNumberNode != NULL);
529  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
530  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
531  CPPUNIT_ASSERT(pChild2 != NULL);
532  CPPUNIT_ASSERT(CEvaluationNode::type(pChild2->getType()) == CEvaluationNode::NUMBER);
534  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pChild2);
535  CPPUNIT_ASSERT(pNumberNode != NULL);
536  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
537 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000053.h:40
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
const Type & getType() const
static const char * MODEL_STRING_5
Definition: test000053.h:39
Definition: CMetab.h:178
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)
Definition: CModel.h:50
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210

Member Data Documentation

const char * test000053::MODEL_STRING_1
staticprotected

Definition at line 35 of file test000053.h.

Referenced by test1_bug1000().

const char * test000053::MODEL_STRING_2
staticprotected

Definition at line 36 of file test000053.h.

Referenced by test2_bug1000().

const char * test000053::MODEL_STRING_3
staticprotected

Definition at line 37 of file test000053.h.

Referenced by test3_bug1000().

const char * test000053::MODEL_STRING_4
staticprotected

Definition at line 38 of file test000053.h.

Referenced by test4_bug1000().

const char * test000053::MODEL_STRING_5
staticprotected

Definition at line 39 of file test000053.h.

Referenced by test5_bug1000().

CCopasiDataModel * test000053::pCOPASIDATAMODEL = NULL
staticprotected

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