COPASI API  4.16.103
test000090.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/sbml/unittests/test000090.cpp,v $
3 // $Revision: 1.2 $
4 // $Name: $
5 // $Author: gauges $
6 // $Date: 2010/03/11 11:55:16 $
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 #include "test000090.h"
15 
16 #include <sstream>
17 #include "utilities.hpp"
19 #include "copasi/model/CModel.h"
20 #include "copasi/model/CMetab.h"
23 #include "copasi/model/CReaction.h"
26 
28 
29 CCopasiDataModel* test000090::pCOPASIDATAMODEL = NULL;
30 
32 {
33  // Create the root container.
34  CCopasiRootContainer::init(0, NULL, false);
35  // Create the global data model.
37 }
38 
40 {
42 }
43 
45 {
46  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
47 
48  try
49  {
51  }
52  catch (...)
53  {
55  CPPUNIT_ASSERT(message.getType() == CCopasiMessage::EXCEPTION);
56  std::string s = message.getText();
57  CPPUNIT_ASSERT(!s.empty());
58  CPPUNIT_ASSERT(s.find(std::string("Call to delay function used in function definition")) != std::string::npos);
59  return;
60  }
61 
62  // we should never get here
63  CPPUNIT_ASSERT(false);
64 }
65 
66 const char* test000090::MODEL_STRING =
67  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
68  "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version3\" level=\"2\" version=\"3\">\n"
69  " <model id=\"Model_1\" name=\"New Model\">\n"
70  " <notes>\n"
71  " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
72  " <p>Model with a delay call in a function definition. This should lead to an exception and the model should not be imported.</p>\n"
73  " </body>\n"
74  " </notes>\n"
75  " <listOfFunctionDefinitions>"
76  " <functionDefinition id=\"function_1\" name=\"function with delay\">"
77  " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
78  " <lambda>"
79  " <bvar>"
80  " <ci> t </ci>"
81  " </bvar>"
82  " <apply>\n"
83  " <csymbol encoding=\"text\" definitionURL=\"http://www.sbml.org/sbml/symbols/delay\">\n"
84  " delay\n"
85  " </csymbol>\n"
86  " <ci> t </ci>\n"
87  " <cn> 0.5 </cn>\n"
88  " </apply>\n"
89  " </lambda>"
90  " </math>"
91  " </functionDefinition>"
92  " </listOfFunctionDefinitions>"
93  " <listOfUnitDefinitions>\n"
94  " <unitDefinition id=\"volume\">\n"
95  " <listOfUnits>\n"
96  " <unit kind=\"litre\" scale=\"-3\"/>\n"
97  " </listOfUnits>\n"
98  " </unitDefinition>\n"
99  " <unitDefinition id=\"substance\">\n"
100  " <listOfUnits>\n"
101  " <unit kind=\"mole\" scale=\"-3\"/>\n"
102  " </listOfUnits>\n"
103  " </unitDefinition>\n"
104  " </listOfUnitDefinitions>\n"
105  " <listOfParameters>\n"
106  " <parameter id=\"parameter_1\" name=\"K1\" value=\"4\"/>\n"
107  " <parameter id=\"parameter_2\" name=\"K2\" value=\"5\"/>\n"
108  " </listOfParameters>\n"
109  " <listOfRules>\n"
110  " <assignmentRule variable=\"parameter_1\">\n"
111  " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
112  " <apply>\n"
113  " <ci> function_1 </ci>"
114  " <ci> parameter_2 </ci>"
115  " </apply>\n"
116  " </math>\n"
117  " </assignmentRule>\n"
118  " </listOfRules>\n"
119  " </model>\n"
120  "</sbml>\n"
121  ;
Header file of class CExpression.
Header file of class CModelEntity and CModelValue.
const std::string & getText() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000090.h:32
const CCopasiMessage::Type & getType() const
void setUp()
Definition: test000090.cpp:31
void tearDown()
Definition: test000090.cpp:39
static const char * MODEL_STRING
Definition: test000090.h:31
static CCopasiDataModel * addDatamodel()
void test_delay_in_function()
Definition: test000090.cpp:44
static CCopasiMessage getLastMessage()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static void init(int argc, char *argv[], const bool &withGui=false)