-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
#include "MEDMEMTest.hxx"
#include <cppunit/TestAssert.h>
#include <MEDMEM_VtkMeshDriver.hxx>
-#include <MEDMEM_MedMeshDriver22.hxx>
+#include <MEDMEM_MedMeshDriver.hxx>
#include <MEDMEM_Mesh.hxx>
// use this define to enable lines, execution of which leads to Segmentation Fault
*/
void MEDMEMTest::testVtkMeshDriver()
{
- MESH * aMesh = new MESH();
+ MESH * aMesh = new MESH;
- string data_dir = getenv("MED_ROOT_DIR");
- string tmp_dir = getenv("TMP") ? getenv("TMP") : "/tmp";
- string filename_rd = data_dir + "/share/salome/resources/med/pointe_import22.med";
+ string filename_rd = getResourceFile("pointe.med");
string emptyfilename = "";
string meshname_rd = "maa1";
string meshname = "MyMesh";
string fileNotExistsName = "/path_not_exists/file_not_exists.vtk";
- string filename = tmp_dir + "/my_pointe.vtk";
+ string filename = makeTmpFile("my_pointe.vtk");
MEDMEMTest_TmpFilesRemover aRemover;
aRemover.Register(filename);
CPPUNIT_ASSERT_THROW(aInvalidVtkDriver->open(), MEDEXCEPTION);
CPPUNIT_ASSERT_THROW(aInvalidVtkDriver->openConst(), MEDEXCEPTION);
- //#ifdef ENABLE_FORCED_FAILURES
- // (BUG) In destructor of VTK_MESH_DRIVER: Exception after trying close not existing file
- //CPPUNIT_ASSERT_NO_THROW(delete aInvalidVtkDriver);
- //#endif
+ CPPUNIT_ASSERT_NO_THROW(delete aInvalidVtkDriver);
}
{
CPPUNIT_ASSERT(aVtkDriver);
//Create a Mesh
- MED_MESH_RDONLY_DRIVER22 *aMedMeshRdDriver22 = new MED_MESH_RDONLY_DRIVER22(filename_rd, aMesh);
+ MED_MESH_RDONLY_DRIVER *aMedMeshRdDriver22 = new MED_MESH_RDONLY_DRIVER(filename_rd, aMesh);
aMedMeshRdDriver22->open();
aMedMeshRdDriver22->setMeshName(meshname_rd);
CPPUNIT_ASSERT_NO_THROW(aVtkDriver->open());
//Trying open file secondary
- //#ifdef ENABLE_FORCED_FAILURES
- // (BUG) No exception on attempt to open a file for the second time
- //CPPUNIT_ASSERT_THROW(aVtkDriver->open(), MEDEXCEPTION);
- //#endif
+ // (NOT!!! BUG) No exception on attempt to open a file for the second time
+ //CPPUNIT_ASSERT_NO_THROW(aVtkDriver->open());
//Test read method
CPPUNIT_ASSERT_THROW(aVtkDriver->read(), MEDEXCEPTION);
//Trying write empty mesh
- //#ifdef ENABLE_FAULTS
- // ? (BUG) ? In VTK_MESH_DRIVER::write() => Segmentation fault on attempt to write an empty mesh
- //CPPUNIT_ASSERT_THROW(aVtkDriver->write(), MEDEXCEPTION);
- //#endif
+ CPPUNIT_ASSERT_THROW(aVtkDriver->write(), MEDEXCEPTION);
//Read mesh from Med file
aMedMeshRdDriver22->read();
VTK_MESH_DRIVER aVtkDriverCpy_1;
//Test copy constructor
- //#ifdef ENABLE_FAULTS
- // (BUG) In copy constructor of VTK_MESH_DRIVER: Segmentation fault
VTK_MESH_DRIVER aVtkDriverCpy_2 (*aVtkDriver);
- //#endif
//Test (bool operator ==) defined in GENDRIVER class
//CPPUNIT_ASSERT(aVtkDriverCpy_2.GENDRIVER::operator==(aVtkDriver));
//Delete objects
delete aVtkDriver;
delete aMedMeshRdDriver22;
- delete aMesh;
+ aMesh->removeReference();
}