14 #include "utilities.hpp"
46 CPPUNIT_ASSERT(pModel != NULL);
47 CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() ==
CModel::mMol);
48 CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() ==
CModel::ml);
49 CPPUNIT_ASSERT(pModel->getTimeUnitEnum() ==
CModel::s);
50 CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
51 const CCompartment* pCompartment = pModel->getCompartments()[0];
52 CPPUNIT_ASSERT(pCompartment != NULL);
54 CPPUNIT_ASSERT(pModel->getMetabolites().size() == 2);
55 CMetab* pA = pModel->getMetabolites()[0];
56 CPPUNIT_ASSERT(pA != NULL);
58 const CMetab* pB = pModel->getMetabolites()[1];
59 CPPUNIT_ASSERT(pB != NULL);
61 CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
62 const CModelValue* pModelValue = pModel->getModelValues()[0];
63 CPPUNIT_ASSERT(pModelValue != NULL);
66 CPPUNIT_ASSERT(pModel->getReactions().size() == 1);
67 const CReaction* pReaction1 = pModel->getReactions()[0];
68 CPPUNIT_ASSERT(pReaction1 != NULL);
69 CPPUNIT_ASSERT(pReaction1->isReversible() ==
true);
71 const CFunction* pKineticFunction = pReaction1->getFunction();
72 CPPUNIT_ASSERT(pKineticFunction != NULL);
74 CPPUNIT_ASSERT(pMassAction != NULL);
75 const CChemEq* pChemEq = &pReaction1->getChemEq();
76 CPPUNIT_ASSERT(pChemEq != NULL);
80 CPPUNIT_ASSERT(pElement != NULL);
81 CPPUNIT_ASSERT(fabs((pElement->getMultiplicity() - 3.0) / 3.0) < 1e-3);
82 CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
85 CPPUNIT_ASSERT(pElement != NULL);
86 CPPUNIT_ASSERT(fabs((pElement->getMultiplicity() - 1.3) / 1.3) < 1e-3);
87 CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
92 std::string s = message.getText();
93 CPPUNIT_ASSERT(!s.empty());
94 CPPUNIT_ASSERT(s.find(std::string(
"One or more stoichiometric expressions were evaluated and converted to constants values.")) != std::string::npos);
100 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
101 "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
102 " <model id=\"Model_1\" name=\"New Model\">\n"
104 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
105 " <p>Model with fixed compartment volume, two species with hasOnlySubstanceUnits flag set to false. The units are set to ml and item. There is a stoichiometric expression for the only species in the only reaction. The expression consists of the number 2.0</p>\n"
106 " <p>The substrate of the reaction in the imported model should have a multiplicity of 2.</p>\n"
109 " <listOfUnitDefinitions>\n"
110 " <unitDefinition id=\"volume\">\n"
112 " <unit kind=\"litre\" scale=\"-3\"/>\n"
114 " </unitDefinition>\n"
115 " <unitDefinition id=\"substance\">\n"
117 " <unit kind=\"mole\" scale=\"-3\"/>\n"
119 " </unitDefinition>\n"
120 " </listOfUnitDefinitions>\n"
121 " <listOfCompartments>\n"
122 " <compartment id=\"compartment_1\" name=\"compartment\" size=\"1\"/>\n"
123 " </listOfCompartments>\n"
125 " <species id=\"species_1\" name=\"A\" compartment=\"compartment_1\" initialConcentration=\"1\"/>\n"
126 " <species id=\"species_2\" name=\"B\" compartment=\"compartment_1\" initialConcentration=\"1\"/>\n"
127 " </listOfSpecies>\n"
128 " <listOfParameters>\n"
129 " <parameter id=\"parameter_1\" name=\"K\" value=\"0\"/>\n"
130 " </listOfParameters>\n"
131 " <listOfReactions>\n"
132 " <reaction id=\"reaction_1\" name=\"reaction_0\" reversible=\"true\">\n"
133 " <listOfReactants>\n"
134 " <speciesReference species=\"species_1\">\n"
135 " <stoichiometryMath>\n"
136 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
143 " </stoichiometryMath>\n"
144 " </speciesReference>\n"
145 " </listOfReactants>\n"
146 " <listOfProducts>\n"
147 " <speciesReference species=\"species_2\">\n"
148 " <stoichiometryMath>\n"
149 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
160 " </stoichiometryMath>\n"
161 " </speciesReference>\n"
162 " </listOfProducts>\n"
164 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
167 " <ci> compartment_1 </ci>\n"
173 " <ci> species_1 </ci>\n"
178 " <ci> species_2 </ci>\n"
183 " <listOfParameters>\n"
184 " <parameter id=\"k1\" value=\"0.1\"/>\n"
185 " <parameter id=\"k2\" value=\"0.1\"/>\n"
186 " </listOfParameters>\n"
189 " </listOfReactions>\n"
Header file of class CExpression.
size_t getCompartmentNumber() const
Header file of class CModelEntity and CModelValue.
virtual size_t size() const
static CCopasiDataModel * pCOPASIDATAMODEL
const CCopasiVector< CChemEqElement > & getProducts() const
const CCopasiVector< CChemEqElement > & getSubstrates() const
static CCopasiDataModel * addDatamodel()
const CCopasiVector< CChemEqElement > & getModifiers() const
static CCopasiMessage getLastMessage()
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)
void test_stoichiometricExpression()
static const char * MODEL_STRING