COPASI API  4.16.103
test000076.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/sbml/unittests/test000076.cpp,v $
3 // $Revision: 1.4 $
4 // $Name: $
5 // $Author: gauges $
6 // $Date: 2010/03/11 11:52:00 $
7 // End CVS Header
8 
9 // Copyright (C) 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 #include "test000076.h"
20 
21 #include <sstream>
22 #include <string>
23 #include <vector>
24 #include "utilities.hpp"
27 #include <sbml/SBMLDocument.h>
28 #include <sbml/Model.h>
29 #include <sbml/Compartment.h>
30 #include <sbml/Rule.h>
31 #include <sbml/Reaction.h>
32 #include <sbml/SpeciesReference.h>
33 #include <sbml/Parameter.h>
34 #include <sbml/KineticLaw.h>
35 #include <sbml/InitialAssignment.h>
36 #include <sbml/math/ASTNode.h>
37 
38 // TODO add tests for models with references to local parameters in event
39 // TODO triggers and event assignments
40 
41 CCopasiDataModel* test000076::pCOPASIDATAMODEL = NULL;
42 
43 /**
44  * Test the export of models with references to local parameters in
45  * expressions.
46  */
48 {
49  // Create the root container.
50  CCopasiRootContainer::init(0, NULL, false);
51  // Create the global data model.
53 }
54 
56 {
58 }
59 
61 {
62  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
63  std::istringstream iss(test000076::MODEL_STRING1);
64  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
65  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
66  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
67  CPPUNIT_ASSERT(pDocument == NULL);
68  std::string sbmlString;
69 
70  try
71  {
72  sbmlString = pDataModel->exportSBMLToString(NULL, 2, 1);
73  }
74  catch (...)
75  {
76  // fail if an uncaught exception occurs during export
77  CPPUNIT_ASSERT(false);
78  }
79 
80  CPPUNIT_ASSERT(!sbmlString.empty());
81  // check if the exported SBML model has two parameters
82  pDocument = pDataModel->getCurrentSBMLDocument();
83  CPPUNIT_ASSERT(pDocument != NULL);
84  const Model* pModel = pDocument->getModel();
85  CPPUNIT_ASSERT(pModel != NULL);
86  CPPUNIT_ASSERT(pModel->getListOfParameters()->size() == 2);
87  const Parameter *pP1 = NULL, *pP2 = NULL;
88  pP1 = pModel->getParameter(0);
89  CPPUNIT_ASSERT(pP1 != NULL);
90 
91  if (pP1->getName() != std::string("K"))
92  {
93  pP2 = pP1;
94  pP1 = pModel->getParameter(1);
95  }
96  else
97  {
98  pP2 = pModel->getParameter(1);
99  }
100 
101  CPPUNIT_ASSERT(pP2->getName() == std::string("reaction_k1"));
102  CPPUNIT_ASSERT(pP2->getConstant() == true);
103  CPPUNIT_ASSERT(fabs((pP2->getValue() - 0.1) / 0.1) < 1e-6);
104  CPPUNIT_ASSERT(pP1->getName() == std::string("K"));
105  CPPUNIT_ASSERT(pP1->getConstant() == false);
106  CPPUNIT_ASSERT(fabs((pP1->getValue() - 0.1) / 0.1) < 1e-6);
107  // check there is exactly one rule
108  CPPUNIT_ASSERT(pModel->getListOfRules()->size() == 1);
109  const Rule* pRule = pModel->getRule(0);
110  CPPUNIT_ASSERT(pRule != NULL);
111  const AssignmentRule* pAssignmentRule = dynamic_cast<const AssignmentRule*>(pRule);
112  CPPUNIT_ASSERT(pAssignmentRule != NULL);
113  CPPUNIT_ASSERT(pAssignmentRule->getVariable() == pP1->getId());
114  const ASTNode* pMath = pAssignmentRule->getMath();
115  CPPUNIT_ASSERT(pMath != NULL);
116  CPPUNIT_ASSERT(pMath->getType() == AST_NAME);
117  CPPUNIT_ASSERT(pMath->getName() == std::string(pP2->getId()));
118  // now check the reaction
119  CPPUNIT_ASSERT(pModel->getListOfReactions()->size() == 1);
120  const Reaction* pReaction = pModel->getReaction(0);
121  CPPUNIT_ASSERT(pReaction != NULL);
122  CPPUNIT_ASSERT(pReaction->getListOfReactants()->size() == 1);
123  CPPUNIT_ASSERT(pReaction->getListOfProducts()->size() == 1);
124  CPPUNIT_ASSERT(pReaction->getListOfModifiers()->size() == 0);
125  const KineticLaw* pKLaw = pReaction->getKineticLaw();
126  CPPUNIT_ASSERT(pKLaw != NULL);
127  CPPUNIT_ASSERT(pKLaw->getListOfParameters()->size() == 0);
128  const SpeciesReference* pSpeciesReference = pReaction->getReactant(0);
129  CPPUNIT_ASSERT(pSpeciesReference != NULL);
130  CPPUNIT_ASSERT(pModel->getListOfCompartments()->size() == 1);
131  const Compartment* pCompartment = pModel->getCompartment(0);
132  CPPUNIT_ASSERT(pCompartment != NULL);
133  pMath = pKLaw->getMath();
134  CPPUNIT_ASSERT(pMath != NULL);
135  // check that the expression is the compartment times the substrate times the
136  // parameter
137  CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
138  std::vector<std::string> ids;
139  CPPUNIT_ASSERT(pMath->getNumChildren() == 2 || pMath->getNumChildren() == 3);
140 
141  if (pMath->getNumChildren() == 3)
142  {
143  CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
144  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
145  CPPUNIT_ASSERT(pMath->getChild(2)->getType() == AST_NAME);
146  ids.push_back(pMath->getChild(0)->getName());
147  ids.push_back(pMath->getChild(1)->getName());
148  ids.push_back(pMath->getChild(2)->getName());
149  }
150  else
151  {
152  if (pMath->getChild(0)->getType() == AST_NAME)
153  {
154  ids.push_back(pMath->getChild(0)->getName());
155  pMath = pMath->getChild(1);
156  }
157  else
158  {
159  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
160  ids.push_back(pMath->getChild(1)->getName());
161  pMath = pMath->getChild(0);
162  }
163 
164  CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
165  CPPUNIT_ASSERT(pMath->getNumChildren() == 2);
166  CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
167  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
168  ids.push_back(pMath->getChild(0)->getName());
169  ids.push_back(pMath->getChild(1)->getName());
170  }
171 
172  CPPUNIT_ASSERT(ids.size() == 3);
173  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pCompartment->getId())) != ids.end());
174  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pP2->getId())) != ids.end());
175  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pSpeciesReference->getSpecies())) != ids.end());
176 }
177 
178 // This test makes sure a reference to a local parameter in an initial
179 // assignment is exported correctly.
181 {
182  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
183  std::istringstream iss(test000076::MODEL_STRING2);
184  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
185  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
186  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
187  CPPUNIT_ASSERT(pDocument == NULL);
188  std::string sbmlString;
189 
190  try
191  {
192  // we need to export to Level 2 Version 3 because of the initial assignment
193  sbmlString = pDataModel->exportSBMLToString(NULL, 2, 3);
194  }
195  catch (...)
196  {
197  // fail if any exception occurs during the export
198  CPPUNIT_ASSERT(false);
199  }
200 
201  CPPUNIT_ASSERT(!sbmlString.empty());
202  // check if the exported SBML model has two parameters
203  pDocument = pDataModel->getCurrentSBMLDocument();
204  CPPUNIT_ASSERT(pDocument != NULL);
205  const Model* pModel = pDocument->getModel();
206  CPPUNIT_ASSERT(pModel != NULL);
207  CPPUNIT_ASSERT(pModel->getListOfParameters()->size() == 2);
208  const Parameter *pP1 = NULL, *pP2 = NULL;
209  pP1 = pModel->getParameter(0);
210  CPPUNIT_ASSERT(pP1 != NULL);
211 
212  if (pP1->getName() != std::string("K"))
213  {
214  pP2 = pP1;
215  pP1 = pModel->getParameter(1);
216  }
217  else
218  {
219  pP2 = pModel->getParameter(1);
220  }
221 
222  CPPUNIT_ASSERT(pP2->getName() == std::string("reaction_k1"));
223  CPPUNIT_ASSERT(pP2->getConstant() == true);
224  CPPUNIT_ASSERT(fabs((pP2->getValue() - 0.1) / 0.1) < 1e-6);
225  CPPUNIT_ASSERT(pP1->getName() == std::string("K"));
226  CPPUNIT_ASSERT(pP1->getConstant() == true);
227  CPPUNIT_ASSERT(fabs((pP1->getValue() - 0.1) / 0.1) < 1e-6);
228  // check there is exactly one initial assignment
229  CPPUNIT_ASSERT(pModel->getListOfInitialAssignments()->size() == 1);
230  const InitialAssignment* pAssignment = pModel->getInitialAssignment(0);
231  CPPUNIT_ASSERT(pAssignment != NULL);
232  CPPUNIT_ASSERT(pAssignment->getSymbol() == pP1->getId());
233  const ASTNode* pMath = pAssignment->getMath();
234  CPPUNIT_ASSERT(pMath != NULL);
235  CPPUNIT_ASSERT(pMath->getType() == AST_NAME);
236  CPPUNIT_ASSERT(pMath->getName() == std::string(pP2->getId()));
237  // now check the reaction
238  CPPUNIT_ASSERT(pModel->getListOfReactions()->size() == 1);
239  const Reaction* pReaction = pModel->getReaction(0);
240  CPPUNIT_ASSERT(pReaction != NULL);
241  CPPUNIT_ASSERT(pReaction->getListOfReactants()->size() == 1);
242  CPPUNIT_ASSERT(pReaction->getListOfProducts()->size() == 1);
243  CPPUNIT_ASSERT(pReaction->getListOfModifiers()->size() == 0);
244  const KineticLaw* pKLaw = pReaction->getKineticLaw();
245  CPPUNIT_ASSERT(pKLaw != NULL);
246  CPPUNIT_ASSERT(pKLaw->getListOfParameters()->size() == 0);
247  const SpeciesReference* pSpeciesReference = pReaction->getReactant(0);
248  CPPUNIT_ASSERT(pSpeciesReference != NULL);
249  CPPUNIT_ASSERT(pModel->getListOfCompartments()->size() == 1);
250  const Compartment* pCompartment = pModel->getCompartment(0);
251  CPPUNIT_ASSERT(pCompartment != NULL);
252  pMath = pKLaw->getMath();
253  CPPUNIT_ASSERT(pMath != NULL);
254  // check that the expression is the compartment times the substrate times the
255  // parameter
256  CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
257  std::vector<std::string> ids;
258  CPPUNIT_ASSERT(pMath->getNumChildren() == 2 || pMath->getNumChildren() == 3);
259 
260  if (pMath->getNumChildren() == 3)
261  {
262  CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
263  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
264  CPPUNIT_ASSERT(pMath->getChild(2)->getType() == AST_NAME);
265  ids.push_back(pMath->getChild(0)->getName());
266  ids.push_back(pMath->getChild(1)->getName());
267  ids.push_back(pMath->getChild(2)->getName());
268  }
269  else
270  {
271  if (pMath->getChild(0)->getType() == AST_NAME)
272  {
273  ids.push_back(pMath->getChild(0)->getName());
274  pMath = pMath->getChild(1);
275  }
276  else
277  {
278  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
279  ids.push_back(pMath->getChild(1)->getName());
280  pMath = pMath->getChild(0);
281  }
282 
283  CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
284  CPPUNIT_ASSERT(pMath->getNumChildren() == 2);
285  CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
286  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
287  ids.push_back(pMath->getChild(0)->getName());
288  ids.push_back(pMath->getChild(1)->getName());
289  }
290 
291  CPPUNIT_ASSERT(ids.size() == 3);
292  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pCompartment->getId())) != ids.end());
293  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pP2->getId())) != ids.end());
294  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pSpeciesReference->getSpecies())) != ids.end());
295 }
296 
297 // This test makes sure that the new feature does not break the
298 // current export of local parameters.
299 // This models does not contain a reference to a local parameter and therefor
300 // the local parameter should stay local during export.
302 {
303  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
304  std::istringstream iss(test000076::MODEL_STRING3);
305  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
306  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
307  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
308  CPPUNIT_ASSERT(pDocument == NULL);
309  std::string sbmlString;
310 
311  try
312  {
313  sbmlString = pDataModel->exportSBMLToString(NULL, 2, 1);
314  }
315  catch (...)
316  {
317  // fail if an uncaught exception occurs during export
318  CPPUNIT_ASSERT(false);
319  }
320 
321  CPPUNIT_ASSERT(!sbmlString.empty());
322  // check if the exported SBML model has two parameters
323  pDocument = pDataModel->getCurrentSBMLDocument();
324  CPPUNIT_ASSERT(pDocument != NULL);
325  const Model* pModel = pDocument->getModel();
326  CPPUNIT_ASSERT(pModel != NULL);
327  CPPUNIT_ASSERT(pModel->getListOfParameters()->size() == 1);
328  const Parameter *pP1 = pModel->getParameter(0);
329  CPPUNIT_ASSERT(pP1 != NULL);
330  CPPUNIT_ASSERT(pP1->getName() == std::string("K"));
331  CPPUNIT_ASSERT(pP1->getConstant() == true);
332  CPPUNIT_ASSERT(fabs((pP1->getValue() - 0.1) / 0.1) < 1e-6);
333  // check there are no rules and no initial assignments
334  CPPUNIT_ASSERT(pModel->getListOfRules()->size() == 0);
335  CPPUNIT_ASSERT(pModel->getListOfInitialAssignments()->size() == 0);
336  // now check the reaction
337  CPPUNIT_ASSERT(pModel->getListOfReactions()->size() == 1);
338  const Reaction* pReaction = pModel->getReaction(0);
339  CPPUNIT_ASSERT(pReaction != NULL);
340  CPPUNIT_ASSERT(pReaction->getListOfReactants()->size() == 1);
341  CPPUNIT_ASSERT(pReaction->getListOfProducts()->size() == 1);
342  CPPUNIT_ASSERT(pReaction->getListOfModifiers()->size() == 0);
343  const KineticLaw* pKLaw = pReaction->getKineticLaw();
344  CPPUNIT_ASSERT(pKLaw != NULL);
345  CPPUNIT_ASSERT(pKLaw->getListOfParameters()->size() == 1);
346  pP1 = pKLaw->getParameter(0);
347  CPPUNIT_ASSERT(pP1 != NULL);
348  CPPUNIT_ASSERT(pP1->getId() == std::string("k1"));
349  const SpeciesReference* pSpeciesReference = pReaction->getReactant(0);
350  CPPUNIT_ASSERT(pSpeciesReference != NULL);
351  CPPUNIT_ASSERT(pModel->getListOfCompartments()->size() == 1);
352  const Compartment* pCompartment = pModel->getCompartment(0);
353  CPPUNIT_ASSERT(pCompartment != NULL);
354  const ASTNode* pMath = pKLaw->getMath();
355  CPPUNIT_ASSERT(pMath != NULL);
356  // check that the expression is the compartment times the substrate times the
357  // local parameter
358  CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
359  std::vector<std::string> ids;
360  CPPUNIT_ASSERT(pMath->getNumChildren() == 2 || pMath->getNumChildren() == 3);
361 
362  if (pMath->getNumChildren() == 3)
363  {
364  CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
365  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
366  CPPUNIT_ASSERT(pMath->getChild(2)->getType() == AST_NAME);
367  ids.push_back(pMath->getChild(0)->getName());
368  ids.push_back(pMath->getChild(1)->getName());
369  ids.push_back(pMath->getChild(2)->getName());
370  }
371  else
372  {
373  if (pMath->getChild(0)->getType() == AST_NAME)
374  {
375  ids.push_back(pMath->getChild(0)->getName());
376  pMath = pMath->getChild(1);
377  }
378  else
379  {
380  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
381  ids.push_back(pMath->getChild(1)->getName());
382  pMath = pMath->getChild(0);
383  }
384 
385  CPPUNIT_ASSERT(pMath->getType() == AST_TIMES);
386  CPPUNIT_ASSERT(pMath->getNumChildren() == 2);
387  CPPUNIT_ASSERT(pMath->getChild(0)->getType() == AST_NAME);
388  CPPUNIT_ASSERT(pMath->getChild(1)->getType() == AST_NAME);
389  ids.push_back(pMath->getChild(0)->getName());
390  ids.push_back(pMath->getChild(1)->getName());
391  }
392 
393  CPPUNIT_ASSERT(ids.size() == 3);
394  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pCompartment->getId())) != ids.end());
395  // make sure the local parameter is multiplied in
396  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pP1->getId())) != ids.end());
397  CPPUNIT_ASSERT(std::find(ids.begin(), ids.end(), std::string(pSpeciesReference->getSpecies())) != ids.end());
398 }
399 
400 const char* test000076::MODEL_STRING1 =
401  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
402  "<!-- generated with COPASI 4.4.29 (Debug) (http://www.copasi.org) at 2009-01-21 10:40:31 UTC -->\n"
403  "<COPASI xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.copasi.org/static/schema.xsd\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"29\">\n"
404  " <ListOfFunctions>\n"
405  " <Function key=\"Function_13\" name=\"Mass action (irreversible)\" type=\"MassAction\" reversible=\"false\">\n"
406  " <Expression>\n"
407  " k1*PRODUCT&lt;substrate_i&gt;\n"
408  " </Expression>\n"
409  " <ListOfParameterDescriptions>\n"
410  " <ParameterDescription key=\"FunctionParameter_81\" name=\"k1\" order=\"0\" role=\"constant\"/>\n"
411  " <ParameterDescription key=\"FunctionParameter_79\" name=\"substrate\" order=\"1\" role=\"substrate\"/>\n"
412  " </ListOfParameterDescriptions>\n"
413  " </Function>\n"
414  " </ListOfFunctions>\n"
415  " <Model key=\"Model_0\" name=\"New Model\" timeUnit=\"s\" volumeUnit=\"ml\" quantityUnit=\"mmol\" type=\"deterministic\">\n"
416  " <Comment>\n"
417  " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
418  " \n"
419  " </body>\n"
420  " </Comment>\n"
421  " <ListOfCompartments>\n"
422  " <Compartment key=\"Compartment_0\" name=\"compartment\" simulationType=\"fixed\">\n"
423  " </Compartment>\n"
424  " </ListOfCompartments>\n"
425  " <ListOfMetabolites>\n"
426  " <Metabolite key=\"Metabolite_0\" name=\"A\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
427  " </Metabolite>\n"
428  " <Metabolite key=\"Metabolite_1\" name=\"B\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
429  " </Metabolite>\n"
430  " </ListOfMetabolites>\n"
431  " <ListOfModelValues>\n"
432  " <ModelValue key=\"ModelValue_0\" name=\"K\" simulationType=\"assignment\">\n"
433  " <Expression>\n"
434  " &lt;CN=Root,Model=New Model,Vector=Reactions[reaction],ParameterGroup=Parameters,Parameter=k1,Reference=Value&gt;\n"
435  " </Expression>\n"
436  " </ModelValue>\n"
437  " </ListOfModelValues>\n"
438  " <ListOfReactions>\n"
439  " <Reaction key=\"Reaction_0\" name=\"reaction\" reversible=\"false\">\n"
440  " <ListOfSubstrates>\n"
441  " <Substrate metabolite=\"Metabolite_0\" stoichiometry=\"1\"/>\n"
442  " </ListOfSubstrates>\n"
443  " <ListOfProducts>\n"
444  " <Product metabolite=\"Metabolite_1\" stoichiometry=\"1\"/>\n"
445  " </ListOfProducts>\n"
446  " <ListOfConstants>\n"
447  " <Constant key=\"Parameter_78\" name=\"k1\" value=\"0.1\"/>\n"
448  " </ListOfConstants>\n"
449  " <KineticLaw function=\"Function_13\">\n"
450  " <ListOfCallParameters>\n"
451  " <CallParameter functionParameter=\"FunctionParameter_81\">\n"
452  " <SourceParameter reference=\"Parameter_78\"/>\n"
453  " </CallParameter>\n"
454  " <CallParameter functionParameter=\"FunctionParameter_79\">\n"
455  " <SourceParameter reference=\"Metabolite_0\"/>\n"
456  " </CallParameter>\n"
457  " </ListOfCallParameters>\n"
458  " </KineticLaw>\n"
459  " </Reaction>\n"
460  " </ListOfReactions>\n"
461  " <StateTemplate>\n"
462  " <StateTemplateVariable objectReference=\"Model_0\"/>\n"
463  " <StateTemplateVariable objectReference=\"Metabolite_0\"/>\n"
464  " <StateTemplateVariable objectReference=\"Metabolite_1\"/>\n"
465  " <StateTemplateVariable objectReference=\"ModelValue_0\"/>\n"
466  " <StateTemplateVariable objectReference=\"Compartment_0\"/>\n"
467  " </StateTemplate>\n"
468  " <InitialState type=\"initialState\">\n"
469  " 0 6.022141500000001e+19 6.022141500000001e+19 0.1 1\n"
470  " </InitialState>\n"
471  " </Model>\n"
472  "</COPASI>\n";
473 
474 const char* test000076::MODEL_STRING2 =
475  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
476  "<!-- generated with COPASI 4.4.29 (Debug) (http://www.copasi.org) at 2009-01-21 19:47:46 UTC -->\n"
477  "<COPASI xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.copasi.org/static/schema.xsd\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"29\">\n"
478  " <ListOfFunctions>\n"
479  " <Function key=\"Function_13\" name=\"Mass action (irreversible)\" type=\"MassAction\" reversible=\"false\">\n"
480  " <Expression>\n"
481  " k1*PRODUCT&lt;substrate_i&gt;\n"
482  " </Expression>\n"
483  " <ListOfParameterDescriptions>\n"
484  " <ParameterDescription key=\"FunctionParameter_81\" name=\"k1\" order=\"0\" role=\"constant\"/>\n"
485  " <ParameterDescription key=\"FunctionParameter_79\" name=\"substrate\" order=\"1\" role=\"substrate\"/>\n"
486  " </ListOfParameterDescriptions>\n"
487  " </Function>\n"
488  " </ListOfFunctions>\n"
489  " <Model key=\"Model_1\" name=\"New Model\" timeUnit=\"s\" volumeUnit=\"ml\" quantityUnit=\"mmol\" type=\"deterministic\">\n"
490  " <Comment>\n"
491  " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
492  " \n"
493  " </body>\n"
494  " </Comment>\n"
495  " <ListOfCompartments>\n"
496  " <Compartment key=\"Compartment_0\" name=\"compartment\" simulationType=\"fixed\">\n"
497  " </Compartment>\n"
498  " </ListOfCompartments>\n"
499  " <ListOfMetabolites>\n"
500  " <Metabolite key=\"Metabolite_0\" name=\"A\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
501  " </Metabolite>\n"
502  " <Metabolite key=\"Metabolite_1\" name=\"B\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
503  " </Metabolite>\n"
504  " </ListOfMetabolites>\n"
505  " <ListOfModelValues>\n"
506  " <ModelValue key=\"ModelValue_0\" name=\"K\" simulationType=\"fixed\">\n"
507  " <InitialExpression>\n"
508  " &lt;CN=Root,Model=New Model,Vector=Reactions[reaction],ParameterGroup=Parameters,Parameter=k1,Reference=Value&gt;\n"
509  " </InitialExpression>\n"
510  " </ModelValue>\n"
511  " </ListOfModelValues>\n"
512  " <ListOfReactions>\n"
513  " <Reaction key=\"Reaction_0\" name=\"reaction\" reversible=\"false\">\n"
514  " <ListOfSubstrates>\n"
515  " <Substrate metabolite=\"Metabolite_0\" stoichiometry=\"1\"/>\n"
516  " </ListOfSubstrates>\n"
517  " <ListOfProducts>\n"
518  " <Product metabolite=\"Metabolite_1\" stoichiometry=\"1\"/>\n"
519  " </ListOfProducts>\n"
520  " <ListOfConstants>\n"
521  " <Constant key=\"Parameter_81\" name=\"k1\" value=\"0.1\"/>\n"
522  " </ListOfConstants>\n"
523  " <KineticLaw function=\"Function_13\">\n"
524  " <ListOfCallParameters>\n"
525  " <CallParameter functionParameter=\"FunctionParameter_81\">\n"
526  " <SourceParameter reference=\"Parameter_81\"/>\n"
527  " </CallParameter>\n"
528  " <CallParameter functionParameter=\"FunctionParameter_79\">\n"
529  " <SourceParameter reference=\"Metabolite_0\"/>\n"
530  " </CallParameter>\n"
531  " </ListOfCallParameters>\n"
532  " </KineticLaw>\n"
533  " </Reaction>\n"
534  " </ListOfReactions>\n"
535  " <StateTemplate>\n"
536  " <StateTemplateVariable objectReference=\"Model_1\"/>\n"
537  " <StateTemplateVariable objectReference=\"Metabolite_0\"/>\n"
538  " <StateTemplateVariable objectReference=\"Metabolite_1\"/>\n"
539  " <StateTemplateVariable objectReference=\"ModelValue_0\"/>\n"
540  " <StateTemplateVariable objectReference=\"Compartment_0\"/>\n"
541  " </StateTemplate>\n"
542  " <InitialState type=\"initialState\">\n"
543  " 0 6.022141500000001e+19 6.022141500000001e+19 0.1 1\n"
544  " </InitialState>\n"
545  " </Model>\n"
546  "</COPASI>\n";
547 
548 const char* test000076::MODEL_STRING3 =
549  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
550  "<!-- generated with COPASI 4.4.29 (Debug) (http://www.copasi.org) at 2009-01-21 19:51:24 UTC -->\n"
551  "<COPASI xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.copasi.org/static/schema.xsd\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"29\">\n"
552  " <ListOfFunctions>\n"
553  " <Function key=\"Function_13\" name=\"Mass action (irreversible)\" type=\"MassAction\" reversible=\"false\">\n"
554  " <Expression>\n"
555  " k1*PRODUCT&lt;substrate_i&gt;\n"
556  " </Expression>\n"
557  " <ListOfParameterDescriptions>\n"
558  " <ParameterDescription key=\"FunctionParameter_81\" name=\"k1\" order=\"0\" role=\"constant\"/>\n"
559  " <ParameterDescription key=\"FunctionParameter_79\" name=\"substrate\" order=\"1\" role=\"substrate\"/>\n"
560  " </ListOfParameterDescriptions>\n"
561  " </Function>\n"
562  " </ListOfFunctions>\n"
563  " <Model key=\"Model_1\" name=\"New Model\" timeUnit=\"s\" volumeUnit=\"ml\" quantityUnit=\"mmol\" type=\"deterministic\">\n"
564  " <Comment>\n"
565  " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
566  " \n"
567  " </body>\n"
568  " </Comment>\n"
569  " <ListOfCompartments>\n"
570  " <Compartment key=\"Compartment_0\" name=\"compartment\" simulationType=\"fixed\">\n"
571  " </Compartment>\n"
572  " </ListOfCompartments>\n"
573  " <ListOfMetabolites>\n"
574  " <Metabolite key=\"Metabolite_0\" name=\"A\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
575  " </Metabolite>\n"
576  " <Metabolite key=\"Metabolite_1\" name=\"B\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
577  " </Metabolite>\n"
578  " </ListOfMetabolites>\n"
579  " <ListOfModelValues>\n"
580  " <ModelValue key=\"ModelValue_0\" name=\"K\" simulationType=\"fixed\">\n"
581  " </ModelValue>\n"
582  " </ListOfModelValues>\n"
583  " <ListOfReactions>\n"
584  " <Reaction key=\"Reaction_0\" name=\"reaction\" reversible=\"false\">\n"
585  " <ListOfSubstrates>\n"
586  " <Substrate metabolite=\"Metabolite_0\" stoichiometry=\"1\"/>\n"
587  " </ListOfSubstrates>\n"
588  " <ListOfProducts>\n"
589  " <Product metabolite=\"Metabolite_1\" stoichiometry=\"1\"/>\n"
590  " </ListOfProducts>\n"
591  " <ListOfConstants>\n"
592  " <Constant key=\"Parameter_81\" name=\"k1\" value=\"0.1\"/>\n"
593  " </ListOfConstants>\n"
594  " <KineticLaw function=\"Function_13\">\n"
595  " <ListOfCallParameters>\n"
596  " <CallParameter functionParameter=\"FunctionParameter_81\">\n"
597  " <SourceParameter reference=\"Parameter_81\"/>\n"
598  " </CallParameter>\n"
599  " <CallParameter functionParameter=\"FunctionParameter_79\">\n"
600  " <SourceParameter reference=\"Metabolite_0\"/>\n"
601  " </CallParameter>\n"
602  " </ListOfCallParameters>\n"
603  " </KineticLaw>\n"
604  " </Reaction>\n"
605  " </ListOfReactions>\n"
606  " <StateTemplate>\n"
607  " <StateTemplateVariable objectReference=\"Model_1\"/>\n"
608  " <StateTemplateVariable objectReference=\"Metabolite_0\"/>\n"
609  " <StateTemplateVariable objectReference=\"Metabolite_1\"/>\n"
610  " <StateTemplateVariable objectReference=\"ModelValue_0\"/>\n"
611  " <StateTemplateVariable objectReference=\"Compartment_0\"/>\n"
612  " </StateTemplate>\n"
613  " <InitialState type=\"initialState\">\n"
614  " 0 6.022141500000001e+19 6.022141500000001e+19 0.1 1\n"
615  " </InitialState>\n"
616  " </Model>\n"
617  "</COPASI>\n";
SBMLDocument * getCurrentSBMLDocument()
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
void test_bug1035_1()
Definition: test000076.cpp:60
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
Definition: utilities.cpp:21
void test_bug1035_3()
Definition: test000076.cpp:301
void test_bug1035_2()
Definition: test000076.cpp:180
static const char * MODEL_STRING3
Definition: test000076.h:39
static const char * MODEL_STRING1
Definition: test000076.h:37
static CCopasiDataModel * addDatamodel()
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000076.h:36
static void init(int argc, char *argv[], const bool &withGui=false)
void setUp()
Definition: test000076.cpp:47
void tearDown()
Definition: test000076.cpp:55
static const char * MODEL_STRING2
Definition: test000076.h:38