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

#include <test000094.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_notrequired_package ()
 
void test_required_package ()
 

Static Protected Attributes

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

Private Member Functions

 CPPUNIT_TEST (test_required_package)
 
 CPPUNIT_TEST (test_notrequired_package)
 
 CPPUNIT_TEST_SUITE (test000094)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 26 of file test000094.h.

Member Function Documentation

test000094::CPPUNIT_TEST ( test_required_package  )
private
test000094::CPPUNIT_TEST ( test_notrequired_package  )
private
test000094::CPPUNIT_TEST_SUITE ( test000094  )
private
test000094::CPPUNIT_TEST_SUITE_END ( )
private
void test000094::setUp ( )

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

Definition at line 40 of file test000094.cpp.

References CCopasiRootContainer::destroy().

void test000094::test_notrequired_package ( )

Definition at line 64 of file test000094.cpp.

References CCopasiDataModel::getCurrentSBMLDocument(), CCopasiDataModel::getModel(), CCopasiDataModel::importSBMLFromString(), MODEL_STRING2, and pCOPASIDATAMODEL.

65 {
66  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
67  bool result = pDataModel->importSBMLFromString(test000094::MODEL_STRING2);
68  CPPUNIT_ASSERT(result == true);
69  CModel *pModel = pDataModel->getModel();
70  CPPUNIT_ASSERT(pModel != NULL);
71  CPPUNIT_ASSERT(pDataModel->getCurrentSBMLDocument() != NULL);
72 }
SBMLDocument * getCurrentSBMLDocument()
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000094.h:36
static const char * MODEL_STRING2
Definition: test000094.h:35
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
Definition: CModel.h:50
void test000094::test_required_package ( )

Definition at line 45 of file test000094.cpp.

References CCopasiDataModel::importSBMLFromString(), MODEL_STRING1, and pCOPASIDATAMODEL.

46 {
47  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
48  bool failed = false;
49 
50  try
51  {
53  }
54  catch (const CCopasiException& e)
55  {
56 
57  failed = true;
58  }
59 
60  CPPUNIT_ASSERT_MESSAGE("The model should have failed loading because it contains a required package.", failed == true);
61  // check for the error message in the COPASI message stack
62 }
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000094.h:36
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static const char * MODEL_STRING1
Definition: test000094.h:34

Member Data Documentation

const char * test000094::MODEL_STRING1
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sbml xmlns=\"http://www.sbml.org/sbml/level3/version1/core\" level=\"3\" version=\"1\"\n"
" xmlns:ppp=\"http://www.sbml.org/sbml/level3/version1/some_package/version1\"\n"
" ppp:required=\"true\">\n"
" <model id=\"Model_1\" name=\"New Model\">\n"
" <ppp:some_package>\n"
" </ppp:some_package>\n"
" </model>\n"
"</sbml>\n"

This model contains a required package which COPASI does not understand, so we refuse to load the model.

Definition at line 34 of file test000094.h.

Referenced by test_required_package().

const char * test000094::MODEL_STRING2
staticprotected
Initial value:
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sbml xmlns=\"http://www.sbml.org/sbml/level3/version1/core\" level=\"3\" version=\"1\"\n"
" xmlns:ppp=\"http://www.sbml.org/sbml/level3/version1/some_package/version1\"\n"
" ppp:required=\"false\">\n"
" <model id=\"Model_1\" name=\"New Model\">\n"
" <ppp:element>\n"
" </ppp:element>\n"
" </model>\n"
"</sbml>\n"

This model contains a package that is not required, so COPASI should just ignore it and load the model.

Definition at line 35 of file test000094.h.

Referenced by test_notrequired_package().

CCopasiDataModel * test000094::pCOPASIDATAMODEL = NULL
staticprotected

Definition at line 36 of file test000094.h.

Referenced by setUp(), test_notrequired_package(), and test_required_package().


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