Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDMEMCppTest / MEDMEMTest_GibiMeshDriver.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #include "MEDMEMTest.hxx"
23 #include <cppunit/TestAssert.h>
24
25 #include <MEDMEM_GibiMeshDriver.hxx>
26 #include <MEDMEM_Mesh.hxx>
27 #include <MEDMEM_Med.hxx>
28
29 // use this define to enable lines, execution of which leads to Segmentation Fault
30 //#define ENABLE_FAULTS
31
32 // use this define to enable CPPUNIT asserts and fails, showing bugs
33 //#define ENABLE_FORCED_FAILURES
34
35 using namespace std;
36 using namespace MEDMEM;
37 using namespace MED_EN;
38
39 /*!
40  *  Check methods (31), defined in MEDMEM_GibiMeshDriver.hxx:
41  *  class GIBI_MESH_DRIVER : public GENDRIVER {
42  *   (+) GIBI_MESH_DRIVER();
43  *   (+) GIBI_MESH_DRIVER(const string & fileName, MESH * ptrMesh, MED_EN::med_mode_acces accessMode);
44  *   (+) GIBI_MESH_DRIVER(const GIBI_MESH_DRIVER & driver);
45  *   (+) virtual ~GIBI_MESH_DRIVER();
46  *   (+) virtual void write(void) const = 0;
47  *   (+) virtual void read (void) = 0;
48  *   (+) void   setMeshName(const string & meshName);
49  *   (+) string getMeshName() const;
50  *   (+) static MED_EN::medGeometryElement gibi2medGeom(size_t gibiTypeNb);
51  *   (+) static int med2gibiGeom(MED_EN::medGeometryElement medGeomType);
52  *  }
53  *  class GIBI_MESH_RDONLY_DRIVER : public virtual GIBI_MESH_DRIVER {
54  *   (+) GIBI_MESH_RDONLY_DRIVER();
55  *   (+) GIBI_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh);
56  *   (+) GIBI_MESH_RDONLY_DRIVER(const GIBI_MESH_RDONLY_DRIVER & driver);
57  *   (+) virtual ~GIBI_MESH_RDONLY_DRIVER();
58  *   (+) void write(void) const throw (MEDEXCEPTION);
59  *   (+) void read (void) throw (MEDEXCEPTION);
60  *   (+) void open();
61  *   (+) void close();
62  *  }
63  *  class GIBI_MESH_WRONLY_DRIVER : public virtual GIBI_MESH_DRIVER {
64  *   (+) GIBI_MESH_WRONLY_DRIVER();
65  *   (+) GIBI_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh);
66  *   (+) GIBI_MESH_WRONLY_DRIVER(const GIBI_MESH_WRONLY_DRIVER & driver);
67  *   (+) virtual ~GIBI_MESH_WRONLY_DRIVER();
68  *   (+) void write(void) const throw (MEDEXCEPTION);
69  *   (+) void read (void) throw (MEDEXCEPTION);
70  *   (+) void open();
71  *   (+) void close();
72  *  }
73  *  class GIBI_MESH_RDWR_DRIVER : public GIBI_MESH_RDONLY_DRIVER, public GIBI_MESH_WRONLY_DRIVER {
74  *   (+) GIBI_MESH_RDWR_DRIVER();
75  *   (+) GIBI_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh);
76  *   (+) GIBI_MESH_RDWR_DRIVER(const GIBI_MESH_RDWR_DRIVER & driver);
77  *   (+) ~GIBI_MESH_RDWR_DRIVER();
78  *   (+) void write(void) const throw (MEDEXCEPTION);
79  *   (+) void read (void) throw (MEDEXCEPTION);
80  *   (+) void open();
81  *   (+) void close();
82  *  }
83  *  class GIBI_MED_RDONLY_DRIVER : public GIBI_MESH_RDONLY_DRIVER {
84  *   (+) GIBI_MED_RDONLY_DRIVER();
85  *   (+) GIBI_MED_RDONLY_DRIVER(const string & fileName, MED * ptrMed);
86  *   (+) GIBI_MED_RDONLY_DRIVER(const GIBI_MED_RDONLY_DRIVER & driver);
87  *   (+) virtual ~GIBI_MED_RDONLY_DRIVER();
88  *   (+) void read (void) throw (MEDEXCEPTION);
89  *  }
90  *  class GIBI_MED_WRONLY_DRIVER : public GIBI_MESH_WRONLY_DRIVER {
91  *   (+) GIBI_MED_WRONLY_DRIVER();
92  *   (+) GIBI_MED_WRONLY_DRIVER(const string & fileName, MED * ptrMed, MESH * ptrMesh);
93  *   (+) GIBI_MED_WRONLY_DRIVER(const GIBI_MED_WRONLY_DRIVER & driver);
94  *   (+) virtual ~GIBI_MED_WRONLY_DRIVER();
95  *   (+) void write(void) const throw (MEDEXCEPTION);
96  *  }
97  */
98
99 void MEDMEMTest::testGibiMeshDriver()
100 {
101   MESH *aMesh                      = new MESH();
102   MESH *aMesh_NULL                 = NULL;
103   MESH *aMesh_2                    = new MESH();
104   MED  *aMed                       = new MED();
105   MED  *aMed_1                     = NULL;
106
107   string data_dir                  = getenv("MED_ROOT_DIR");
108   string tmp_dir                   = getenv("TMP") ? getenv("TMP") : "/tmp";
109
110   string filename_rd               = data_dir + "/share/salome/resources/med/Darcy3_3D_H_10x10x10.sauve";
111   string filenamemed_rd            = data_dir + "/share/salome/resources/med/elle_3D_HPr_10x10x10.sauve";
112   string filename_wr               = tmp_dir  + "/myWr_Darcy3_3D_H_10x10x10.sauve";
113   string tmpfile                   = tmp_dir  + "/tmp.sauve";
114   string tmpfile_rdwr              = tmp_dir  + "/rdwr_tmp.sauve";
115   string filenamemed_wr            = tmp_dir  + "/myWrMed_elle_3D_HPr_10x10x10.sauve";
116   string tmpfilemed                = tmp_dir  + "/tmpmed.sauve";
117   string meshname                  = "Darcy3_3D_H_10x10x10";
118   string newmeshname               = "new" + meshname;
119   string fileNotExistsName_rd      = "notExists.sauve";
120   string fileNotExistsName_wr      = "/path_not_exists/file_not_exists.sauve";
121   string filename_rdwr             =  tmp_dir  + "/myRdWr_Darcy3_3D_H_10x10x10.sauve";
122   string fcopy                     = "cp " + filename_rd + " " + filename_rdwr;
123
124   // To remove tmp files from disk
125   MEDMEMTest_TmpFilesRemover aRemover;
126   aRemover.Register(filename_wr);
127   aRemover.Register(tmpfile);
128   aRemover.Register(tmpfilemed);
129   aRemover.Register(filenamemed_wr);
130   aRemover.Register(tmpfile_rdwr);
131   aRemover.Register(filename_rdwr);
132
133   //Test gibi2medGeom() and med2gibiGeom() methods
134   size_t aSize = 17;
135   CPPUNIT_ASSERT_EQUAL(GIBI_MESH_DRIVER::gibi2medGeom(aSize), MED_PENTA15);
136   CPPUNIT_ASSERT_EQUAL(GIBI_MESH_DRIVER::med2gibiGeom(MED_PENTA15), 17);
137
138   //---------------------------Test GIBI MESH READ ONLY part--------------------------------//
139   {
140     {
141       //Creation of an incorrect read only driver
142       GIBI_MESH_RDONLY_DRIVER *aInvalidGibiRdDriver =
143         new GIBI_MESH_RDONLY_DRIVER(fileNotExistsName_rd, aMesh);
144
145       //Trying open not existing file
146       CPPUNIT_ASSERT_THROW(aInvalidGibiRdDriver->open(), MEDEXCEPTION);
147
148       delete aInvalidGibiRdDriver;
149     }
150
151     //Creation a correct Gibi read only driver (normal constructor)
152     GIBI_MESH_RDONLY_DRIVER *aGibiRdDriver =
153       new GIBI_MESH_RDONLY_DRIVER(filename_rd, aMesh);
154
155     //Check driver
156     CPPUNIT_ASSERT(aGibiRdDriver);
157
158     //Trying read mesh from file, if file is not open
159     CPPUNIT_ASSERT_THROW(aGibiRdDriver->read(), MEDEXCEPTION);
160
161     //Test open() method
162     CPPUNIT_ASSERT_NO_THROW(aGibiRdDriver->open());
163
164     //Trying open file secondary.
165     //#ifdef ENABLE_FORCED_FAILURES
166     //This case is not work, seems it BUG
167     // SHOULD THROW
168     //CPPUNIT_ASSERT_THROW(aGibiRdDriver->open(), MEDEXCEPTION);
169     CPPUNIT_ASSERT_NO_THROW(aGibiRdDriver->open());
170     //#endif
171
172     //Test setMeshName() and getMeshName() methods
173     CPPUNIT_ASSERT_NO_THROW(aGibiRdDriver->setMeshName(meshname));
174     CPPUNIT_ASSERT_EQUAL(meshname, aGibiRdDriver->getMeshName());
175
176     //Test read() method
177     CPPUNIT_ASSERT_NO_THROW(aGibiRdDriver->read());
178     // Source and destination overlap in memcpy(0x35DBF040, 0x35DBF06D, 101)
179     //  at 0x3414D97E: memcpy (mac_replace_strmem.c:113)
180     //  by 0x3492EDE9: MEDMEM::GIBI_MESH_RDONLY_DRIVER::getLine(char*&) (MEDMEM_GibiMeshDriver.cxx:942)
181     //  by 0x349407FD: MEDMEM::GIBI_MESH_RDONLY_DRIVER::getNextLine(char*&, bool) (MEDMEM_GibiMeshDriver.hxx:168)
182     //  by 0x349268B1: MEDMEM::GIBI_MESH_RDONLY_DRIVER::readFile(MEDMEM::_intermediateMED*, bool) (MEDMEM_GibiMeshDriver.cxx:209)
183     //  by 0x3492F58B: MEDMEM::GIBI_MESH_RDONLY_DRIVER::read() (MEDMEM_GibiMeshDriver.cxx:1058)
184     //  by 0x3436DEA6: MEDMEMTest::testGibiMeshDriver() (MEDMEMTest_GibiMeshDriver.cxx:168)
185
186     //Trying fill not empty mesh
187     CPPUNIT_ASSERT_THROW(aGibiRdDriver->read(), MEDEXCEPTION);
188
189     //Test write() method for GIBI READ ONLY driver
190     CPPUNIT_ASSERT_THROW(aGibiRdDriver->write(), MEDEXCEPTION);
191
192     //Check Mesh
193     CPPUNIT_ASSERT(aMesh);
194
195     //Test close method
196     CPPUNIT_ASSERT_NO_THROW(aGibiRdDriver->close());
197
198     //Default constructor
199     {
200       GIBI_MESH_RDONLY_DRIVER aGibiRdDriverCpy_1;
201     }
202
203     //Test copy constructor and operator==(), defined in GENDRIVER class
204     {
205       GIBI_MESH_RDONLY_DRIVER aGibiRdDriverCpy_2 (*aGibiRdDriver);
206       CPPUNIT_ASSERT(aGibiRdDriverCpy_2.GENDRIVER::operator==(*aGibiRdDriver));
207
208       //Test (friend ostream & operator <<) defined GENDRIVER class
209       ostringstream rostr1, rostr2;
210       rostr1 << *aGibiRdDriver;
211       rostr2 << aGibiRdDriverCpy_2;
212       CPPUNIT_ASSERT(rostr1.str() != "");
213       CPPUNIT_ASSERT(rostr1.str() == rostr2.str());
214     }
215
216     delete aGibiRdDriver;
217   }
218
219   //-------------------------------Test GIBI WRITE ONLY part------------------------------//
220   {
221     {
222       //Creation a incorrect gibi write only driver
223       GIBI_MESH_WRONLY_DRIVER *aInvalidGibiWrDriver =
224         new GIBI_MESH_WRONLY_DRIVER(fileNotExistsName_wr, aMesh);
225
226       //Trying open non existing file
227       CPPUNIT_ASSERT_THROW(aInvalidGibiWrDriver->open(), MEDEXCEPTION);
228
229       delete aInvalidGibiWrDriver;
230     }
231
232     //Trying write empty mesh
233     {
234       GIBI_MESH_WRONLY_DRIVER *aTmpGibiWrDriver =
235         new GIBI_MESH_WRONLY_DRIVER(tmpfile, aMesh_NULL);
236       aTmpGibiWrDriver->open();
237
238       CPPUNIT_ASSERT_THROW(aTmpGibiWrDriver->write(),MEDEXCEPTION);
239       aTmpGibiWrDriver->close();
240
241       delete aTmpGibiWrDriver;
242     }
243
244     //Creation a correct gibi write only drivers
245     GIBI_MESH_WRONLY_DRIVER *aGibiWrDriver =
246       new GIBI_MESH_WRONLY_DRIVER(filename_wr, aMesh);
247
248     //Check driver
249     CPPUNIT_ASSERT(aGibiWrDriver);
250
251     //Trying write mesh to file, if file is not open
252     CPPUNIT_ASSERT_THROW(aGibiWrDriver->write(), MEDEXCEPTION);
253
254     //Test open() method
255     CPPUNIT_ASSERT_NO_THROW(aGibiWrDriver->open());
256
257     //Trying open file secondary.
258     //#ifdef ENABLE_FORCED_FAILURES
259     // (BUG) No exception on attempt to open an opened file for the second time
260     //CPPUNIT_ASSERT_THROW(aGibiWrDriver->open(), MEDEXCEPTION);
261     CPPUNIT_ASSERT_NO_THROW(aGibiWrDriver->open());
262     //#endif
263
264     //Test setMeshName() and getMeshName() methods
265     CPPUNIT_ASSERT_NO_THROW(aGibiWrDriver->setMeshName(newmeshname));
266     CPPUNIT_ASSERT_EQUAL(newmeshname, aGibiWrDriver->getMeshName());
267
268     //Test write() method
269     CPPUNIT_ASSERT_NO_THROW(aGibiWrDriver->write());
270
271     //Test read() method for GIBI WRITE ONLY driver
272     CPPUNIT_ASSERT_THROW(aGibiWrDriver->read(), MEDEXCEPTION);
273
274     //Test close method
275     CPPUNIT_ASSERT_NO_THROW(aGibiWrDriver->close());
276
277     //Default constructor
278     GIBI_MESH_WRONLY_DRIVER aGibiWrDriverCpy_1;
279
280     //Test copy constructor
281     GIBI_MESH_WRONLY_DRIVER aGibiWrDriverCpy_2 (*aGibiWrDriver);
282
283     //Test (bool operator ==) defined GENDRIVER class
284     CPPUNIT_ASSERT(aGibiWrDriverCpy_2.GENDRIVER::operator==(*aGibiWrDriver));
285
286     //Test (friend ostream & operator <<) defined GENDRIVER class
287     ostringstream wostr1, wostr2;
288     wostr1 << *aGibiWrDriver;
289     wostr2 << aGibiWrDriverCpy_2;
290     CPPUNIT_ASSERT(wostr1.str() != "");
291     CPPUNIT_ASSERT(wostr1.str() == wostr2.str());
292
293     delete aGibiWrDriver;
294   }
295
296   //-------------------------------Test GIBI READ/WRITE part---------------------------------//
297   {
298     //Copy file
299     system(fcopy.c_str());
300
301     {
302       //Creation a incorrect gibi read/write driver
303       GIBI_MESH_RDWR_DRIVER *aInvalidGibiRdWrDriver =
304         new GIBI_MESH_RDWR_DRIVER(fileNotExistsName_wr, aMesh_2);
305
306       //Trying read/write from not existing file
307       CPPUNIT_ASSERT_THROW(aInvalidGibiRdWrDriver->read(), MEDEXCEPTION);
308       CPPUNIT_ASSERT_THROW(aInvalidGibiRdWrDriver->write(), MEDEXCEPTION);
309
310       delete aInvalidGibiRdWrDriver;
311     }
312
313     //Trying write empty mesh
314     {
315       GIBI_MESH_RDWR_DRIVER *aTmpGibiRdWrDriver =
316         new GIBI_MESH_RDWR_DRIVER(tmpfile_rdwr, aMesh_NULL);
317       CPPUNIT_ASSERT_THROW(aTmpGibiRdWrDriver->write(), MEDEXCEPTION);
318       delete aTmpGibiRdWrDriver;
319     }
320
321     //Creation a correct read/write driver
322     GIBI_MESH_RDWR_DRIVER *aGibiRdWrDriver =
323       new GIBI_MESH_RDWR_DRIVER(filename_rdwr, aMesh_2);
324
325     //Test open/close methods
326     CPPUNIT_ASSERT_NO_THROW(aGibiRdWrDriver->open());
327     CPPUNIT_ASSERT_NO_THROW(aGibiRdWrDriver->close());
328
329     //Check driver
330     CPPUNIT_ASSERT(aGibiRdWrDriver);
331
332     //Test read() method
333     CPPUNIT_ASSERT_NO_THROW(aGibiRdWrDriver->read());
334
335     //Check Mesh
336     CPPUNIT_ASSERT(aMesh);
337
338     //Trying fill not empty mesh
339     CPPUNIT_ASSERT_THROW(aGibiRdWrDriver->read(),MEDEXCEPTION);
340
341     //Test write() method
342     aGibiRdWrDriver->setMeshName(newmeshname);
343     CPPUNIT_ASSERT_NO_THROW(aGibiRdWrDriver->write());
344
345     //Default constructor
346     GIBI_MESH_RDWR_DRIVER aGibiRdWrDriverCpy_1;
347
348     //Test copy constructor
349     GIBI_MESH_RDWR_DRIVER aGibiRdWrDriverCpy_2 (*aGibiRdWrDriver);
350
351     //Test (bool operator ==)
352     CPPUNIT_ASSERT(aGibiRdWrDriverCpy_2.GENDRIVER::operator==(*aGibiRdWrDriver));
353
354     //Test (ostream & operator <<)
355     ostringstream rwostr1, rwostr2;
356     rwostr1 << *aGibiRdWrDriver;
357     rwostr2 << aGibiRdWrDriverCpy_2;
358     CPPUNIT_ASSERT(rwostr1.str() != "");
359     CPPUNIT_ASSERT(rwostr1.str() == rwostr2.str());
360
361     delete aGibiRdWrDriver;
362   }
363
364   //----------------------------Test GIBI_MED_RDONLY_DRIVER----------------------------
365   {
366     {
367       GIBI_MED_RDONLY_DRIVER *aInvalidMedGibiRdDriver =
368         new GIBI_MED_RDONLY_DRIVER(fileNotExistsName_rd, aMed);
369
370       //Trying open not exising file
371       CPPUNIT_ASSERT_THROW(aInvalidMedGibiRdDriver->open(), MEDEXCEPTION);
372
373       delete aInvalidMedGibiRdDriver;
374     }
375
376     //Creation a correct Gibi read only driver (normal constructor)
377     GIBI_MED_RDONLY_DRIVER *aGibiMedRdDriver =
378       new GIBI_MED_RDONLY_DRIVER(filenamemed_rd, aMed);
379
380     //Check driver
381     CPPUNIT_ASSERT(aGibiMedRdDriver);
382
383     //Trying read mesh from file, if file is not open
384     CPPUNIT_ASSERT_THROW(aGibiMedRdDriver->read(), MEDEXCEPTION);
385
386     //Test open() method
387     CPPUNIT_ASSERT_NO_THROW(aGibiMedRdDriver->open());
388
389     //#ifdef ENABLE_FORCED_FAILURES
390     //Trying open file secondary.
391     //CPPUNIT_ASSERT_THROW(aGibiMedRdDriver->open(), MEDEXCEPTION);
392     CPPUNIT_ASSERT_NO_THROW(aGibiMedRdDriver->open());
393     //This case is not work, seems it BUG
394     //#endif
395
396     //Test read() method
397     CPPUNIT_ASSERT_NO_THROW(aGibiMedRdDriver->read());
398
399     //Test write() method for GIBI MED READ ONLY driver
400     CPPUNIT_ASSERT_THROW(aGibiMedRdDriver->write(), MEDEXCEPTION);
401
402     //Check Med
403     CPPUNIT_ASSERT(aMed);
404
405     //Test close method
406     CPPUNIT_ASSERT_NO_THROW(aGibiMedRdDriver->close());
407
408     //Default constructor
409     GIBI_MED_RDONLY_DRIVER aGibiMedRdDriverCpy_1;
410
411     //Test (bool operator ==) defined in GENDRIVER class
412     CPPUNIT_ASSERT(! aGibiMedRdDriverCpy_1.GENDRIVER::operator==(*aGibiMedRdDriver));
413
414     //Test copy constructor
415     // commented since this test is not important
416     //GIBI_MED_RDONLY_DRIVER aGibiMedRdDriverCpy_2 (*aGibiMedRdDriver);
417     //#ifdef ENABLE_FORCED_FAILURES
418     // (BUG) Copy constructor of GIBI_MED_RDONLY_DRIVER is not implemented
419     // Small importance
420     //CPPUNIT_ASSERT(aGibiMedRdDriverCpy_2.GENDRIVER::operator==(*aGibiMedRdDriver));
421     //#endif
422
423     //Test (friend ostream & operator <<) defined in GENDRIVER class
424     // commented since this test is not important
425     //ostringstream medrostr1, medrostr2;
426     //medrostr1 << *aGibiMedRdDriver;
427     //medrostr2 << aGibiMedRdDriverCpy_2;
428     //CPPUNIT_ASSERT(medrostr1.str() != "");
429     //#ifdef ENABLE_FORCED_FAILURES
430     // (BUG) Copy constructor of GIBI_MED_RDONLY_DRIVER is not implemented
431     //CPPUNIT_ASSERT(medrostr1.str() == medrostr2.str());
432     //#endif
433
434     delete aGibiMedRdDriver;
435   }
436
437   //----------------------------Test GIBI MED WRITE ONLY part----------------------------------//
438   {
439     {
440       //Creation a incorrect gibi med write only driver
441       GIBI_MED_WRONLY_DRIVER *aInvalidGibiMedWrDriver =
442         new GIBI_MED_WRONLY_DRIVER(fileNotExistsName_wr, aMed, aMesh);
443
444       //Trying open non existing file
445       CPPUNIT_ASSERT_THROW(aInvalidGibiMedWrDriver->open(), MEDEXCEPTION);
446
447       delete aInvalidGibiMedWrDriver;
448     }
449
450     //Trying create gibi med write only driver with null MED and MESH
451     CPPUNIT_ASSERT_THROW(new GIBI_MED_WRONLY_DRIVER(tmpfilemed, aMed_1, aMesh_NULL), MEDEXCEPTION);
452
453     //Creation a correct gibi med write only drivers
454     GIBI_MED_WRONLY_DRIVER *aGibiMedWrDriver =
455       new GIBI_MED_WRONLY_DRIVER(filenamemed_wr, aMed, aMesh);
456
457     //Check driver
458     CPPUNIT_ASSERT(aGibiMedWrDriver);
459
460     //Trying write mesh to file, if file is not open
461     CPPUNIT_ASSERT_THROW(aGibiMedWrDriver->write(), MEDEXCEPTION);
462
463     //Test open() method
464     CPPUNIT_ASSERT_NO_THROW(aGibiMedWrDriver->open());
465
466     //Trying open file secondary.
467     //#ifdef ENABLE_FORCED_FAILURES
468     // (BUG) Exception is generated, but second call to open() function breaks driver
469     //CPPUNIT_ASSERT_THROW(aGibiMedWrDriver->open(), MEDEXCEPTION);
470     CPPUNIT_ASSERT_NO_THROW(aGibiMedWrDriver->open());
471     //#endif
472
473     //Test write() method
474     CPPUNIT_ASSERT_NO_THROW(aGibiMedWrDriver->write());
475
476     //Test read() method for GIBI MED WRITE ONLY driver
477     CPPUNIT_ASSERT_THROW(aGibiMedWrDriver->read(), MEDEXCEPTION);
478
479     //Test close method
480     CPPUNIT_ASSERT_NO_THROW(aGibiMedWrDriver->close());
481
482     //Default constructor
483     GIBI_MED_WRONLY_DRIVER aGibiMedWrDriverCpy_1;
484
485     //Test copy constructor
486     {
487       GIBI_MED_WRONLY_DRIVER aGibiMedWrDriverCpy_2 (*aGibiMedWrDriver);
488
489       //Test (bool operator ==) defined in GENDRIVER class
490       // commented since this test is not important
491       //#ifdef ENABLE_FORCED_FAILURES
492       // (BUG) Copy constructor of GIBI_MED_WRONLY_DRIVER is not implemented!!!
493       //CPPUNIT_ASSERT(aGibiMedWrDriverCpy_2.GENDRIVER::operator==(*aGibiMedWrDriver));
494       //#endif
495
496       //Test (friend ostream & operator <<) defined GENDRIVER class
497       // commented since this test is not important
498       //ostringstream medwostr1, medwostr2;
499       //medwostr1 << *aGibiMedWrDriver;
500       //medwostr2 << aGibiMedWrDriverCpy_2;
501       //CPPUNIT_ASSERT(medwostr1.str() != "");
502       //#ifdef ENABLE_FORCED_FAILURES
503       // Copy constructor of GIBI_MED_WRONLY_DRIVER is not implemented!!!
504       //CPPUNIT_ASSERT(medwostr1.str() == medwostr2.str());
505       //#endif
506     }
507
508     delete aGibiMedWrDriver;
509   }
510
511   //Delete all objects
512   delete aMesh;
513   delete aMesh_2;
514 }