Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / src / MEDSPLITTER / Test / MEDSPLITTERTest.hxx
1 // Copyright (C) 2006  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
8 //
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20
21 #ifndef _MEDSPLITTERTEST_HXX_
22 #define _MEDSPLITTERTEST_HXX_
23
24 #include <cppunit/extensions/HelperMacros.h>
25
26 #include <set>
27 #include <string>
28 #include <iostream>
29
30 namespace MEDSPLITTER {
31   class MESH;
32 };
33
34 class MEDSPLITTERTest : public CppUnit::TestFixture
35 {
36   CPPUNIT_TEST_SUITE( MEDSPLITTERTest );
37   CPPUNIT_TEST( testMESHCollection_constructor );
38   CPPUNIT_TEST( testMESHCollection_read_seq);
39   CPPUNIT_TEST( testMESHCollection_read_para);
40   CPPUNIT_TEST( testMESHCollection_square);
41   CPPUNIT_TEST( testMESHCollection_square_with_faces);
42   CPPUNIT_TEST( testMESHCollection_indivisible);
43   CPPUNIT_TEST( testMESHCollection_user_partition);
44   CPPUNIT_TEST( testParallelTopology_graph_constructor);
45   CPPUNIT_TEST( testMESHCollection_complete_sequence);
46   CPPUNIT_TEST( testMESHCollection_complete_sequence_with_polygon);
47         CPPUNIT_TEST( testMESHCollection_families);
48 //  CPPUNIT_TEST( testMESHCollection_complete_sequence_with_polyhedra);
49   CPPUNIT_TEST_SUITE_END();
50
51 public:
52
53   void setUp();
54   void tearDown();
55
56   void testMESHCollection_constructor();
57   void testMESHCollection_read_seq();
58   void testMESHCollection_read_para();
59   void testMESHCollection_square();
60   void testMESHCollection_square_with_faces();
61   void testMESHCollection_indivisible();
62   void testMESHCollection_user_partition();
63   void testMESHCollection_complete_sequence();
64   void testMESHCollection_complete_sequence_with_polygon();
65   void testMESHCollection_complete_sequence_with_polyhedra();
66         void testMESHCollection_families();
67   void testParallelTopology_graph_constructor();
68     
69   };
70
71 // to automatically remove temporary files from disk
72 class MEDSPLITTERTest_TmpFilesRemover
73 {
74 public:
75   MEDSPLITTERTest_TmpFilesRemover() {}
76   ~MEDSPLITTERTest_TmpFilesRemover();
77   bool Register(const std::string theTmpFile);
78
79 private:
80   std::set<std::string> myTmpFiles;
81 };
82
83 /*!
84  *  Tool to print array to stream.
85  */
86 template<class T>
87 void MEDSPLITTERTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
88 {
89   stream << text << ": {";
90   if (length > 0) {
91     stream << array[0];
92     for (int i = 1; i < length; i++) {
93       stream << ", " << array[i];
94     }
95   }
96   stream << "}" << std::endl;
97 };
98
99 #endif