Back to index

salome-med  6.5.0
Functions
testUUnit.cxx File Reference
#include <cstdlib>
#include <exception>
#include "MEDMEM_Unit.hxx"

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 30 of file testUUnit.cxx.

{

  cout << "UNIT Test" << endl ;
  cout << "---------" << endl;

  UNIT testu;
  try
  {
        testu.setName("ForTesting") ;
  }
  catch ( const std::exception &e )
  {
        cout << "-----------------" << endl;
        cout << " pb avec setName " << endl;
        cout << "-----------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "-----------------" << endl;
        cout << " pb avec setName " << endl;
        cout << "-----------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setDescription("all values are setted 10") ;
  }
  catch ( const std::exception &e )
  {
        cout << "------------------------" << endl;
        cout << " pb avec setDescription " << endl;
        cout << "------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "------------------------" << endl;
        cout << " pb avec setDescription " << endl;
        cout << "------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setMasse(10);
  }
  catch ( const std::exception &e )
  {
        cout << "------------------" << endl;
        cout << " pb avec setMasse " << endl;
        cout << "------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "------------------" << endl;
        cout << " pb avec setMasse " << endl;
        cout << "------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setLength(10);
  }
  catch ( const std::exception &e )
  {
        cout << "-------------------" << endl;
        cout << " pb avec setLength " << endl;
        cout << "-------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "-------------------" << endl;
        cout << " pb avec setLength " << endl;
        cout << "-------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setTime(10);
  }
  catch ( const std::exception &e )
  {
        cout << "-----------------" << endl;
        cout << " pb avec setTime " << endl;
        cout << "-----------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "-----------------" << endl;
        cout << " pb avec setTime " << endl;
        cout << "-----------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setTemperature(10);
  }
  catch ( const std::exception &e )
  {
        cout << "------------------------" << endl;
        cout << " pb avec setTemperature " << endl;
        cout << "------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "------------------------" << endl;
        cout << " pb avec setTemperature " << endl;
        cout << "------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setMatterQuantity(10);
  }
  catch ( const std::exception &e )
  {
        cout << "---------------------------" << endl;
        cout << " pb avec setMatterQuantity " << endl;
        cout << "---------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "---------------------------" << endl;
        cout << " pb avec setMatterQuantity " << endl;
        cout << "---------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setCurrentStrength(10) ;
  }
  catch ( const std::exception &e )
  {
        cout << "---------------------------" << endl;
        cout << " pb avec setCurrentStrengt " << endl;
        cout << "---------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "---------------------------" << endl;
        cout << " pb avec setCurrentStrengt " << endl;
        cout << "---------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        testu.setLightIntensity(10) ;
  }
  catch ( const std::exception &e )
  {
        cout << "---------------------------" << endl;
        cout << " pb avec setLightIntensity " << endl;
        cout << "---------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "---------------------------" << endl;
        cout << " pb avec setLightIntensity " << endl;
        cout << "---------------------------" << endl;
        return EXIT_FAILURE ;
  }


  try
  {
        cout << testu.getName() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "-----------------" << endl;
        cout << " pb avec getName " << endl;
        cout << "-----------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "-----------------" << endl;
        cout << " pb avec getName " << endl;
        cout << "-----------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getDescription() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "------------------------" << endl;
        cout << " pb avec getDescription " << endl;
        cout << "------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "------------------------" << endl;
        cout << " pb avec getDescription " << endl;
        cout << "------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getMasse() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "------------------" << endl;
        cout << " pb avec getMasse " << endl;
        cout << "------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "------------------" << endl;
        cout << " pb avec getMasse " << endl;
        cout << "------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getLength() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "-------------------" << endl;
        cout << " pb avec getLength " << endl;
        cout << "-------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "-------------------" << endl;
        cout << " pb avec getLength " << endl;
        cout << "-------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getTime() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "-----------------" << endl;
        cout << " pb avec getTime " << endl;
        cout << "-----------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "-----------------" << endl;
        cout << " pb avec getTime " << endl;
        cout << "-----------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getTemperature() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "------------------------" << endl;
        cout << " pb avec getTemperature " << endl;
        cout << "------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "------------------------" << endl;
        cout << " pb avec getTemperature " << endl;
        cout << "------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getMatterQuantity() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "---------------------------" << endl;
        cout << " pb avec getMatterQuantity " << endl;
        cout << "---------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "---------------------------" << endl;
        cout << " pb avec getMatterQuantity " << endl;
        cout << "---------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getCurrentStrength() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "----------------------------" << endl;
        cout << " pb avec getCurrentStrength " << endl;
        cout << "----------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "----------------------------" << endl;
        cout << " pb avec getCurrentStrength " << endl;
        cout << "----------------------------" << endl;
        return EXIT_FAILURE ;
  }

  try
  {
        cout << testu.getLightIntensity() << endl ;
  }
  catch ( const std::exception &e )
  {
        cout << "---------------------------" << endl;
        cout << " pb avec getLightIntensity " << endl;
        cout << "---------------------------" << endl;
        MESSAGE_MED( "catched exception : " << e.what() ) ;
        return EXIT_FAILURE ;
  }
  catch (...)
  {
        cout << "---------------------------" << endl;
        cout << " pb avec getLightIntensity " << endl;
        cout << "---------------------------" << endl;
        return EXIT_FAILURE ;
  }

  return EXIT_SUCCESS ;

}