16 #include "utilities.hpp"
21 #include <sbml/SBMLDocument.h>
22 #include <sbml/Model.h>
23 #include <sbml/Species.h>
24 #include <sbml/Parameter.h>
25 #include <sbml/Rule.h>
26 #include <sbml/math/ASTNode.h>
51 CPPUNIT_ASSERT(result ==
true);
57 CPPUNIT_ASSERT(
false);
67 CPPUNIT_ASSERT(
false);
72 CPPUNIT_ASSERT(pDocument != NULL);
73 CPPUNIT_ASSERT(pDocument->getLevel() == 2);
74 CPPUNIT_ASSERT(pDocument->getVersion() == 3);
75 const Model* pModel = pDocument->getModel();
76 CPPUNIT_ASSERT(pModel != NULL);
77 CPPUNIT_ASSERT(pModel->getListOfFunctionDefinitions()->size() == 0);
78 CPPUNIT_ASSERT(pModel->getListOfCompartments()->size() == 1);
79 CPPUNIT_ASSERT(pModel->getListOfSpecies()->size() == 1);
80 CPPUNIT_ASSERT(pModel->getListOfParameters()->size() == 1);
81 CPPUNIT_ASSERT(pModel->getListOfReactions()->size() == 0);
82 CPPUNIT_ASSERT(pModel->getListOfRules()->size() == 1);
83 const Rule* pRule = pModel->getRule(0);
84 CPPUNIT_ASSERT(pRule != NULL);
85 CPPUNIT_ASSERT(pRule->getTypeCode() == SBML_ASSIGNMENT_RULE);
86 const AssignmentRule* pAssignmentRule =
dynamic_cast<const AssignmentRule*
>(pRule);
87 CPPUNIT_ASSERT(pAssignmentRule != NULL);
88 const Species* pSpecies = pModel->getSpecies(0);
89 CPPUNIT_ASSERT(pSpecies != NULL);
90 CPPUNIT_ASSERT(pSpecies->getName() ==
"M");
91 const Parameter* pParameter = pModel->getParameter(pAssignmentRule->getVariable());
92 CPPUNIT_ASSERT(pParameter != NULL);
93 CPPUNIT_ASSERT(pParameter->getName() ==
"MV");
94 const ASTNode* pMath = pAssignmentRule->getMath();
95 CPPUNIT_ASSERT(pMath != NULL);
96 CPPUNIT_ASSERT(pMath->getType() == AST_DIVIDE);
97 CPPUNIT_ASSERT(pMath->getNumChildren() == 2);
98 const ASTNode* pChild = pMath->getChild(0);
99 CPPUNIT_ASSERT(pChild != NULL);
100 CPPUNIT_ASSERT(pChild->getType() == AST_REAL);
101 CPPUNIT_ASSERT(fabs(pChild->getReal() - 1.0) < 1e-6);
102 pChild = pMath->getChild(1);
103 CPPUNIT_ASSERT(pChild != NULL);
104 CPPUNIT_ASSERT(pChild->getType() == AST_NAME);
105 CPPUNIT_ASSERT(pChild->getName() == pSpecies->getId());
109 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
110 "<!-- generated with COPASI 4.5.31 (development) (http://www.copasi.org) at 2010-03-01 08:59:11 UTC -->\n"
111 "<?oxygen RNGSchema=\"http://www.copasi.org/static/schema/CopasiML.rng\" type=\"xml\"?>\n"
112 "<COPASI xmlns=\"http://www.copasi.org/static/schema\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"31\">\n"
113 " <Model key=\"Model_1\" name=\"Model\" simulationType=\"time\" timeUnit=\"s\" volumeUnit=\"l\" areaUnit=\"µm²\" lengthUnit=\"m\" quantityUnit=\"#\" type=\"deterministic\">\n"
114 " <ListOfCompartments>\n"
115 " <Compartment key=\"Compartment_1\" name=\"C\" simulationType=\"fixed\" dimensionality=\"3\" />\n"
116 " </ListOfCompartments> \n"
117 " <ListOfMetabolites>\n"
118 " <Metabolite key=\"Metabolite_1\" name=\"M\" simulationType=\"fixed\" compartment=\"Compartment_1\" />\n"
119 " </ListOfMetabolites>\n"
120 " <ListOfModelValues>\n"
121 " <ModelValue key=\"ModelValue_1\" name=\"MV\" simulationType=\"assignment\">\n"
123 " 1/<CN=Root,Model=Model,Vector=Compartments[C],Vector=Metabolites[M],Reference=Concentration>\n"
126 " </ListOfModelValues>\n"
128 " <StateTemplateVariable objectReference=\"Model_1\"/>\n"
129 " <StateTemplateVariable objectReference=\"ModelValue_1\"/>\n"
130 " <StateTemplateVariable objectReference=\"Compartment_1\"/>\n"
131 " <StateTemplateVariable objectReference=\"Metabolite_1\"/>\n"
132 " </StateTemplate>\n"
133 " <InitialState type=\"initialState\">\n"
SBMLDocument * getCurrentSBMLDocument()
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
static CCopasiDataModel * pCOPASIDATAMODEL
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
static const char * MODEL_STRING1