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() == 1);
70 const CModelValue* pModelValue = pModel->getModelValues()[0];
71 CPPUNIT_ASSERT(pModelValue != NULL);
73 CPPUNIT_ASSERT(pModelValue->getInitialExpression() !=
"");
74 const CExpression* pExpr = pModelValue->getInitialExpressionPtr();
75 CPPUNIT_ASSERT(pExpr != NULL);
78 CPPUNIT_ASSERT(pNode != NULL);
80 CPPUNIT_ASSERT(pObjectNode != NULL);
82 CPPUNIT_ASSERT(!objectCN.empty());
83 std::vector<CCopasiContainer*> listOfContainers;
84 listOfContainers.push_back(pModel);
86 CPPUNIT_ASSERT(pObject != NULL);
88 CPPUNIT_ASSERT(pObject->
getObjectName() == std::string(
"InitialConcentration"));
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);
98 CPPUNIT_ASSERT(pMassAction != NULL);
99 const CChemEq* pChemEq = &pReaction1->getChemEq();
100 CPPUNIT_ASSERT(pChemEq != NULL);
104 CPPUNIT_ASSERT(pElement != NULL);
105 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
106 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
110 const CReaction* pReaction2 = pModel->getReactions()[1];
111 CPPUNIT_ASSERT(pReaction2 != NULL);
112 CPPUNIT_ASSERT(pReaction2->isReversible() ==
false);
114 pKineticFunction = pReaction2->getFunction();
115 CPPUNIT_ASSERT(pKineticFunction != NULL);
116 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Henri-Michaelis-Menten (irreversible)"));
118 pChemEq = &pReaction2->getChemEq();
119 CPPUNIT_ASSERT(pChemEq != NULL);
120 CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
121 CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
122 pElement = pChemEq->getSubstrates()[0];
123 CPPUNIT_ASSERT(pElement != NULL);
124 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
125 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
126 CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
127 pElement = pChemEq->getProducts()[0];
128 CPPUNIT_ASSERT(pElement != NULL);
129 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
130 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
131 CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
132 const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
133 CPPUNIT_ASSERT(parameterMappings.size() == 3);
134 CPPUNIT_ASSERT(parameterMappings[0].size() == 1);
135 const std::string parameterKey = parameterMappings[0][0];
136 CPPUNIT_ASSERT(parameterKey == pA->getKey());
140 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
141 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
143 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
144 " <p>Model with fixed compartment volume, two species with hasOnlySubstanceUnits flag set to false. The units are set to ml and mMol. There is an initial assignment for the global parameter that contains a reference to species A.</p>\n"
145 " <p>The imported model should contain an initial assignment for the global parameter that consists of the reference to the initial concentration species A. The species references in the reactions should be imported unmodified.</p>\n"
148 " <model id=\"Model_1\" name=\"New Model\">\n"
149 " <listOfFunctionDefinitions>\n"
150 " <functionDefinition id=\"function_1\" name=\"Henri-Michaelis-Menten (irreversible)\">\n"
151 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
154 " <ci> substrate </ci>\n"
167 " <ci> substrate </ci>\n"
172 " <ci> substrate </ci>\n"
177 " </functionDefinition>\n"
178 " </listOfFunctionDefinitions>\n"
179 " <listOfUnitDefinitions>\n"
180 " <unitDefinition id=\"volume\">\n"
182 " <unit kind=\"litre\" scale=\"-3\"/>\n"
184 " </unitDefinition>\n"
185 " <unitDefinition id=\"substance\">\n"
187 " <unit kind=\"mole\" scale=\"-3\"/>\n"
189 " </unitDefinition>\n"
190 " </listOfUnitDefinitions>\n"
191 " <listOfCompartments>\n"
192 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
193 " </listOfCompartments>\n"
195 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\"/>\n"
196 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialConcentration=\"1\"/>\n"
197 " </listOfSpecies>\n"
198 " <listOfParameters>\n"
199 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\" constant=\"true\"/>\n"
200 " </listOfParameters>\n"
201 " <listOfInitialAssignments>\n"
202 " <initialAssignment symbol=\"parameter_1\">\n"
203 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
204 " <ci> species_1 </ci>\n"
206 " </initialAssignment>\n"
207 " </listOfInitialAssignments>\n"
208 " <listOfReactions>\n"
209 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"false\">\n"
210 " <listOfReactants>\n"
211 " <speciesReference species=\"species_1\"/>\n"
212 " </listOfReactants>\n"
214 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
217 " <ci> compartment_1 </ci>\n"
219 " <ci> species_1 </ci>\n"
222 " <listOfParameters>\n"
223 " <parameter id=\"k1\" value=\"0.1\"/>\n"
224 " </listOfParameters>\n"
227 " <reaction id=\"reaction_2\" name=\"reaction_1\" reversible=\"false\">\n"
228 " <listOfReactants>\n"
229 " <speciesReference species=\"species_1\"/>\n"
230 " </listOfReactants>\n"
231 " <listOfProducts>\n"
232 " <speciesReference species=\"species_2\"/>\n"
233 " </listOfProducts>\n"
235 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
238 " <ci> compartment_1 </ci>\n"
240 " <ci> function_1 </ci>\n"
241 " <ci> species_1 </ci>\n"
247 " <listOfParameters>\n"
248 " <parameter id=\"Km\" value=\"0.1\"/>\n"
249 " <parameter id=\"V\" value=\"0.1\"/>\n"
250 " </listOfParameters>\n"
253 " </listOfReactions>\n"
Header file of class CExpression.
size_t getCompartmentNumber() const
Header file of class CModelEntity and CModelValue.
void test_hasOnlySubstanceUnits()
const std::string & getObjectName() const
virtual size_t size() const
const CRegisteredObjectName & getObjectCN() const
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)
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
static CCopasiDataModel * pCOPASIDATAMODEL
CCopasiContainer * getObjectParent() const