COPASI API  4.16.103
Public Member Functions | Static Protected Attributes | Private Member Functions | List of all members
test000089 Class Reference

#include <test000089.h>

Inheritance diagram for test000089:
Inheritance graph
[legend]
Collaboration diagram for test000089:
Collaboration graph
[legend]

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug1412 ()
 

Static Protected Attributes

static const char * MODEL_STRING1
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_bug1412)
 
 CPPUNIT_TEST_SUITE (test000089)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 26 of file test000089.h.

Member Function Documentation

test000089::CPPUNIT_TEST ( test_bug1412  )
private
test000089::CPPUNIT_TEST_SUITE ( test000089  )
private
test000089::CPPUNIT_TEST_SUITE_END ( )
private
void test000089::setUp ( )

Definition at line 32 of file test000089.cpp.

References CCopasiRootContainer::addDatamodel(), CCopasiRootContainer::init(), and pCOPASIDATAMODEL.

33 {
34  // Create the root container.
35  CCopasiRootContainer::init(0, NULL, false);
36  // Create the global data model.
38 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000089.h:35
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000089::tearDown ( )

Definition at line 40 of file test000089.cpp.

References CCopasiRootContainer::destroy().

void test000089::test_bug1412 ( )

Definition at line 45 of file test000089.cpp.

References CCopasiDataModel::exportSBMLToString(), CCopasiDataModel::getCurrentSBMLDocument(), CCopasiDataModel::getModel(), load_cps_model_from_stream(), MODEL_STRING1, pCOPASIDATAMODEL, and CCopasiMessage::size().

46 {
47  try
48  {
49  std::istringstream iss(test000089::MODEL_STRING1);
50  bool result = load_cps_model_from_stream(iss, *pCOPASIDATAMODEL);
51  CPPUNIT_ASSERT(result == true);
52  CPPUNIT_ASSERT(pCOPASIDATAMODEL->getModel() != NULL);
53  }
54  catch (...)
55  {
56  // there should be no exception
57  CPPUNIT_ASSERT(false);
58  }
59 
60  try
61  {
62  CPPUNIT_ASSERT(pCOPASIDATAMODEL->exportSBMLToString(NULL, 2, 3).empty() == false);
63  }
64  catch (...)
65  {
66  // there should be no exception
67  CPPUNIT_ASSERT(false);
68  }
69 
70  CPPUNIT_ASSERT(CCopasiMessage::size() == 0);
71  const SBMLDocument* pDocument = pCOPASIDATAMODEL->getCurrentSBMLDocument();
72  CPPUNIT_ASSERT(pDocument != NULL);
73  CPPUNIT_ASSERT(pDocument->getLevel() == 2);
74  CPPUNIT_ASSERT(pDocument->getVersion() == 3);
75  const Model* pModel = pDocument->getModel();
76  CPPUNIT_ASSERT(pModel != NULL);
77  CPPUNIT_ASSERT(pModel->getListOfFunctionDefinitions()->size() == 0);
78  CPPUNIT_ASSERT(pModel->getListOfCompartments()->size() == 1);
79  CPPUNIT_ASSERT(pModel->getListOfSpecies()->size() == 1);
80  CPPUNIT_ASSERT(pModel->getListOfParameters()->size() == 1);
81  CPPUNIT_ASSERT(pModel->getListOfReactions()->size() == 0);
82  CPPUNIT_ASSERT(pModel->getListOfRules()->size() == 1);
83  const Rule* pRule = pModel->getRule(0);
84  CPPUNIT_ASSERT(pRule != NULL);
85  CPPUNIT_ASSERT(pRule->getTypeCode() == SBML_ASSIGNMENT_RULE);
86  const AssignmentRule* pAssignmentRule = dynamic_cast<const AssignmentRule*>(pRule);
87  CPPUNIT_ASSERT(pAssignmentRule != NULL);
88  const Species* pSpecies = pModel->getSpecies(0);
89  CPPUNIT_ASSERT(pSpecies != NULL);
90  CPPUNIT_ASSERT(pSpecies->getName() == "M");
91  const Parameter* pParameter = pModel->getParameter(pAssignmentRule->getVariable());
92  CPPUNIT_ASSERT(pParameter != NULL);
93  CPPUNIT_ASSERT(pParameter->getName() == "MV");
94  const ASTNode* pMath = pAssignmentRule->getMath();
95  CPPUNIT_ASSERT(pMath != NULL);
96  CPPUNIT_ASSERT(pMath->getType() == AST_DIVIDE);
97  CPPUNIT_ASSERT(pMath->getNumChildren() == 2);
98  const ASTNode* pChild = pMath->getChild(0);
99  CPPUNIT_ASSERT(pChild != NULL);
100  CPPUNIT_ASSERT(pChild->getType() == AST_REAL);
101  CPPUNIT_ASSERT(fabs(pChild->getReal() - 1.0) < 1e-6);
102  pChild = pMath->getChild(1);
103  CPPUNIT_ASSERT(pChild != NULL);
104  CPPUNIT_ASSERT(pChild->getType() == AST_NAME);
105  CPPUNIT_ASSERT(pChild->getName() == pSpecies->getId());
106 }
SBMLDocument * getCurrentSBMLDocument()
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
Definition: utilities.cpp:21
static size_t size()
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000089.h:35
static const char * MODEL_STRING1
Definition: test000089.h:36

Member Data Documentation

const char * test000089::MODEL_STRING1
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!-- generated with COPASI 4.5.31 (development) (http://www.copasi.org) at 2010-03-01 08:59:11 UTC -->\n"
"<?oxygen RNGSchema=\"http://www.copasi.org/static/schema/CopasiML.rng\" type=\"xml\"?>\n"
"<COPASI xmlns=\"http://www.copasi.org/static/schema\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"31\">\n"
" <Model key=\"Model_1\" name=\"Model\" simulationType=\"time\" timeUnit=\"s\" volumeUnit=\"l\" areaUnit=\"µm²\" lengthUnit=\"m\" quantityUnit=\"#\" type=\"deterministic\">\n"
" <ListOfCompartments>\n"
" <Compartment key=\"Compartment_1\" name=\"C\" simulationType=\"fixed\" dimensionality=\"3\" />\n"
" </ListOfCompartments> \n"
" <ListOfMetabolites>\n"
" <Metabolite key=\"Metabolite_1\" name=\"M\" simulationType=\"fixed\" compartment=\"Compartment_1\" />\n"
" </ListOfMetabolites>\n"
" <ListOfModelValues>\n"
" <ModelValue key=\"ModelValue_1\" name=\"MV\" simulationType=\"assignment\">\n"
" <Expression>\n"
" 1/&lt;CN=Root,Model=Model,Vector=Compartments[C],Vector=Metabolites[M],Reference=Concentration&gt;\n"
" </Expression>\n"
" </ModelValue>\n"
" </ListOfModelValues>\n"
" <StateTemplate>\n"
" <StateTemplateVariable objectReference=\"Model_1\"/>\n"
" <StateTemplateVariable objectReference=\"ModelValue_1\"/>\n"
" <StateTemplateVariable objectReference=\"Compartment_1\"/>\n"
" <StateTemplateVariable objectReference=\"Metabolite_1\"/>\n"
" </StateTemplate>\n"
" <InitialState type=\"initialState\">\n"
" 0 1 2 3 \n"
" </InitialState>\n"
" </Model>\n"
"</COPASI>\n"

Definition at line 36 of file test000089.h.

Referenced by test_bug1412().

CCopasiDataModel * test000089::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 35 of file test000089.h.

Referenced by setUp(), and test_bug1412().


The documentation for this class was generated from the following files: