Salome HOME
155e028a1a934f1e700340a46bf622e767ec0ba6
[modules/med.git] / src / MEDMEMCppTest / MEDMEMTest_MedVersion.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "MEDMEMTest.hxx"
21 #include <cppunit/TestAssert.h>
22
23 #include <cstdlib>
24 #include <exception>
25
26 #include <MEDMEM_MedVersion.hxx>
27
28 using namespace std;
29 using namespace MEDMEM;
30 using namespace MED_EN;
31
32 /*!
33  *  Check methods (not in spec), defined in MEDMEM_MedVersion.hxx:
34  *  (+) MED_EN::medFileVersion getMedFileVersion(const string & fileName) throw (MEDEXCEPTION);
35  *  (+) int getMedAccessMode(MED_EN::med_mode_acces mode,
36  *                               MED_EN::medFileVersion medVersion) throw (MEDEXCEPTION);
37  */
38
39 void MEDMEMTest::testMedVersion()
40 {
41   string filename = getResourceFile("pointe_nomorereadable21.med");
42   string notExistFileName = "anyfile";
43   medFileVersion myFileVersion;
44
45   // Test - getMedFileVersion
46   CPPUNIT_ASSERT_THROW(getMedFileVersion(notExistFileName),MEDEXCEPTION);
47
48   CPPUNIT_ASSERT_NO_THROW(myFileVersion = getMedFileVersion(filename));
49   CPPUNIT_ASSERT(myFileVersion == V21);
50
51 }