22 #include "utilities.hpp"
31 #include "sbml/SBMLDocument.h"
32 #include "sbml/Model.h"
33 #include "sbml/FunctionDefinition.h"
34 #include "sbml/math/ASTNode.h"
62 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
64 CPPUNIT_ASSERT(pDocument == NULL);
66 CPPUNIT_ASSERT(pModel != NULL);
68 CPPUNIT_ASSERT(!sbmlString.empty());
71 CPPUNIT_ASSERT(pDocument != NULL);
72 const Model* pSBMLModel = pDocument->getModel();
73 CPPUNIT_ASSERT(pSBMLModel != NULL);
75 CPPUNIT_ASSERT(pSBMLModel->getListOfFunctionDefinitions()->size() == 1);
76 const FunctionDefinition* pFunDef = pSBMLModel->getFunctionDefinition(0);
77 CPPUNIT_ASSERT(pFunDef != NULL);
78 CPPUNIT_ASSERT(pFunDef->getName() ==
"sqrt_call");
79 const ASTNode* pMath = pFunDef->getMath();
80 CPPUNIT_ASSERT(pMath != NULL);
82 pMath = pMath->getChild(pMath->getNumChildren() - 1);
83 CPPUNIT_ASSERT(pMath != NULL);
85 CPPUNIT_ASSERT(pMath->getType() == AST_FUNCTION_ROOT);
89 CPPUNIT_ASSERT(pMath->getNumChildren() == 1 || pMath->getNumChildren() == 2);
91 if (pMath->getNumChildren() == 2)
93 CPPUNIT_ASSERT(pMath->getChild(0) != NULL);
94 CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_INTEGER);
95 CPPUNIT_ASSERT(pMath->getChild(0)->getInteger() == 2);
96 pMath = pMath->getChild(1);
97 CPPUNIT_ASSERT(pMath != NULL);
98 CPPUNIT_ASSERT(pMath->getType() == AST_NAME);
99 CPPUNIT_ASSERT(pMath->getName() == std::string(
"k"));
101 else if (pMath->getNumChildren() == 1)
103 pMath = pMath->getChild(0);
104 CPPUNIT_ASSERT(pMath != NULL);
105 CPPUNIT_ASSERT(pMath->getType() == AST_NAME);
106 CPPUNIT_ASSERT(pMath->getName() == std::string(
"k"));
111 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
112 "<!-- generated with COPASI 4.4.27 (Debug) (http://www.copasi.org) at 2008-09-27 14:44:36 UTC -->\n"
113 "<COPASI xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.copasi.org/static/schema.xsd\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"27\">\n"
114 " <ListOfFunctions>\n"
115 " <Function key=\"Function_47\" name=\"sqrt_call\" type=\"UserDefined\" reversible=\"unspecified\">\n"
119 " <ListOfParameterDescriptions>\n"
120 " <ParameterDescription key=\"FunctionParameter_243\" name=\"k\" order=\"0\" role=\"constant\"/>\n"
121 " </ListOfParameterDescriptions>\n"
123 " </ListOfFunctions>\n"
124 " <Model key=\"Model_0\" name=\"New Model\" timeUnit=\"s\" volumeUnit=\"ml\" quantityUnit=\"mmol\" type=\"deterministic\">\n"
126 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
130 " <ListOfModelValues>\n"
131 " <ModelValue key=\"ModelValue_0\" name=\"P\" simulationType=\"assignment\">\n"
136 " </ListOfModelValues>\n"
138 " <StateTemplateVariable objectReference=\"Model_0\"/>\n"
139 " <StateTemplateVariable objectReference=\"ModelValue_0\"/>\n"
140 " </StateTemplate>\n"
141 " <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 const char * MODEL_STRING1
static CCopasiDataModel * addDatamodel()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static void init(int argc, char *argv[], const bool &withGui=false)
static CCopasiDataModel * pCOPASIDATAMODEL