COPASI API  4.16.103
test000104.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/sbml/unittests/test000104.cpp,v $
3 // $Revision: 1.1 $
4 // $Name: $
5 // $Author: gauges $
6 // $Date: 2011/12/24 11:14:48 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 #include "test000104.h"
15 
16 #include <string>
17 #include <iostream>
18 
21 
22 #include "sbml/xml/XMLNode.h"
23 #include "sbml/xml/XMLAttributes.h"
24 #include "sbml/xml/XMLInputStream.h"
25 
26 // libsbml will not add units to unit definitions of Level 3 documents
27 // if not all attributes are explicitely set.
28 // Prior versions of the exporter did not set the multiplier on all units and therefore
29 // most units were not exported correctly to Level 3.
30 
32 {
33  // Create the root container.
34  CCopasiRootContainer::init(0, NULL, false);
36 }
37 
39 {
41 }
42 
43 
44 
46 {
47  try
48  {
50  CPPUNIT_ASSERT(result == true);
51  }
52  catch (...)
53  {
54  CPPUNIT_ASSERT_MESSAGE("Importing the model string failed with an exception.", false);
55  }
56 
57  // the actual test was if the import leads to a crash, the rest is just sugar coating
58 
59  // check the error messages
60  // since there are 6 unit ids used on the model, but none of these is defined as
61  // a unit definiton, we should have at least 6 warnings and one should be MCSBML + 66
62  unsigned int i, iMax = CCopasiMessage::size();
63  CPPUNIT_ASSERT(iMax >= 6);
64  CPPUNIT_ASSERT(CCopasiMessage::checkForMessage(MCSBML + 66) == true);
65 }
66 
67 const char* test000104::SBML_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
68  "<sbml xmlns=\"http://www.sbml.org/sbml/level3/version1/core\" xmlns:comp=\"http://www.sbml.org/sbml/level3/version1/comp/version1\" level=\"3\" version=\"1\" xmlns:html=\"http://www.w3.org/1999/xhtml\" xmlns:jigcell=\"http://www.sbml.org/2001/ns/jigcell\" xmlns:math=\"http://www.w3.org/1998/Math/MathML\">\n"
69  "<comp:listOfModelDefinitions>\n"
70  "</comp:listOfModelDefinitions>\n"
71  "<model areaUnits=\"area\" extentUnits=\"substance\" id=\"Model_1\" lengthUnits=\"length\" metaid=\"COPASI1\" name=\"RootModel\" substanceUnits=\"substance\" timeUnits=\"time\" volumeUnits=\"volume\">\n"
72  " </model>\n"
73  "</sbml>";
void test_bug1744()
Definition: test000104.cpp:45
static const char * SBML_STRING
Definition: test000104.h:38
#define MCSBML
void setUp()
Definition: test000104.cpp:31
static size_t size()
CCopasiDataModel * pDataModel
Definition: test000104.h:40
static CCopasiDataModel * addDatamodel()
static bool checkForMessage(const size_t &number)
void tearDown()
Definition: test000104.cpp:38
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
static void init(int argc, char *argv[], const bool &withGui=false)