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

#include <test000056.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug1005 ()
 

Static Protected Attributes

static const char * MODEL_STRING
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_bug1005)
 
 CPPUNIT_TEST_SUITE (test000056)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000056.h.

Member Function Documentation

test000056::CPPUNIT_TEST ( test_bug1005  )
private
test000056::CPPUNIT_TEST_SUITE ( test000056  )
private
test000056::CPPUNIT_TEST_SUITE_END ( )
private
void test000056::setUp ( )

Definition at line 36 of file test000056.cpp.

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

37 {
38  // Create the root container.
39  CCopasiRootContainer::init(0, NULL, false);
40  // Create the global data model.
42 }
static CCopasiDataModel * addDatamodel()
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000056.h:32
static void init(int argc, char *argv[], const bool &withGui=false)
void test000056::tearDown ( )

Definition at line 44 of file test000056.cpp.

References CCopasiRootContainer::destroy().

void test000056::test_bug1005 ( )

Definition at line 49 of file test000056.cpp.

References CCopasiDataModel::getCurrentSBMLDocument(), CCopasiDataModel::importSBMLFromString(), MODEL_STRING, and pCOPASIDATAMODEL.

50 {
51  // make sure models without compartments don't lead to a crash
52  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
53 
54  try
55  {
56  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000056::MODEL_STRING));
57  }
58  catch (...)
59  {
60  CPPUNIT_ASSERT(false);
61  }
62 
63  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
64 
65  const Model* pSBMLModel = pDocument->getModel();
66 
67  CPPUNIT_ASSERT(pSBMLModel != NULL);
68 
69  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 0);
70 
71  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 0);
72 
73  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 0);
74 
75  CPPUNIT_ASSERT(pSBMLModel->getNumInitialAssignments() == 0);
76 
77  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
78 
79  const Parameter* pParameter1 = pSBMLModel->getParameter(0);
80 
81  CPPUNIT_ASSERT(pParameter1 != NULL);
82 
83  CPPUNIT_ASSERT(pParameter1->getConstant() == true);
84 
85  CPPUNIT_ASSERT(pParameter1->getId() == "parameter_1");
86 
87  CPPUNIT_ASSERT(pParameter1->getName() == "A");
88 
89  CPPUNIT_ASSERT(pParameter1->isSetValue() == true);
90 
91  CPPUNIT_ASSERT(fabs((pParameter1->getValue() - 12.0) / 12.0) < 1e-15);
92 }
SBMLDocument * getCurrentSBMLDocument()
static const char * MODEL_STRING
Definition: test000056.h:31
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000056.h:32

Member Data Documentation

const char * test000056::MODEL_STRING
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">\n"
" <model id=\"Model_1\" name=\"New Model\">\n"
" <listOfUnitDefinitions>\n"
" <unitDefinition id=\"volume\">\n"
" <listOfUnits>\n"
" <unit kind=\"litre\" scale=\"-3\"/>\n"
" </listOfUnits>\n"
" </unitDefinition>\n"
" <unitDefinition id=\"substance\">\n"
" <listOfUnits>\n"
" <unit kind=\"mole\" scale=\"-3\"/>\n"
" </listOfUnits>\n"
" </unitDefinition>\n"
" </listOfUnitDefinitions>\n"
" <listOfParameters>\n"
" <parameter id=\"parameter_1\" name=\"A\" value=\"12\" constant=\"true\"/>\n"
" </listOfParameters>\n"
" </model>\n"
"</sbml>\n"

Definition at line 31 of file test000056.h.

Referenced by test_bug1005().

CCopasiDataModel * test000056::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 32 of file test000056.h.

Referenced by setUp(), and test_bug1005().


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