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

#include <test000088.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_import_assignment_without_expression ()
 
void test_import_eventassignment_without_expression ()
 
void test_import_initialassignment_without_expression ()
 

Static Protected Attributes

static const char * MODEL_STRING1
 
static const char * MODEL_STRING2
 
static const char * MODEL_STRING3
 
static CCopasiDataModelpCOPASIDATAMODEL = NULL
 

Private Member Functions

 CPPUNIT_TEST (test_import_assignment_without_expression)
 
 CPPUNIT_TEST (test_import_initialassignment_without_expression)
 
 CPPUNIT_TEST (test_import_eventassignment_without_expression)
 
 CPPUNIT_TEST_SUITE (test000088)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 24 of file test000088.h.

Member Function Documentation

test000088::CPPUNIT_TEST ( test_import_assignment_without_expression  )
private
test000088::CPPUNIT_TEST ( test_import_initialassignment_without_expression  )
private
test000088::CPPUNIT_TEST ( test_import_eventassignment_without_expression  )
private
test000088::CPPUNIT_TEST_SUITE ( test000088  )
private
test000088::CPPUNIT_TEST_SUITE_END ( )
private
void test000088::setUp ( )

Definition at line 28 of file test000088.cpp.

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

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

Definition at line 36 of file test000088.cpp.

References CCopasiRootContainer::destroy().

void test000088::test_import_assignment_without_expression ( )

Definition at line 41 of file test000088.cpp.

References CCopasiMessage::getLastMessage(), CCopasiDataModel::getModel(), CModel::getModelValues(), CCopasiMessage::getNumber(), CCopasiDataModel::importSBMLFromString(), MCSBML, MODEL_STRING1, pCOPASIDATAMODEL, CCopasiMessage::size(), and CCopasiVector< T >::size().

42 {
44  // check if we have the correct warning message on the stack
45  // there should be a warning (MCSBML + 58)
46  unsigned int i, iMax = CCopasiMessage::size();
47  CCopasiMessage message;
48  bool found58 = false;
49 
50  for (i = 0; i < iMax; ++i)
51  {
53 
54  if (message.getNumber() == MCSBML + 58)
55  {
56  found58 = true;
57  break;
58  }
59  }
60 
61  CPPUNIT_ASSERT(found58 == true);
62  // check if the model contains one parameter and that this parameter does not
63  // have an expression
64  const CModel* pModel = pCOPASIDATAMODEL->getModel();
65  CPPUNIT_ASSERT(pModel != NULL);
66  CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
67  const CModelValue* pMV = pModel->getModelValues()[0];
68  CPPUNIT_ASSERT(pMV != NULL);
69  CPPUNIT_ASSERT(pMV->getExpression().empty());
70 }
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
virtual size_t size() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000088.h:35
static const char * MODEL_STRING1
Definition: test000088.h:36
const size_t & getNumber() const
#define MCSBML
static size_t size()
static CCopasiMessage getLastMessage()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
Definition: CModel.h:50
void test000088::test_import_eventassignment_without_expression ( )

Definition at line 106 of file test000088.cpp.

References CModel::getEvents(), CCopasiMessage::getLastMessage(), CCopasiDataModel::getModel(), CModel::getModelValues(), CCopasiMessage::getNumber(), CCopasiDataModel::importSBMLFromString(), MCSBML, MODEL_STRING3, pCOPASIDATAMODEL, CCopasiMessage::size(), and CCopasiVector< T >::size().

107 {
109  // check if we have the correct warning message on the stack
110  // there should be a warning (MCSBML + 58)
111  unsigned int i, iMax = CCopasiMessage::size();
112  CCopasiMessage message;
113  bool found58 = false;
114 
115  for (i = 0; i < iMax; ++i)
116  {
117  message = CCopasiMessage::getLastMessage();
118 
119  if (message.getNumber() == MCSBML + 58)
120  {
121  found58 = true;
122  break;
123  }
124  }
125 
126  CPPUNIT_ASSERT(found58 == true);
127  // check if the model contains one parameter and that this parameter does not
128  // have an expression
129  const CModel* pModel = pCOPASIDATAMODEL->getModel();
130  CPPUNIT_ASSERT(pModel != NULL);
131  CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
132  const CModelValue* pMV = pModel->getModelValues()[0];
133  CPPUNIT_ASSERT(pMV != NULL);
134  // since the parameter does not set an initial value, it's value should be 1
135  CPPUNIT_ASSERT(fabs(pMV->getInitialValue() - 1.0) < 1e-6);
136 
137  // check if there is one event and that this event does not have an event
138  // assignment
139  CPPUNIT_ASSERT(pModel->getEvents().size() == 1);
140  const CEvent* pEvent = pModel->getEvents()[0];
141  CPPUNIT_ASSERT(pEvent != NULL);
142  CPPUNIT_ASSERT(pEvent->getAssignments().size() == 0);
143 }
Definition: CEvent.h:152
CCopasiVectorN< CEvent > & getEvents()
Definition: CModel.cpp:1110
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
virtual size_t size() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000088.h:35
const size_t & getNumber() const
#define MCSBML
static size_t size()
static CCopasiMessage getLastMessage()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
Definition: CModel.h:50
static const char * MODEL_STRING3
Definition: test000088.h:38
void test000088::test_import_initialassignment_without_expression ( )

