Back to index

salome-med  6.5.0
testUUnit.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 //  File   : testUUnit.cxx
00021 //  Module : MED
00022 //
00023 #include <cstdlib>
00024 #include <exception>
00025 
00026 #include "MEDMEM_Unit.hxx"
00027 using namespace std;
00028 using namespace MEDMEM;
00029 
00030 int main (int argc, char ** argv)
00031 {
00032 
00033   cout << "UNIT Test" << endl ;
00034   cout << "---------" << endl;
00035 
00036   UNIT testu;
00037   try
00038   {
00039         testu.setName("ForTesting") ;
00040   }
00041   catch ( const std::exception &e )
00042   {
00043         cout << "-----------------" << endl;
00044         cout << " pb avec setName " << endl;
00045         cout << "-----------------" << endl;
00046         MESSAGE_MED( "catched exception : " << e.what() ) ;
00047         return EXIT_FAILURE ;
00048   }
00049   catch (...)
00050   {
00051         cout << "-----------------" << endl;
00052         cout << " pb avec setName " << endl;
00053         cout << "-----------------" << endl;
00054         return EXIT_FAILURE ;
00055   }
00056 
00057   try
00058   {
00059         testu.setDescription("all values are setted 10") ;
00060   }
00061   catch ( const std::exception &e )
00062   {
00063         cout << "------------------------" << endl;
00064         cout << " pb avec setDescription " << endl;
00065         cout << "------------------------" << endl;
00066         MESSAGE_MED( "catched exception : " << e.what() ) ;
00067         return EXIT_FAILURE ;
00068   }
00069   catch (...)
00070   {
00071         cout << "------------------------" << endl;
00072         cout << " pb avec setDescription " << endl;
00073         cout << "------------------------" << endl;
00074         return EXIT_FAILURE ;
00075   }
00076 
00077   try
00078   {
00079         testu.setMasse(10);
00080   }
00081   catch ( const std::exception &e )
00082   {
00083         cout << "------------------" << endl;
00084         cout << " pb avec setMasse " << endl;
00085         cout << "------------------" << endl;
00086         MESSAGE_MED( "catched exception : " << e.what() ) ;
00087         return EXIT_FAILURE ;
00088   }
00089   catch (...)
00090   {
00091         cout << "------------------" << endl;
00092         cout << " pb avec setMasse " << endl;
00093         cout << "------------------" << endl;
00094         return EXIT_FAILURE ;
00095   }
00096 
00097   try
00098   {
00099         testu.setLength(10);
00100   }
00101   catch ( const std::exception &e )
00102   {
00103         cout << "-------------------" << endl;
00104         cout << " pb avec setLength " << endl;
00105         cout << "-------------------" << endl;
00106         MESSAGE_MED( "catched exception : " << e.what() ) ;
00107         return EXIT_FAILURE ;
00108   }
00109   catch (...)
00110   {
00111         cout << "-------------------" << endl;
00112         cout << " pb avec setLength " << endl;
00113         cout << "-------------------" << endl;
00114         return EXIT_FAILURE ;
00115   }
00116 
00117   try
00118   {
00119         testu.setTime(10);
00120   }
00121   catch ( const std::exception &e )
00122   {
00123         cout << "-----------------" << endl;
00124         cout << " pb avec setTime " << endl;
00125         cout << "-----------------" << endl;
00126         MESSAGE_MED( "catched exception : " << e.what() ) ;
00127         return EXIT_FAILURE ;
00128   }
00129   catch (...)
00130   {
00131         cout << "-----------------" << endl;
00132         cout << " pb avec setTime " << endl;
00133         cout << "-----------------" << endl;
00134         return EXIT_FAILURE ;
00135   }
00136 
00137   try
00138   {
00139         testu.setTemperature(10);
00140   }
00141   catch ( const std::exception &e )
00142   {
00143         cout << "------------------------" << endl;
00144         cout << " pb avec setTemperature " << endl;
00145         cout << "------------------------" << endl;
00146         MESSAGE_MED( "catched exception : " << e.what() ) ;
00147         return EXIT_FAILURE ;
00148   }
00149   catch (...)
00150   {
00151         cout << "------------------------" << endl;
00152         cout << " pb avec setTemperature " << endl;
00153         cout << "------------------------" << endl;
00154         return EXIT_FAILURE ;
00155   }
00156 
00157   try
00158   {
00159         testu.setMatterQuantity(10);
00160   }
00161   catch ( const std::exception &e )
00162   {
00163         cout << "---------------------------" << endl;
00164         cout << " pb avec setMatterQuantity " << endl;
00165         cout << "---------------------------" << endl;
00166         MESSAGE_MED( "catched exception : " << e.what() ) ;
00167         return EXIT_FAILURE ;
00168   }
00169   catch (...)
00170   {
00171         cout << "---------------------------" << endl;
00172         cout << " pb avec setMatterQuantity " << endl;
00173         cout << "---------------------------" << endl;
00174         return EXIT_FAILURE ;
00175   }
00176 
00177   try
00178   {
00179         testu.setCurrentStrength(10) ;
00180   }
00181   catch ( const std::exception &e )
00182   {
00183         cout << "---------------------------" << endl;
00184         cout << " pb avec setCurrentStrengt " << endl;
00185         cout << "---------------------------" << endl;
00186         MESSAGE_MED( "catched exception : " << e.what() ) ;
00187         return EXIT_FAILURE ;
00188   }
00189   catch (...)
00190   {
00191         cout << "---------------------------" << endl;
00192         cout << " pb avec setCurrentStrengt " << endl;
00193         cout << "---------------------------" << endl;
00194         return EXIT_FAILURE ;
00195   }
00196 
00197   try
00198   {
00199         testu.setLightIntensity(10) ;
00200   }
00201   catch ( const std::exception &e )
00202   {
00203         cout << "---------------------------" << endl;
00204         cout << " pb avec setLightIntensity " << endl;
00205         cout << "---------------------------" << endl;
00206         MESSAGE_MED( "catched exception : " << e.what() ) ;
00207         return EXIT_FAILURE ;
00208   }
00209   catch (...)
00210   {
00211         cout << "---------------------------" << endl;
00212         cout << " pb avec setLightIntensity " << endl;
00213         cout << "---------------------------" << endl;
00214         return EXIT_FAILURE ;
00215   }
00216 
00217 
00218   try
00219   {
00220         cout << testu.getName() << endl ;
00221   }
00222   catch ( const std::exception &e )
00223   {
00224         cout << "-----------------" << endl;
00225         cout << " pb avec getName " << endl;
00226         cout << "-----------------" << endl;
00227         MESSAGE_MED( "catched exception : " << e.what() ) ;
00228         return EXIT_FAILURE ;
00229   }
00230   catch (...)
00231   {
00232         cout << "-----------------" << endl;
00233         cout << " pb avec getName " << endl;
00234         cout << "-----------------" << endl;
00235         return EXIT_FAILURE ;
00236   }
00237 
00238   try
00239   {
00240         cout << testu.getDescription() << endl ;
00241   }
00242   catch ( const std::exception &e )
00243   {
00244         cout << "------------------------" << endl;
00245         cout << " pb avec getDescription " << endl;
00246         cout << "------------------------" << endl;
00247         MESSAGE_MED( "catched exception : " << e.what() ) ;
00248         return EXIT_FAILURE ;
00249   }
00250   catch (...)
00251   {
00252         cout << "------------------------" << endl;
00253         cout << " pb avec getDescription " << endl;
00254         cout << "------------------------" << endl;
00255         return EXIT_FAILURE ;
00256   }
00257 
00258   try
00259   {
00260         cout << testu.getMasse() << endl ;
00261   }
00262   catch ( const std::exception &e )
00263   {
00264         cout << "------------------" << endl;
00265         cout << " pb avec getMasse " << endl;
00266         cout << "------------------" << endl;
00267         MESSAGE_MED( "catched exception : " << e.what() ) ;
00268         return EXIT_FAILURE ;
00269   }
00270   catch (...)
00271   {
00272         cout << "------------------" << endl;
00273         cout << " pb avec getMasse " << endl;
00274         cout << "------------------" << endl;
00275         return EXIT_FAILURE ;
00276   }
00277 
00278   try
00279   {
00280         cout << testu.getLength() << endl ;
00281   }
00282   catch ( const std::exception &e )
00283   {
00284         cout << "-------------------" << endl;
00285         cout << " pb avec getLength " << endl;
00286         cout << "-------------------" << endl;
00287         MESSAGE_MED( "catched exception : " << e.what() ) ;
00288         return EXIT_FAILURE ;
00289   }
00290   catch (...)
00291   {
00292         cout << "-------------------" << endl;
00293         cout << " pb avec getLength " << endl;
00294         cout << "-------------------" << endl;
00295         return EXIT_FAILURE ;
00296   }
00297 
00298   try
00299   {
00300         cout << testu.getTime() << endl ;
00301   }
00302   catch ( const std::exception &e )
00303   {
00304         cout << "-----------------" << endl;
00305         cout << " pb avec getTime " << endl;
00306         cout << "-----------------" << endl;
00307         MESSAGE_MED( "catched exception : " << e.what() ) ;
00308         return EXIT_FAILURE ;
00309   }
00310   catch (...)
00311   {
00312         cout << "-----------------" << endl;
00313         cout << " pb avec getTime " << endl;
00314         cout << "-----------------" << endl;
00315         return EXIT_FAILURE ;
00316   }
00317 
00318   try
00319   {
00320         cout << testu.getTemperature() << endl ;
00321   }
00322   catch ( const std::exception &e )
00323   {
00324         cout << "------------------------" << endl;
00325         cout << " pb avec getTemperature " << endl;
00326         cout << "------------------------" << endl;
00327         MESSAGE_MED( "catched exception : " << e.what() ) ;
00328         return EXIT_FAILURE ;
00329   }
00330   catch (...)
00331   {
00332         cout << "------------------------" << endl;
00333         cout << " pb avec getTemperature " << endl;
00334         cout << "------------------------" << endl;
00335         return EXIT_FAILURE ;
00336   }
00337 
00338   try
00339   {
00340         cout << testu.getMatterQuantity() << endl ;
00341   }
00342   catch ( const std::exception &e )
00343   {
00344         cout << "---------------------------" << endl;
00345         cout << " pb avec getMatterQuantity " << endl;
00346         cout << "---------------------------" << endl;
00347         MESSAGE_MED( "catched exception : " << e.what() ) ;
00348         return EXIT_FAILURE ;
00349   }
00350   catch (...)
00351   {
00352         cout << "---------------------------" << endl;
00353         cout << " pb avec getMatterQuantity " << endl;
00354         cout << "---------------------------" << endl;
00355         return EXIT_FAILURE ;
00356   }
00357 
00358   try
00359   {
00360         cout << testu.getCurrentStrength() << endl ;
00361   }
00362   catch ( const std::exception &e )
00363   {
00364         cout << "----------------------------" << endl;
00365         cout << " pb avec getCurrentStrength " << endl;
00366         cout << "----------------------------" << endl;
00367         MESSAGE_MED( "catched exception : " << e.what() ) ;
00368         return EXIT_FAILURE ;
00369   }
00370   catch (...)
00371   {
00372         cout << "----------------------------" << endl;
00373         cout << " pb avec getCurrentStrength " << endl;
00374         cout << "----------------------------" << endl;
00375         return EXIT_FAILURE ;
00376   }
00377 
00378   try
00379   {
00380         cout << testu.getLightIntensity() << endl ;
00381   }
00382   catch ( const std::exception &e )
00383   {
00384         cout << "---------------------------" << endl;
00385         cout << " pb avec getLightIntensity " << endl;
00386         cout << "---------------------------" << endl;
00387         MESSAGE_MED( "catched exception : " << e.what() ) ;
00388         return EXIT_FAILURE ;
00389   }
00390   catch (...)
00391   {
00392         cout << "---------------------------" << endl;
00393         cout << " pb avec getLightIntensity " << endl;
00394         cout << "---------------------------" << endl;
00395         return EXIT_FAILURE ;
00396   }
00397 
00398   return EXIT_SUCCESS ;
00399 
00400 }