22 #include "utilities.hpp"
54 CPPUNIT_ASSERT(pModel != NULL);
56 CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() ==
CModel::ml);
57 CPPUNIT_ASSERT(pModel->getTimeUnitEnum() ==
CModel::s);
58 CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
59 const CCompartment* pCompartment = pModel->getCompartments()[0];
60 CPPUNIT_ASSERT(pCompartment != NULL);
62 CPPUNIT_ASSERT(pModel->getMetabolites().size() == 2);
63 CMetab* pA = pModel->getMetabolites()[0];
64 CPPUNIT_ASSERT(pA != NULL);
66 const CMetab* pB = pModel->getMetabolites()[1];
67 CPPUNIT_ASSERT(pB != NULL);
69 CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
70 const CModelValue* pModelValue = pModel->getModelValues()[0];
71 CPPUNIT_ASSERT(pModelValue != NULL);
73 CPPUNIT_ASSERT(pModelValue->getInitialExpression() !=
"");
74 const CExpression* pExpr = pModelValue->getInitialExpressionPtr();
77 CPPUNIT_ASSERT(pNode != NULL);
79 CPPUNIT_ASSERT(pObjectNode != NULL);
81 CPPUNIT_ASSERT(!objectCN.empty());
82 std::vector<CCopasiContainer*> listOfContainers;
83 listOfContainers.push_back(pModel);
85 CPPUNIT_ASSERT(pObject != NULL);
87 CPPUNIT_ASSERT(pObject->
getObjectName() == std::string(
"InitialParticleNumber"));
90 CPPUNIT_ASSERT(pModel->getReactions().size() == 2);
91 const CReaction* pReaction1 = pModel->getReactions()[0];
92 CPPUNIT_ASSERT(pReaction1 != NULL);
93 CPPUNIT_ASSERT(pReaction1->isReversible() ==
false);
95 const CFunction* pKineticFunction = pReaction1->getFunction();
96 CPPUNIT_ASSERT(pKineticFunction != NULL);
100 CPPUNIT_ASSERT(pMassAction == NULL);
101 const CChemEq* pChemEq = &pReaction1->getChemEq();
102 CPPUNIT_ASSERT(pChemEq != NULL);
106 CPPUNIT_ASSERT(pElement != NULL);
107 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
108 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
112 const CReaction* pReaction2 = pModel->getReactions()[1];
113 CPPUNIT_ASSERT(pReaction2 != NULL);
114 CPPUNIT_ASSERT(pReaction2->isReversible() ==
false);
116 pKineticFunction = pReaction2->getFunction();
117 CPPUNIT_ASSERT(pKineticFunction != NULL);
118 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Henri-Michaelis-Menten (irreversible)"));
120 pChemEq = &pReaction2->getChemEq();
121 CPPUNIT_ASSERT(pChemEq != NULL);
122 CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
123 CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
124 pElement = pChemEq->getSubstrates()[0];
125 CPPUNIT_ASSERT(pElement != NULL);
126 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
127 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
128 CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
129 pElement = pChemEq->getProducts()[0];
130 CPPUNIT_ASSERT(pElement != NULL);
131 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
132 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
133 CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
134 const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
135 CPPUNIT_ASSERT(parameterMappings.size() == 3);
136 CPPUNIT_ASSERT(parameterMappings[0].size() == 1);
137 const std::string parameterKey = parameterMappings[0][0];
138 CPPUNIT_ASSERT(parameterKey == pA->getKey());
142 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
143 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
144 " <model id=\"Model_1\" name=\"New Model\">\n"
146 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
147 " <p>Model with fixed compartment volume, two species with hasOnlySubstanceUnits flag set to true. The units are set to ml and microMol. There is an initial assignment for the global parameter that contains a reference to species A multiplied by a constant.</p>\n"
148 " <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"
151 " <listOfFunctionDefinitions>\n"
152 " <functionDefinition id=\"function_1\" name=\"Henri-Michaelis-Menten (irreversible)\">\n"
153 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
156 " <ci> substrate </ci>\n"
169 " <ci> substrate </ci>\n"
174 " <ci> substrate </ci>\n"
179 " </functionDefinition>\n"
180 " </listOfFunctionDefinitions>\n"
181 " <listOfUnitDefinitions>\n"
182 " <unitDefinition id=\"volume\">\n"
184 " <unit kind=\"litre\" scale=\"-3\"/>\n"
186 " </unitDefinition>\n"
187 " <unitDefinition id=\"substance\">\n"
189 " <unit kind=\"mole\" scale=\"-6\"/>\n"
191 " </unitDefinition>\n"
192 " </listOfUnitDefinitions>\n"
193 " <listOfCompartments>\n"
194 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
195 " </listOfCompartments>\n"
197 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
198 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
199 " </listOfSpecies>\n"
200 " <listOfParameters>\n"
201 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\" constant=\"true\"/>\n"
202 " </listOfParameters>\n"
203 " <listOfInitialAssignments>\n"
204 " <initialAssignment symbol=\"parameter_1\">\n"
205 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
208 " <ci> species_1 </ci>\n"
209 " <cn> 6.0221415e17 </cn>\n"
212 " </initialAssignment>\n"
213 " </listOfInitialAssignments>\n"
214 " <listOfReactions>\n"
215 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"false\">\n"
216 " <listOfReactants>\n"
217 " <speciesReference species=\"species_1\"/>\n"
218 " </listOfReactants>\n"
220 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
224 " <ci> species_1 </ci>\n"
227 " <listOfParameters>\n"
228 " <parameter id=\"k1\" value=\"0.1\"/>\n"
229 " </listOfParameters>\n"
232 " <reaction id=\"reaction_2\" name=\"reaction_1\" reversible=\"false\">\n"
233 " <listOfReactants>\n"
234 " <speciesReference species=\"species_1\"/>\n"
235 " </listOfReactants>\n"
236 " <listOfProducts>\n"
237 " <speciesReference species=\"species_2\"/>\n"
238 " </listOfProducts>\n"
240 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
243 " <ci> compartment_1 </ci>\n"
245 " <ci> function_1 </ci>\n"
248 " <ci> species_1 </ci>\n"
249 " <ci> compartment_1 </ci>\n"
256 " <listOfParameters>\n"
257 " <parameter id=\"Km\" value=\"0.1\"/>\n"
258 " <parameter id=\"V\" value=\"0.1\"/>\n"
259 " </listOfParameters>\n"
262 " </listOfReactions>\n"
Header file of class CExpression.
static const char * MODEL_STRING
size_t getCompartmentNumber() const
Header file of class CModelEntity and CModelValue.
const std::string & getObjectName() const
virtual size_t size() const
const CRegisteredObjectName & getObjectCN() const
void test_hasOnlySubstanceUnits()
const CCopasiVector< CChemEqElement > & getProducts() const
const CCopasiVector< CChemEqElement > & getSubstrates() const
static CCopasiDataModel * pCOPASIDATAMODEL
static CCopasiDataModel * addDatamodel()
const CCopasiVector< CChemEqElement > & getModifiers() const
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
The class for handling a chemical kinetic function.
static void init(int argc, char *argv[], const bool &withGui=false)
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
CCopasiContainer * getObjectParent() const