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 const CExpression* pExpr = pModelValue->getExpressionPtr();
76 CPPUNIT_ASSERT(pNode != NULL);
78 CPPUNIT_ASSERT(pObjectNode != NULL);
80 CPPUNIT_ASSERT(!objectCN.empty());
81 std::vector<CCopasiContainer*> listOfContainers;
82 listOfContainers.push_back(pModel);
84 CPPUNIT_ASSERT(pObject != NULL);
86 CPPUNIT_ASSERT(pObject->
getObjectName() == std::string(
"Concentration"));
89 CPPUNIT_ASSERT(pModel->getReactions().size() == 2);
90 const CReaction* pReaction1 = pModel->getReactions()[0];
91 CPPUNIT_ASSERT(pReaction1 != NULL);
92 CPPUNIT_ASSERT(pReaction1->isReversible() ==
false);
94 const CFunction* pKineticFunction = pReaction1->getFunction();
95 CPPUNIT_ASSERT(pKineticFunction != NULL);
97 CPPUNIT_ASSERT(pMassAction != NULL);
98 const CChemEq* pChemEq = &pReaction1->getChemEq();
99 CPPUNIT_ASSERT(pChemEq != NULL);
103 CPPUNIT_ASSERT(pElement != NULL);
104 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
105 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
109 const CReaction* pReaction2 = pModel->getReactions()[1];
110 CPPUNIT_ASSERT(pReaction2 != NULL);
111 CPPUNIT_ASSERT(pReaction2->isReversible() ==
false);
113 pKineticFunction = pReaction2->getFunction();
114 CPPUNIT_ASSERT(pKineticFunction != NULL);
115 CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string(
"Henri-Michaelis-Menten (irreversible)"));
117 pChemEq = &pReaction2->getChemEq();
118 CPPUNIT_ASSERT(pChemEq != NULL);
119 CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
120 CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
121 pElement = pChemEq->getSubstrates()[0];
122 CPPUNIT_ASSERT(pElement != NULL);
123 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
124 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
125 CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
126 pElement = pChemEq->getProducts()[0];
127 CPPUNIT_ASSERT(pElement != NULL);
128 CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
129 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
130 CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
131 const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
132 CPPUNIT_ASSERT(parameterMappings.size() == 3);
133 CPPUNIT_ASSERT(parameterMappings[0].size() == 1);
134 const std::string parameterKey = parameterMappings[0][0];
135 CPPUNIT_ASSERT(parameterKey == pA->getKey());
139 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
140 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">"
141 " <model id=\"Model_1\" name=\"New Model\">"
143 " <body xmlns=\"http://www.w3.org/1999/xhtml\">"
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 assignment ruile for the global parameter that contains a reference to species A.</p>"
145 " <p>The imported model should contain an assignment for the global parameter that consists of the reference to species A. The species references in the reactions should be imported unmodified.</p>"
148 " <listOfFunctionDefinitions>"
149 " <functionDefinition id=\"function_1\" name=\"Henri-Michaelis-Menten (irreversible)\">"
150 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
153 " <ci> substrate </ci>"
166 " <ci> substrate </ci>"
171 " <ci> substrate </ci>"
176 " </functionDefinition>"
177 " </listOfFunctionDefinitions>"
178 " <listOfUnitDefinitions>"
179 " <unitDefinition id=\"volume\">"
181 " <unit kind=\"litre\" scale=\"-3\"/>"
184 " <unitDefinition id=\"substance\">"
186 " <unit kind=\"mole\" scale=\"-3\"/>"
189 " </listOfUnitDefinitions>"
190 " <listOfCompartments>"
191 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>"
192 " </listOfCompartments>"
194 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\"/>"
195 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialConcentration=\"1\"/>"
197 " <listOfParameters>"
198 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\" constant=\"false\"/>"
199 " </listOfParameters>"
201 " <assignmentRule variable=\"parameter_1\">"
202 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
203 " <ci> species_1 </ci>"
208 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"false\">"
210 " <speciesReference species=\"species_1\"/>"
211 " </listOfReactants>"
213 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
216 " <ci> compartment_1 </ci>"
218 " <ci> species_1 </ci>"
221 " <listOfParameters>"
222 " <parameter id=\"k1\" value=\"0.1\"/>"
223 " </listOfParameters>"
226 " <reaction id=\"reaction_2\" name=\"reaction_1\" reversible=\"false\">"
228 " <speciesReference species=\"species_1\"/>"
229 " </listOfReactants>"
231 " <speciesReference species=\"species_2\"/>"
234 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
237 " <ci> compartment_1 </ci>"
239 " <ci> function_1 </ci>"
240 " <ci> species_1 </ci>"
246 " <listOfParameters>"
247 " <parameter id=\"Km\" value=\"0.1\"/>"
248 " <parameter id=\"V\" value=\"0.1\"/>"
249 " </listOfParameters>"
252 " </listOfReactions>"
Header file of class CExpression.
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
const CCopasiVector< CChemEqElement > & getProducts() const
static CCopasiDataModel * pCOPASIDATAMODEL
void test_hasOnlySubstanceUnits()
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)
static const char * MODEL_STRING
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
CCopasiContainer * getObjectParent() const