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

#include <test000048.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug919 ()
 

Static Protected Attributes

static const char * MODEL_STRING
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_bug919)
 
 CPPUNIT_TEST_SUITE (test000048)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000048.h.

Member Function Documentation

test000048::CPPUNIT_TEST ( test_bug919  )
private
test000048::CPPUNIT_TEST_SUITE ( test000048  )
private
test000048::CPPUNIT_TEST_SUITE_END ( )
private
void test000048::setUp ( )

Definition at line 36 of file test000048.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 * pCOPASIDATAMODEL
Definition: test000048.h:32
static CCopasiDataModel * addDatamodel()
static void init(int argc, char *argv[], const bool &withGui=false)
void test000048::tearDown ( )

Definition at line 44 of file test000048.cpp.

References CCopasiRootContainer::destroy().

void test000048::test_bug919 ( )

Definition at line 49 of file test000048.cpp.

References CCopasiDataModel::exportSBMLToString(), CCopasiDataModel::getCurrentSBMLDocument(), CCopasiDataModel::getModel(), load_cps_model_from_stream(), MODEL_STRING, and pCOPASIDATAMODEL.

50 {
51  // load the CPS file
52  // export to SBML
53  // check the resulting SBML model
54  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
55  std::istringstream iss(test000048::MODEL_STRING);
56  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
57  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
58  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 3).empty() == false);
59  SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
60  CPPUNIT_ASSERT(pDocument != NULL);
61  Model* pModel = pDocument->getModel();
62  CPPUNIT_ASSERT(pModel != NULL);
63  // assert that there is only one compartment and
64  // assert the compartment is constant
65  CPPUNIT_ASSERT(pModel->getNumCompartments() == 1);
66  Compartment* pCompartment = pModel->getCompartment(0);
67  CPPUNIT_ASSERT(pCompartment->getConstant() == false);
68  // since the compartment is no constant all species should be
69  // exported with the hasOnlySubstanceUnits flag set to true
70  CPPUNIT_ASSERT(pModel->getNumSpecies() == 2);
71  const Species* pA = pModel->getSpecies(0);
72  CPPUNIT_ASSERT(pA != NULL);
73  CPPUNIT_ASSERT(pA->getHasOnlySubstanceUnits() == true);
74  const Species* pB = pModel->getSpecies(0);
75  CPPUNIT_ASSERT(pB != NULL);
76  CPPUNIT_ASSERT(pB->getHasOnlySubstanceUnits() == true);
77 
78  CPPUNIT_ASSERT(pModel->getNumInitialAssignments() == 1);
79  // check the initial assignment
80  const InitialAssignment* pIA = pModel->getInitialAssignment(0);
81  CPPUNIT_ASSERT(pIA != NULL);
82  CPPUNIT_ASSERT(pIA->getSymbol() == pCompartment->getId());
83  CPPUNIT_ASSERT(pIA->isSetMath() == true);
84  const ASTNode* pNode = pIA->getMath();
85  CPPUNIT_ASSERT(pNode != NULL);
86  // since the quantity unit is set to particle numbers, the expression should
87  // consists of only one node which is a reference to species A
88  CPPUNIT_ASSERT(pNode->getType() == AST_NAME);
89  CPPUNIT_ASSERT(pNode->getName() == pA->getId());
90  CPPUNIT_ASSERT(pModel->getNumRules() == 1);
91  // check the rule
92  const Rule* pRule = pModel->getRule(0);
93  CPPUNIT_ASSERT(pRule != NULL);
94  const RateRule* pRateRule = dynamic_cast<const RateRule*>(pRule);
95  CPPUNIT_ASSERT(pRateRule != NULL);
96  CPPUNIT_ASSERT(pRateRule->getVariable() == pCompartment->getId());
97  CPPUNIT_ASSERT(pRule->isSetMath() == true);
98  pNode = pRateRule->getMath();
99  CPPUNIT_ASSERT(pNode != NULL);
100  CPPUNIT_ASSERT(pNode->getType() == AST_NAME);
101  CPPUNIT_ASSERT(pNode->getName() == pA->getId());
102 }
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 CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000048.h:32
static const char * MODEL_STRING
Definition: test000048.h:31

Member Data Documentation

const char * test000048::MODEL_STRING
staticprotected

Definition at line 31 of file test000048.h.

Referenced by test_bug919().

CCopasiDataModel * test000048::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 32 of file test000048.h.

Referenced by setUp(), and test_bug919().


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