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);
70 const CModelValue* pFactor = pModel->getModelValues()[1];
71 CPPUNIT_ASSERT(pFactor != NULL);
73 CPPUNIT_ASSERT(fabs((pFactor->getInitialValue() - pModel->getQuantity2NumberFactor()) / pModel->getQuantity2NumberFactor()) < 1e-3);
74 const CModelValue* pModelValue = pModel->getModelValues()[0];
75 CPPUNIT_ASSERT(pModelValue != NULL);
80 CPPUNIT_ASSERT(pNode != NULL);
82 CPPUNIT_ASSERT(pOperatorNode != NULL);
85 CPPUNIT_ASSERT(pObjectNode != NULL);
87 CPPUNIT_ASSERT(!objectCN.empty());
88 std::vector<CCopasiContainer*> listOfContainers;
89 listOfContainers.push_back(pModel);
91 CPPUNIT_ASSERT(pObject != NULL);
93 CPPUNIT_ASSERT(pObject->
getObjectName() == std::string(
"ParticleNumber"));
96 CPPUNIT_ASSERT(pObjectNode != NULL);
97 objectCN = pObjectNode->getObjectCN();
98 CPPUNIT_ASSERT(!objectCN.empty());
100 CPPUNIT_ASSERT(pObject != NULL);
101 CPPUNIT_ASSERT(pObject->isReference() ==
true);
102 CPPUNIT_ASSERT(pObject->getObjectName() == std::string(
"Value"));
103 CPPUNIT_ASSERT(pObject->getObjectParent() == pFactor);
105 CPPUNIT_ASSERT(pModel->getReactions().size() == 2);
106 const CReaction* pReaction1 = pModel->getReactions()[0];
107 CPPUNIT_ASSERT(pReaction1 != NULL);
108 CPPUNIT_ASSERT(pReaction1->isReversible() ==
false);
110 const CFunction* pKineticFunction = pReaction1->getFunction();
111 CPPUNIT_ASSERT(pKineticFunction != NULL);
115 CPPUNIT_ASSERT(pMassAction == NULL);
116 const CChemEq* pChemEq = &pReaction1->getChemEq();
117 CPPUNIT_ASSERT(pChemEq != NULL);
121 CPPUNIT_ASSERT(pElement != NULL);
122 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
123 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
127 const CReaction* pReaction2 = pModel->getReactions()[1];
128 CPPUNIT_ASSERT(pReaction2 != NULL);
129 CPPUNIT_ASSERT(pReaction2->isReversible() ==
false);
131 pKineticFunction = pReaction2->getFunction();
132 CPPUNIT_ASSERT(pKineticFunction != NULL);
133 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Henri-Michaelis-Menten (irreversible)"));
135 pChemEq = &pReaction2->getChemEq();
136 CPPUNIT_ASSERT(pChemEq != NULL);
137 CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
138 CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
139 pElement = pChemEq->getSubstrates()[0];
140 CPPUNIT_ASSERT(pElement != NULL);
141 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
142 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
143 CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
144 pElement = pChemEq->getProducts()[0];
145 CPPUNIT_ASSERT(pElement != NULL);
146 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
147 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
148 CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
149 const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
150 CPPUNIT_ASSERT(parameterMappings.size() == 3);
151 CPPUNIT_ASSERT(parameterMappings[0].size() == 1);
152 const std::string parameterKey = parameterMappings[0][0];
153 CPPUNIT_ASSERT(parameterKey == pA->getKey());
157 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
158 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
159 " <model id=\"Model_1\" name=\"New Model\">\n"
161 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
162 " <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 rule for the global parameter that contains a reference to species A.</p>\n"
163 " <p>The imported model should contain an assignment for the global parameter that consists of the reference to the particle number of species A divided by a constant (6.023e20). The species references in the reactions should be imported multiplied by the volume.</p>\n"
166 " <listOfFunctionDefinitions>\n"
167 " <functionDefinition id=\"function_1\" name=\"Henri-Michaelis-Menten (irreversible)\">\n"
168 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
171 " <ci> substrate </ci>\n"
184 " <ci> substrate </ci>\n"
189 " <ci> substrate </ci>\n"
194 " </functionDefinition>\n"
195 " </listOfFunctionDefinitions>\n"
196 " <listOfUnitDefinitions>\n"
197 " <unitDefinition id=\"volume\">\n"
199 " <unit kind=\"litre\" scale=\"-3\"/>\n"
201 " </unitDefinition>\n"
202 " <unitDefinition id=\"substance\">\n"
204 " <unit kind=\"mole\" scale=\"-3\"/>\n"
206 " </unitDefinition>\n"
207 " </listOfUnitDefinitions>\n"
208 " <listOfCompartments>\n"
209 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
210 " </listOfCompartments>\n"
212 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
213 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialAmount=\"1\" hasOnlySubstanceUnits=\"true\"/>\n"
214 " </listOfSpecies>\n"
215 " <listOfParameters>\n"
216 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\" constant=\"false\"/>\n"
217 " </listOfParameters>\n"
219 " <assignmentRule variable=\"parameter_1\">\n"
220 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
221 " <ci> species_1 </ci>\n"
223 " </assignmentRule>\n"
225 " <listOfReactions>\n"
226 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"false\">\n"
227 " <listOfReactants>\n"
228 " <speciesReference species=\"species_1\"/>\n"
229 " </listOfReactants>\n"
231 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
235 " <ci> species_1 </ci>\n"
238 " <listOfParameters>\n"
239 " <parameter id=\"k1\" value=\"0.1\"/>\n"
240 " </listOfParameters>\n"
243 " <reaction id=\"reaction_2\" name=\"reaction_1\" reversible=\"false\">\n"
244 " <listOfReactants>\n"
245 " <speciesReference species=\"species_1\"/>\n"
246 " </listOfReactants>\n"
247 " <listOfProducts>\n"
248 " <speciesReference species=\"species_2\"/>\n"
249 " </listOfProducts>\n"
251 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
254 " <ci> compartment_1 </ci>\n"
256 " <ci> function_1 </ci>\n"
259 " <ci> species_1 </ci>\n"
260 " <ci> compartment_1 </ci>\n"
267 " <listOfParameters>\n"
268 " <parameter id=\"Km\" value=\"0.1\"/>\n"
269 " <parameter id=\"V\" value=\"0.1\"/>\n"
270 " </listOfParameters>\n"
273 " </listOfReactions>\n"
const CExpression * getExpressionPtr() const
Header file of class CExpression.
size_t getCompartmentNumber() const
static const char * MODEL_STRING
Header file of class CModelEntity and CModelValue.
const std::string & getObjectName() const
virtual size_t size() const
const Type & getType() const
const CCopasiVector< CChemEqElement > & getProducts() const
const CCopasiVector< CChemEqElement > & getSubstrates() const
static CCopasiDataModel * addDatamodel()
static Type subType(const Type &type)
const CCopasiVector< CChemEqElement > & getModifiers() const
static CCopasiDataModel * pCOPASIDATAMODEL
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
void test_hasOnlySubstanceUnits()
CCopasiNode< Data > * getChild()
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
CCopasiContainer * getObjectParent() const