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

#include <test000100.h>

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

Public Member Functions

void setUp ()
 
void tearDown ()
 
void test_bug1692_1 ()
 
void test_bug1692_2 ()
 

Protected Attributes

CCopasiDataModelpDataModel
 

Static Protected Attributes

static const char * CPS_STRING
 

Private Member Functions

 CPPUNIT_TEST (test_bug1692_1)
 
 CPPUNIT_TEST (test_bug1692_2)
 
 CPPUNIT_TEST_SUITE (test000100)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 29 of file test000100.h.

Member Function Documentation

test000100::CPPUNIT_TEST ( test_bug1692_1  )
private
test000100::CPPUNIT_TEST ( test_bug1692_2  )
private
test000100::CPPUNIT_TEST_SUITE ( test000100  )
private
test000100::CPPUNIT_TEST_SUITE_END ( )
private
void test000100::setUp ( )

Definition at line 42 of file test000100.cpp.

References abort_handler(), CCopasiRootContainer::addDatamodel(), CCopasiRootContainer::init(), pDataModel, pNewAct, and pOldAct.

43 {
44 #ifndef WIN32
45  // set a new action handler for SIGABRT that throws an exception
46  // instead of terminating the program. This is needed to handle failed assertions
47  // in debug versions.
48  pNewAct = new struct sigaction();
49  pNewAct->sa_handler = &abort_handler;
50  pOldAct = new struct sigaction();
51  int x = sigaction(SIGABRT, pNewAct, pOldAct);
52 
53  if (x != 0)
54  {
55  std::cerr << "Setting the signal handler failed." << std::endl;
56  }
57 
58 #endif
59  // Create the root container.
60  CCopasiRootContainer::init(0, NULL, false);
62 }
struct sigaction * pNewAct
Definition: test000100.cpp:39
static CCopasiDataModel * addDatamodel()
CCopasiDataModel * pDataModel
Definition: test000100.h:42
static void init(int argc, char *argv[], const bool &withGui=false)
struct sigaction * pOldAct
Definition: test000100.cpp:40
void abort_handler(int)
Definition: test000100.cpp:33
void test000100::tearDown ( )

Definition at line 64 of file test000100.cpp.

References CCopasiRootContainer::destroy(), and pOldAct.

65 {
67 #ifndef WIN32
68  // restore the old action handler
69  int x = sigaction(SIGABRT, pOldAct, NULL);
70 
71  if (x != 0)
72  {
73  std::cerr << "Resetting the signal handler failed." << std::endl;
74  }
75 
76 #endif
77 }
struct sigaction * pOldAct
Definition: test000100.cpp:40
void test000100::test_bug1692_1 ( )

Definition at line 81 of file test000100.cpp.

References CPS_STRING, CCopasiDataModel::exportSBMLToString(), load_cps_model_from_stream(), and pDataModel.

82 {
83  CPPUNIT_ASSERT(pDataModel != NULL);
84  std::istringstream iss(test000100::CPS_STRING);
85  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
86  std::string s;
87 
88  try
89  {
90  s = pDataModel->exportSBMLToString(NULL, 2, 1);
91  }
92  catch (...)
93  {
94  CPPUNIT_ASSERT_MESSAGE("The first export to Level 2 Version 1 failed.", false);
95  }
96 
97  try
98  {
99  s = pDataModel->exportSBMLToString(NULL, 3, 1);
100  }
101  catch (...)
102  {
103  CPPUNIT_ASSERT_MESSAGE("The second export to Level 3 Version 1 failed.", false);
104  }
105 }
static const char * CPS_STRING
Definition: test000100.h:40
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
Definition: utilities.cpp:21
CCopasiDataModel * pDataModel
Definition: test000100.h:42
void test000100::test_bug1692_2 ( )

Definition at line 109 of file test000100.cpp.

References CPS_STRING, CCopasiDataModel::exportSBMLToString(), load_cps_model_from_stream(), and pDataModel.

110 {
111  CPPUNIT_ASSERT(pDataModel != NULL);
112  std::istringstream iss(test000100::CPS_STRING);
113  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
114  std::string s;
115 
116  try
117  {
118  s = pDataModel->exportSBMLToString(NULL, 3, 1);
119  }
120  catch (...)
121  {
122  CPPUNIT_ASSERT_MESSAGE("The first export to Level 3 Version 1 failed.", false);
123  }
124 
125  try
126  {
127  s = pDataModel->exportSBMLToString(NULL, 2, 1);
128  }
129  catch (...)
130  {
131  CPPUNIT_ASSERT_MESSAGE("The second export to Level 2 Version 1 failed.", false);
132  }
133 }
static const char * CPS_STRING
Definition: test000100.h:40
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
Definition: utilities.cpp:21
CCopasiDataModel * pDataModel
Definition: test000100.h:42

Member Data Documentation

const char * test000100::CPS_STRING
staticprotected

Definition at line 40 of file test000100.h.

Referenced by test_bug1692_1(), and test_bug1692_2().

CCopasiDataModel* test000100::pDataModel
protected

Definition at line 42 of file test000100.h.

Referenced by setUp(), test_bug1692_1(), and test_bug1692_2().


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