22 #include "utilities.hpp"
54 CPPUNIT_ASSERT(pModel != NULL);
55 CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() ==
CModel::mMol);
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() == 2);
71 const CModelValue* pFactor = pModel->getModelValues()[1];
72 CPPUNIT_ASSERT(pFactor != NULL);
74 CPPUNIT_ASSERT(fabs((pFactor->getInitialValue() - pModel->getQuantity2NumberFactor()) / pModel->getQuantity2NumberFactor()) < 1e-3);
75 const CModelValue* pModelValue = pModel->getModelValues()[0];
76 CPPUNIT_ASSERT(pModelValue != NULL);
81 CPPUNIT_ASSERT(pNode != NULL);
83 CPPUNIT_ASSERT(pObjectNode != NULL);
85 CPPUNIT_ASSERT(!objectCN.empty());
86 std::vector<CCopasiContainer*> listOfContainers;
87 listOfContainers.push_back(pModel);
89 CPPUNIT_ASSERT(pObject != NULL);
91 CPPUNIT_ASSERT(pObject->
getObjectName() == std::string(
"ParticleNumber"));
94 CPPUNIT_ASSERT(pModel->getReactions().size() == 2);
95 const CReaction* pReaction1 = pModel->getReactions()[0];
96 CPPUNIT_ASSERT(pReaction1 != NULL);
97 CPPUNIT_ASSERT(pReaction1->isReversible() ==
false);
98 const CFunction* pKineticFunction = pReaction1->getFunction();
99 CPPUNIT_ASSERT(pKineticFunction != NULL);
103 CPPUNIT_ASSERT(pMassAction == NULL);
104 const CChemEq* pChemEq = &pReaction1->getChemEq();
105 CPPUNIT_ASSERT(pChemEq != NULL);
109 CPPUNIT_ASSERT(pElement != NULL);
110 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
111 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
115 const CReaction* pReaction2 = pModel->getReactions()[1];
116 CPPUNIT_ASSERT(pReaction2 != NULL);
117 CPPUNIT_ASSERT(pReaction2->isReversible() ==
false);
119 pKineticFunction = pReaction2->getFunction();
120 CPPUNIT_ASSERT(pKineticFunction != NULL);
121 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Henri-Michaelis-Menten (irreversible)"));
123 pChemEq = &pReaction2->getChemEq();
124 CPPUNIT_ASSERT(pChemEq != NULL);
125 CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
126 CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
127 pElement = pChemEq->getSubstrates()[0];
128 CPPUNIT_ASSERT(pElement != NULL);
129 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
130 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
131 CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
132 pElement = pChemEq->getProducts()[0];
133 CPPUNIT_ASSERT(pElement != NULL);
134 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
135 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
136 CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
137 const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
138 CPPUNIT_ASSERT(parameterMappings.size() == 3);
139 CPPUNIT_ASSERT(parameterMappings[0].size() == 1);
140 const std::string parameterKey = parameterMappings[0][0];
141 CPPUNIT_ASSERT(parameterKey == pA->getKey());
145 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
146 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
147 " <model id=\"Model_1\" name=\"New Model\">\n"
149 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
150 " <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 assignment ruile for the global parameter that contains a reference to species A multiplied by a constant parameter.</p>\n"
151 " <p>The imported model should contain an 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"
154 " <listOfFunctionDefinitions>\n"
155 " <functionDefinition id=\"function_1\" name=\"Henri-Michaelis-Menten (irreversible)\">\n"
156 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
159 " <ci> substrate </ci>\n"
172 " <ci> substrate </ci>\n"
177 " <ci> substrate </ci>\n"
182 " </functionDefinition>\n"
183 " </listOfFunctionDefinitions>\n"
184 " <listOfUnitDefinitions>\n"
185 " <unitDefinition id=\"volume\">\n"
187 " <unit kind=\"litre\" scale=\"-3\"/>\n"
189 " </unitDefinition>\n"
190 " <unitDefinition id=\"substance\">\n"
192 " <unit kind=\"mole\" scale=\"-3\"/>\n"
194 " </unitDefinition>\n"
195 " </listOfUnitDefinitions>\n"
196 " <listOfCompartments>\n"
197 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
198 " </listOfCompartments>\n"
200 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
201 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
202 " </listOfSpecies>\n"
203 " <listOfParameters>\n"
204 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\" constant=\"false\"/>\n"
205 " <parameter id=\"parameter_2\" name=\"F\" value=\"6.0221415e20\" constant=\"true\"/>\n"
206 " </listOfParameters>\n"
208 " <assignmentRule variable=\"parameter_1\">\n"
209 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
212 " <ci> species_1 </ci>\n"
213 " <ci> parameter_2 </ci>\n"
216 " </assignmentRule>\n"
218 " <listOfReactions>\n"
219 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"false\">\n"
220 " <listOfReactants>\n"
221 " <speciesReference species=\"species_1\"/>\n"
222 " </listOfReactants>\n"
224 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
228 " <ci> species_1 </ci>\n"
231 " <listOfParameters>\n"
232 " <parameter id=\"k1\" value=\"0.1\"/>\n"
233 " </listOfParameters>\n"
236 " <reaction id=\"reaction_2\" name=\"reaction_1\" reversible=\"false\">\n"
237 " <listOfReactants>\n"
238 " <speciesReference species=\"species_1\"/>\n"
239 " </listOfReactants>\n"
240 " <listOfProducts>\n"
241 " <speciesReference species=\"species_2\"/>\n"
242 " </listOfProducts>\n"
244 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
247 " <ci> compartment_1 </ci>\n"
249 " <ci> function_1 </ci>\n"
252 " <ci> species_1 </ci>\n"
253 " <ci> compartment_1 </ci>\n"
260 " <listOfParameters>\n"
261 " <parameter id=\"Km\" value=\"0.1\"/>\n"
262 " <parameter id=\"V\" value=\"0.1\"/>\n"
263 " </listOfParameters>\n"
266 " </listOfReactions>\n"
const CExpression * getExpressionPtr() const
Header file of class CExpression.
size_t getCompartmentNumber() const
Header file of class CModelEntity and CModelValue.
static CCopasiDataModel * pCOPASIDATAMODEL
const std::string & getObjectName() const
virtual size_t size() const
const CRegisteredObjectName & getObjectCN() const
void test_hasOnlySubstanceUnits()
const CCopasiVector< CChemEqElement > & getProducts() const
static const char * MODEL_STRING
const CCopasiVector< CChemEqElement > & getSubstrates() const
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)
const CModelEntity::Status & getStatus() const
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
CCopasiContainer * getObjectParent() const