Salome HOME
18cc9be5ac2282c36743f559c3c004b04118108c
[modules/med.git] / src / MEDCouplingCorba / Test / TestMEDCouplingCorbaClt.cxx
1 // Copyright (C) 2007-2020  CEA/DEN, EDF R&D
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, or (at your option) any later version.
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 // Author : Anthony Geay (CEA/DEN)
20
21 #include "MEDCouplingMeshFieldFactoryComponentClt.hxx"
22 #include "MEDCouplingMeshFieldFactoryComponent.hxx"
23 #include "MEDCouplingUMeshClient.hxx"
24
25 #include <cppunit/CompilerOutputter.h>
26 #include <cppunit/TestResult.h>
27 #include <cppunit/TestResultCollector.h>
28 #include <cppunit/TextTestProgressListener.h>
29 #include <cppunit/BriefTestProgressListener.h>
30 #include <cppunit/extensions/TestFactoryRegistry.h>
31 #include <cppunit/TestRunner.h>
32
33 #include CORBA_CLIENT_HEADER(MEDCouplingCorbaServantTest)
34
35 #include <stdexcept>
36 #include <iostream>
37 #include <fstream>
38
39 using namespace MEDCoupling;
40
41 CPPUNIT_TEST_SUITE_REGISTRATION( SALOME_TEST::MEDCouplingCorbaServBasicsTestClt );
42
43 int main(int argc, char* argv[])
44 {
45   CPPUNIT_NS::TestResult controller;
46   CPPUNIT_NS::TestResultCollector result;
47   controller.addListener( &result );        
48 #ifdef WIN32
49   CPPUNIT_NS::TextTestProgressListener progress;
50 #else
51   CPPUNIT_NS::BriefTestProgressListener progress;
52 #endif
53   controller.addListener( &progress );
54   SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_argc=argc;
55   SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_argv=argv;
56   CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
57   CPPUNIT_NS::TestRunner runner;
58   runner.addTest( suite );
59   runner.run( controller);
60   // ---  Print test in a compiler compatible format.
61   std::ofstream testFile;
62   testFile.open("UnitTestsResult", std::ios::out |  std::ios::trunc);
63   //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
64   CPPUNIT_NS::CompilerOutputter outputter( &result, testFile );
65   outputter.write(); 
66   // ---  Run the tests.
67   bool wasSucessful = result.wasSuccessful();
68   testFile.close();
69   // ---  Return error code 1 if the one of test failed.
70   return wasSucessful ? 0 : 1;
71 }