14 #include "utilities.hpp"
46 CPPUNIT_ASSERT(pModel != NULL);
47 CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() ==
CModel::mMol);
48 CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() ==
CModel::ml);
49 CPPUNIT_ASSERT(pModel->getTimeUnitEnum() ==
CModel::s);
50 CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
51 const CCompartment* pCompartment = pModel->getCompartments()[0];
52 CPPUNIT_ASSERT(pCompartment != NULL);
54 CPPUNIT_ASSERT(pModel->getMetabolites().size() == 2);
55 CMetab* pA = pModel->getMetabolites()[0];
56 CPPUNIT_ASSERT(pA != NULL);
58 const CMetab* pB = pModel->getMetabolites()[1];
59 CPPUNIT_ASSERT(pB != NULL);
61 CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
62 const CModelValue* pModelValue = pModel->getModelValues()[0];
63 CPPUNIT_ASSERT(pModelValue != NULL);
65 CPPUNIT_ASSERT(pModelValue->getInitialExpression() !=
"");
66 const CExpression* pExpr = pModelValue->getInitialExpressionPtr();
69 CPPUNIT_ASSERT(pNode != NULL);
71 CPPUNIT_ASSERT(pObjectNode != NULL);
73 CPPUNIT_ASSERT(!objectCN.empty());
74 std::vector<CCopasiContainer*> listOfContainers;
75 listOfContainers.push_back(pModel);
77 CPPUNIT_ASSERT(pObject != NULL);
79 CPPUNIT_ASSERT(pObject->
getObjectName() == std::string(
"InitialParticleNumber"));
83 CPPUNIT_ASSERT(pModel->getReactions().size() == 2);
84 const CReaction* pReaction1 = pModel->getReactions()[0];
85 CPPUNIT_ASSERT(pReaction1 != NULL);
86 CPPUNIT_ASSERT(pReaction1->isReversible() ==
false);
88 const CFunction* pKineticFunction = pReaction1->getFunction();
89 CPPUNIT_ASSERT(pKineticFunction != NULL);
93 CPPUNIT_ASSERT(pMassAction == NULL);
94 const CChemEq* pChemEq = &pReaction1->getChemEq();
95 CPPUNIT_ASSERT(pChemEq != NULL);
99 CPPUNIT_ASSERT(pElement != NULL);
100 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
101 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
105 const CReaction* pReaction2 = pModel->getReactions()[1];
106 CPPUNIT_ASSERT(pReaction2 != NULL);
107 CPPUNIT_ASSERT(pReaction2->isReversible() ==
false);
109 pKineticFunction = pReaction2->getFunction();
110 CPPUNIT_ASSERT(pKineticFunction != NULL);
111 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Function for reaction_1"));
113 CPPUNIT_ASSERT(pFunctionParameters->size() == 4);
115 CPPUNIT_ASSERT(pFunctionParameter != NULL);
118 pFunctionParameter = (*pFunctionParameters)[1];
119 CPPUNIT_ASSERT(pFunctionParameter != NULL);
122 pFunctionParameter = (*pFunctionParameters)[2];
123 CPPUNIT_ASSERT(pFunctionParameter != NULL);
126 pFunctionParameter = (*pFunctionParameters)[3];
127 CPPUNIT_ASSERT(pFunctionParameter != NULL);
130 pNode = pKineticFunction->getRoot();
132 CPPUNIT_ASSERT(pCallNode != NULL);
134 CPPUNIT_ASSERT(pCallNode->
getData() == std::string(
"Henri-Michaelis-Menten (irreversible)_2"));
136 CPPUNIT_ASSERT(pOperatorNode != NULL);
139 CPPUNIT_ASSERT(pVariableNode != NULL);
140 CPPUNIT_ASSERT(pVariableNode->getIndex() == 3);
142 CPPUNIT_ASSERT(pVariableNode != NULL);
143 CPPUNIT_ASSERT(pVariableNode->getIndex() == 2);
145 CPPUNIT_ASSERT(pVariableNode != NULL);
146 CPPUNIT_ASSERT(pVariableNode->getIndex() == 0);
148 CPPUNIT_ASSERT(pVariableNode != NULL);
149 CPPUNIT_ASSERT(pVariableNode->getIndex() == 1);
152 CPPUNIT_ASSERT(pKineticFunction != NULL);
153 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Henri-Michaelis-Menten (irreversible)_2"));
154 pNode = pKineticFunction->getRoot();
155 CPPUNIT_ASSERT(pNode != NULL);
157 CPPUNIT_ASSERT(pOperatorNode != NULL);
160 CPPUNIT_ASSERT(pOperatorNode2 != NULL);
163 CPPUNIT_ASSERT(pVariableNode != NULL);
164 CPPUNIT_ASSERT(pVariableNode->getIndex() == 2);
166 CPPUNIT_ASSERT(pVariableNode != NULL);
167 CPPUNIT_ASSERT(pVariableNode->getIndex() == 0);
169 CPPUNIT_ASSERT(pOperatorNode2 != NULL);
172 CPPUNIT_ASSERT(pVariableNode != NULL);
173 CPPUNIT_ASSERT(pVariableNode->getIndex() == 1);
175 CPPUNIT_ASSERT(pVariableNode != NULL);
176 CPPUNIT_ASSERT(pVariableNode->getIndex() == 0);
179 pChemEq = &pReaction2->getChemEq();
180 CPPUNIT_ASSERT(pChemEq != NULL);
181 CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
182 CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
183 pElement = pChemEq->getSubstrates()[0];
184 CPPUNIT_ASSERT(pElement != NULL);
185 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
186 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
187 CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
188 pElement = pChemEq->getProducts()[0];
189 CPPUNIT_ASSERT(pElement != NULL);
190 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
191 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
192 CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
193 const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
194 CPPUNIT_ASSERT(parameterMappings.size() == 4);
195 CPPUNIT_ASSERT(parameterMappings[2].size() == 1);
196 std::string parameterKey = parameterMappings[2][0];
197 CPPUNIT_ASSERT(parameterKey == pCompartment->getKey());
198 CPPUNIT_ASSERT(parameterMappings[3].size() == 1);
199 parameterKey = parameterMappings[3][0];
200 CPPUNIT_ASSERT(parameterKey == pA->getKey());
204 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
205 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
206 " <model id=\"Model_1\" name=\"New Model\">\n"
208 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
209 " <p>Model with fixed compartment volume, two species with hasOnlySubstanceUnits flag set to true. The units are set to ml and mMol. There is an initial assignment for the global parameter that contains a reference to species A multiplied by a factor.</p>\n"
210 " <p>The imported model should contain an initial assignment for the global parameter that consists of the reference to the particle number of species A. The species references in the reactions should be imported multiplied by the volume.</p>\n"
213 " <listOfFunctionDefinitions>\n"
214 " <functionDefinition id=\"function_1\" name=\"Henri-Michaelis-Menten (irreversible)\">\n"
215 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
218 " <ci> substrate </ci>\n"
231 " <ci> substrate </ci>\n"
236 " <ci> substrate </ci>\n"
241 " </functionDefinition>\n"
242 " </listOfFunctionDefinitions>\n"
243 " <listOfUnitDefinitions>\n"
244 " <unitDefinition id=\"volume\">\n"
246 " <unit kind=\"litre\" scale=\"-3\"/>\n"
248 " </unitDefinition>\n"
249 " <unitDefinition id=\"substance\">\n"
251 " <unit kind=\"mole\" scale=\"-3\"/>\n"
253 " </unitDefinition>\n"
254 " </listOfUnitDefinitions>\n"
255 " <listOfCompartments>\n"
256 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
257 " </listOfCompartments>\n"
259 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
260 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
261 " </listOfSpecies>\n"
262 " <listOfParameters>\n"
263 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\" constant=\"true\"/>\n"
264 " </listOfParameters>\n"
265 " <listOfInitialAssignments>\n"
266 " <initialAssignment symbol=\"parameter_1\">\n"
267 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
270 " <ci> species_1 </ci>\n"
271 " <cn> 6.0221415e20 </cn>\n"
274 " </initialAssignment>\n"
275 " </listOfInitialAssignments>\n"
276 " <listOfReactions>\n"
277 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"false\">\n"
278 " <listOfReactants>\n"
279 " <speciesReference species=\"species_1\"/>\n"
280 " </listOfReactants>\n"
282 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
286 " <ci> species_1 </ci>\n"
289 " <listOfParameters>\n"
290 " <parameter id=\"k1\" value=\"0.1\"/>\n"
291 " </listOfParameters>\n"
294 " <reaction id=\"reaction_2\" name=\"reaction_1\" reversible=\"false\">\n"
295 " <listOfReactants>\n"
296 " <speciesReference species=\"species_1\"/>\n"
297 " </listOfReactants>\n"
298 " <listOfProducts>\n"
299 " <speciesReference species=\"species_2\"/>\n"
300 " </listOfProducts>\n"
302 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
305 " <ci> compartment_1 </ci>\n"
307 " <ci> function_1 </ci>\n"
308 " <ci> species_1 </ci>\n"
314 " <listOfParameters>\n"
315 " <parameter id=\"Km\" value=\"0.1\"/>\n"
316 " <parameter id=\"V\" value=\"0.1\"/>\n"
317 " </listOfParameters>\n"
320 " </listOfReactions>\n"
Header file of class CExpression.
size_t getCompartmentNumber() const
const CEvaluationTree * getCalledTree() const
Header file of class CModelEntity and CModelValue.
static const char * MODEL_STRING
const std::string & getObjectName() const
virtual size_t size() const
const CRegisteredObjectName & getObjectCN() const
const Type & getType() const
const CCopasiVector< CChemEqElement > & getProducts() const
virtual const Data & getData() const
const CCopasiVector< CChemEqElement > & getSubstrates() const
static CCopasiDataModel * addDatamodel()
static Type subType(const Type &type)
const CCopasiVector< CChemEqElement > & getModifiers() const
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
void test_hasOnlySubstanceUnits()
The class for handling a chemical kinetic function.
static void init(int argc, char *argv[], const bool &withGui=false)
CCopasiNode< Data > * getChild()
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
static CCopasiDataModel * pCOPASIDATAMODEL
CCopasiContainer * getObjectParent() const