COPASI API  4.16.103
test000073.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/sbml/unittests/test000073.cpp,v $
3 // $Revision: 1.5 $
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 "test000073.h"
20 
21 #include <sstream>
22 #include "utilities.hpp"
24 #include "copasi/model/CModel.h"
25 #include "copasi/model/CMetab.h"
27 #include "copasi/model/CReaction.h"
30 
31 #include "sbml/SBMLDocument.h"
32 #include "sbml/Model.h"
33 #include "sbml/Reaction.h"
34 
36 
37 CCopasiDataModel* test000073::pCOPASIDATAMODEL = NULL;
38 
40 {
41  // Create the root container.
42  CCopasiRootContainer::init(0, NULL, false);
43  // Create the global data model.
45 }
46 
48 {
50 }
51 
53 {
54  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
55  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING1));
56  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
57  CPPUNIT_ASSERT(pDataModel->getModel()->getModelValues().size() == 1);
58  const CModelValue* pModelValue = pDataModel->getModel()->getModelValues()[0];
59  CPPUNIT_ASSERT(pModelValue != NULL);
60  CPPUNIT_ASSERT(pModelValue->getSBMLId() == "parameter_1");
61  CPPUNIT_ASSERT(pModelValue->getStatus() == CModelEntity::ASSIGNMENT);
62  std::string formula = pModelValue->getExpression();
63  CPPUNIT_ASSERT(formula == "3.1*4.5");
64 }
65 
66 const char* test000073::MODEL_STRING1 =
67  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
68  "<sbml xmlns=\"http://www.sbml.org/sbml/level1\" level=\"1\" version=\"2\">\n"
69  " <model name=\"Model_1\" >\n"
70  " <notes>\n"
71  " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
72  " <p>Level 1 model with rule on global parameter.</p>\n"
73  " </body>\n"
74  " </notes>\n"
75  " <listOfParameters>\n"
76  " <parameter name=\"parameter_1\" value=\"1.1\" />\n"
77  " </listOfParameters>\n"
78  " <listOfRules>\n"
79  " <parameterRule formula=\"3.1 * 4.5\" name=\"parameter_1\"/>\n"
80  " </listOfRules>\n"
81  " </model>\n"
82  "</sbml>\n"
83  ;
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
virtual size_t size() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000073.h:34
static const char * MODEL_STRING1
Definition: test000073.h:33
static CCopasiDataModel * addDatamodel()
void test_bug1087()
Definition: test000073.cpp:52
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static void init(int argc, char *argv[], const bool &withGui=false)
void tearDown()
Definition: test000073.cpp:47
void setUp()
Definition: test000073.cpp:39