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