Definition at line 72 of file test000088.cpp.

References CCopasiMessage::getLastMessage(), CCopasiDataModel::getModel(), CModel::getModelValues(), CCopasiMessage::getNumber(), CCopasiDataModel::importSBMLFromString(), MCSBML, MODEL_STRING2, pCOPASIDATAMODEL, CCopasiMessage::size(), and CCopasiVector< T >::size().

73 {
75  CPPUNIT_ASSERT(result == true);
76  // check if we have the correct warning message on the stack
77  // there should be a warning (MCSBML + 58)
78  unsigned int i, iMax = CCopasiMessage::size();
79  CCopasiMessage message;
80  bool found58 = false;
81 
82  for (i = 0; i < iMax; ++i)
83  {
85 
86  if (message.getNumber() == MCSBML + 58)
87  {
88  found58 = true;
89  break;
90  }
91  }
92 
93  CPPUNIT_ASSERT(found58 == true);
94  // check if the model contains one parameter and that this parameter does not
95  // have an expression
96  const CModel* pModel = pCOPASIDATAMODEL->getModel();
97  CPPUNIT_ASSERT(pModel != NULL);
98  CPPUNIT_ASSERT(pModel->getModelValues().size() == 1);
99  const CModelValue* pMV = pModel->getModelValues()[0];
100  CPPUNIT_ASSERT(pMV != NULL);
101  CPPUNIT_ASSERT(pMV->getInitialExpression().empty());
102  // since the parameter does not set an initial value, it's value should be 1.0
103  CPPUNIT_ASSERT(fabs(pMV->getInitialValue() - 1.0) < 1e-6);
104 }
static const char * MODEL_STRING2
Definition: test000088.h:37
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
virtual size_t size() const
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000088.h:35
const size_t & getNumber() const
#define MCSBML
static size_t size()
static CCopasiMessage getLastMessage()
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
Definition: CModel.h:50

Member Data Documentation

const char * test000088::MODEL_STRING1
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=\"model\">\n"
" <listOfParameters>\n"
" <parameter constant=\"false\" id=\"parameter_1\"/>\n"
" </listOfParameters>\n"
" <listOfRules>\n"
" <assignmentRule variable=\"parameter_1\" />\n"
" </listOfRules>\n"
" </model>\n"
"</sbml>\n"

Definition at line 36 of file test000088.h.

Referenced by test_import_assignment_without_expression().

const char * test000088::MODEL_STRING2
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sbml xmlns=\"http://www.sbml.org/sbml/level2/version4\" level=\"2\" version=\"4\">\n"
" <model id=\"model_1\" name=\"model\">\n"
" <listOfParameters>\n"
" <parameter constant=\"false\" id=\"parameter_1\"/>\n"
" </listOfParameters>\n"
" <listOfInitialAssignments>\n"
" <initialAssignment symbol=\"parameter_1\" />\n"
" </listOfInitialAssignments>\n"
" </model>\n"
"</sbml>\n"

Definition at line 37 of file test000088.h.

Referenced by test_import_initialassignment_without_expression().

const char * test000088::MODEL_STRING3
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=\"model\">\n"
" <listOfParameters>\n"
" <parameter constant=\"false\" id=\"parameter_1\"/>\n"
" </listOfParameters>\n"
" <listOfEvents>\n"
" <event>\n"
" <trigger>\n"
" <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
" <apply>\n"
" <geq/>\n"
" <ci> parameter_1 </ci>\n"
" <cn> 3.0 </cn>\n"
" </apply>\n"
" </math>\n"
" </trigger>\n"
" <listOfEventAssignments>\n"
" <eventAssignment variable=\"parameter_1\" />\n"
" </listOfEventAssignments>\n"
" </event>\n"
" </listOfEvents>\n"
" </model>\n"
"</sbml>\n"

Definition at line 38 of file test000088.h.

Referenced by test_import_eventassignment_without_expression().

CCopasiDataModel * test000088::pCOPASIDATAMODEL = NULL
staticprotected

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