22 #include "utilities.hpp"
34 #include "sbml/SBMLDocument.h"
35 #include "sbml/Model.h"
36 #include "sbml/Rule.h"
37 #include "sbml/Species.h"
38 #include "sbml/Parameter.h"
39 #include "sbml/math/ASTNode.h"
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");
75 const CExpression* pExpr = pMetab->getExpressionPtr();
76 CPPUNIT_ASSERT(pExpr != NULL);
78 CPPUNIT_ASSERT(pRoot != NULL);
81 CPPUNIT_ASSERT(pChoiceNode != NULL);
83 CPPUNIT_ASSERT(pChild1 != NULL);
85 CPPUNIT_ASSERT(pChild2 != NULL);
89 CPPUNIT_ASSERT(pNumberNode != NULL);
90 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.5) / 0.5) < 1e-6);
92 CPPUNIT_ASSERT(pChild3 != NULL);
96 CPPUNIT_ASSERT(pNumberNode != NULL);
97 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.5) / 1.5) < 1e-6);
98 CPPUNIT_ASSERT(pChild3->getSibling() == NULL);
102 CPPUNIT_ASSERT(pChild1 != NULL);
106 CPPUNIT_ASSERT(pNumberNode != NULL);
107 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
109 CPPUNIT_ASSERT(pChild2 != NULL);
113 CPPUNIT_ASSERT(pNumberNode != NULL);
114 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
118 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
119 "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
120 " <model id=\"Model_1\" name=\"New Model\">\n"
121 " <listOfUnitDefinitions>\n"
122 " <unitDefinition id=\"volume\">\n"
124 " <unit kind=\"litre\" scale=\"-3\"/>\n"
126 " </unitDefinition>\n"
127 " <unitDefinition id=\"substance\">\n"
129 " <unit kind=\"mole\" scale=\"-3\"/>\n"
131 " </unitDefinition>\n"
132 " </listOfUnitDefinitions>\n"
133 " <listOfCompartments>\n"
134 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
135 " </listOfCompartments>\n"
137 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\" boundaryCondition=\"true\"/>\n"
138 " </listOfSpecies>\n"
140 " <assignmentRule variable=\"species_1\">\n"
141 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
156 " </assignmentRule>\n"
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");
179 const CExpression* pExpr = pMetab->getExpressionPtr();
180 CPPUNIT_ASSERT(pExpr != NULL);
182 CPPUNIT_ASSERT(pRoot != NULL);
185 CPPUNIT_ASSERT(pConstantNode != NULL);
190 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
191 "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
192 " <model id=\"Model_1\" name=\"New Model\">\n"
193 " <listOfUnitDefinitions>\n"
194 " <unitDefinition id=\"volume\">\n"
196 " <unit kind=\"litre\" scale=\"-3\"/>\n"
198 " </unitDefinition>\n"
199 " <unitDefinition id=\"substance\">\n"
201 " <unit kind=\"mole\" scale=\"-3\"/>\n"
203 " </unitDefinition>\n"
204 " </listOfUnitDefinitions>\n"
205 " <listOfCompartments>\n"
206 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
207 " </listOfCompartments>\n"
209 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\" boundaryCondition=\"true\"/>\n"
210 " </listOfSpecies>\n"
212 " <assignmentRule variable=\"species_1\">\n"
213 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
217 " </assignmentRule>\n"
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");
240 const CExpression* pExpr = pMetab->getExpressionPtr();
241 CPPUNIT_ASSERT(pExpr != NULL);
243 CPPUNIT_ASSERT(pRoot != NULL);
246 CPPUNIT_ASSERT(pChoiceNode != NULL);
248 CPPUNIT_ASSERT(pChild1 != NULL);
250 CPPUNIT_ASSERT(pChild2 != NULL);
254 CPPUNIT_ASSERT(pNumberNode != NULL);
255 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.5) / 0.5) < 1e-6);
257 CPPUNIT_ASSERT(pChild3 != NULL);
261 CPPUNIT_ASSERT(pChild1 != NULL);
265 CPPUNIT_ASSERT(pNumberNode != NULL);
266 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
268 CPPUNIT_ASSERT(pChild2 != NULL);
272 CPPUNIT_ASSERT(pNumberNode != NULL);
273 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
277 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
278 "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
279 " <model id=\"Model_1\" name=\"New Model\">\n"
280 " <listOfUnitDefinitions>\n"
281 " <unitDefinition id=\"volume\">\n"
283 " <unit kind=\"litre\" scale=\"-3\"/>\n"
285 " </unitDefinition>\n"
286 " <unitDefinition id=\"substance\">\n"
288 " <unit kind=\"mole\" scale=\"-3\"/>\n"
290 " </unitDefinition>\n"
291 " </listOfUnitDefinitions>\n"
292 " <listOfCompartments>\n"
293 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
294 " </listOfCompartments>\n"
296 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\" boundaryCondition=\"true\"/>\n"
297 " </listOfSpecies>\n"
299 " <assignmentRule variable=\"species_1\">\n"
300 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
312 " </assignmentRule>\n"
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");
335 const CExpression* pExpr = pMetab->getExpressionPtr();
336 CPPUNIT_ASSERT(pExpr != NULL);
338 CPPUNIT_ASSERT(pRoot != NULL);
342 CPPUNIT_ASSERT(pNumberNode != NULL);
343 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.5) / 1.5) < 1e-6);
347 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
348 "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
349 " <model id=\"Model_1\" name=\"New Model\">\n"
350 " <listOfUnitDefinitions>\n"
351 " <unitDefinition id=\"volume\">\n"
353 " <unit kind=\"litre\" scale=\"-3\"/>\n"
355 " </unitDefinition>\n"
356 " <unitDefinition id=\"substance\">\n"
358 " <unit kind=\"mole\" scale=\"-3\"/>\n"
360 " </unitDefinition>\n"
361 " </listOfUnitDefinitions>\n"
362 " <listOfCompartments>\n"
363 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
364 " </listOfCompartments>\n"
366 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\" boundaryCondition=\"true\"/>\n"
367 " </listOfSpecies>\n"
369 " <assignmentRule variable=\"species_1\">\n"
370 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
377 " </assignmentRule>\n"
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");
400 const CExpression* pExpr = pMetab->getExpressionPtr();
401 CPPUNIT_ASSERT(pExpr != NULL);
403 CPPUNIT_ASSERT(pRoot != NULL);
406 CPPUNIT_ASSERT(pChoiceNode != NULL);
408 CPPUNIT_ASSERT(pChild1 != NULL);
410 CPPUNIT_ASSERT(pChild2 != NULL);
414 CPPUNIT_ASSERT(pNumberNode != NULL);
415 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.1) / 0.1) < 1e-6);
417 CPPUNIT_ASSERT(pChild3 != NULL);
420 CPPUNIT_ASSERT(pChoiceNode);
424 CPPUNIT_ASSERT(pChild1 != NULL);
428 CPPUNIT_ASSERT(pNumberNode != NULL);
429 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
431 CPPUNIT_ASSERT(pChild2 != NULL);
435 CPPUNIT_ASSERT(pNumberNode != NULL);
436 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
440 CPPUNIT_ASSERT(pChild1 != NULL);
442 CPPUNIT_ASSERT(pChild2 != NULL);
446 CPPUNIT_ASSERT(pNumberNode != NULL);
447 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.2) / 0.2) < 1e-6);
449 CPPUNIT_ASSERT(pChild3 != NULL);
452 CPPUNIT_ASSERT(pChoiceNode);
456 CPPUNIT_ASSERT(pChild1 != NULL);
460 CPPUNIT_ASSERT(pNumberNode != NULL);
461 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
463 CPPUNIT_ASSERT(pChild2 != NULL);
467 CPPUNIT_ASSERT(pNumberNode != NULL);
468 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
472 CPPUNIT_ASSERT(pChild1 != NULL);
474 CPPUNIT_ASSERT(pChild2 != NULL);
478 CPPUNIT_ASSERT(pNumberNode != NULL);
479 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.3) / 0.3) < 1e-6);
481 CPPUNIT_ASSERT(pChild3 != NULL);
484 CPPUNIT_ASSERT(pChoiceNode);
488 CPPUNIT_ASSERT(pChild1 != NULL);
492 CPPUNIT_ASSERT(pNumberNode != NULL);
493 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
495 CPPUNIT_ASSERT(pChild2 != NULL);
499 CPPUNIT_ASSERT(pNumberNode != NULL);
500 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
504 CPPUNIT_ASSERT(pChild1 != NULL);
506 CPPUNIT_ASSERT(pChild2 != NULL);
510 CPPUNIT_ASSERT(pNumberNode != NULL);
511 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 0.4) / 0.4) < 1e-6);
513 CPPUNIT_ASSERT(pChild3 != NULL);
518 CPPUNIT_ASSERT(pNumberNode != NULL);
519 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 1.5) / 1.5) < 1e-6);
520 CPPUNIT_ASSERT(pChild3->getSibling() == NULL);
524 CPPUNIT_ASSERT(pChild1 != NULL);
528 CPPUNIT_ASSERT(pNumberNode != NULL);
529 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 3.0) / 3.0) < 1e-6);
531 CPPUNIT_ASSERT(pChild2 != NULL);
535 CPPUNIT_ASSERT(pNumberNode != NULL);
536 CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 4.0) / 4.0) < 1e-6);
540 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
541 "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
542 " <model id=\"Model_1\" name=\"New Model\">\n"
543 " <listOfUnitDefinitions>\n"
544 " <unitDefinition id=\"volume\">\n"
546 " <unit kind=\"litre\" scale=\"-3\"/>\n"
548 " </unitDefinition>\n"
549 " <unitDefinition id=\"substance\">\n"
551 " <unit kind=\"mole\" scale=\"-3\"/>\n"
553 " </unitDefinition>\n"
554 " </listOfUnitDefinitions>\n"
555 " <listOfCompartments>\n"
556 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
557 " </listOfCompartments>\n"
559 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\" boundaryCondition=\"true\"/>\n"
560 " </listOfSpecies>\n"
562 " <assignmentRule variable=\"species_1\">\n"
563 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
602 " </assignmentRule>\n"
Header file of class CExpression.
static CCopasiDataModel * pCOPASIDATAMODEL
Header file of class CModelEntity and CModelValue.
CCopasiNode< Data > * getSibling()
static const char * MODEL_STRING_4
static const char * MODEL_STRING_1
static const char * MODEL_STRING_2
const Type & getType() const
static const char * MODEL_STRING_5
static Type type(const Type &type)
static CCopasiDataModel * addDatamodel()
static Type subType(const Type &type)
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static void init(int argc, char *argv[], const bool &withGui=false)
CCopasiNode< Data > * getChild()
static const char * MODEL_STRING_3