1 // MED MEDMEM : MED files in memory
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : test_MEDMEM_ModulusArray.cxx
28 #include "utilities.h"
30 #include "MEDMEM_ModulusArray.hxx"
32 int main (int argc, char ** argv) {
36 int array[5]={0,1,2,1,4} ;
37 MEDMODULUSARRAY modulusArray(5,array);
39 cout<<"ModuloArray :"<<endl;
40 for(int i=-10;i<15;i++)
41 cout <<" - A["<<i<<"]="<<modulusArray[i]<<endl;
47 int array2[5]={1,4,0,1,2} ;
48 MEDMODULUSARRAY modulusArray2(5,array2) ;
49 cout<<"Same arrays, same order ... ";
50 if ((ret=modulusArray2.compare(modulusArray))!=1)
51 cout << "Error : two arrays must be identical !"<<ret<<endl;
55 int array3[5]={1,2,1,0,4} ;
56 MEDMODULUSARRAY modulusArray3(5,array3) ;
57 cout<<"Same arrays, reverse order ... ";
58 if ((ret=modulusArray3.compare(modulusArray))!=-1)
59 cout << "Error : two arrays are in reverse order !"<<ret<<endl;
63 int array4[6]={1,2,1,0} ;
64 MEDMODULUSARRAY modulusArray4(4,array4) ;
65 cout<<"Different arrays size ... ";
66 if ((ret=modulusArray4.compare(modulusArray))!=0)
67 cout << "Error : two arrays have different size !"<<ret<<endl;
71 int array5[5]={1,2,1,0,1} ;
72 MEDMODULUSARRAY modulusArray5(5,array5) ;
73 cout<<"Different array, same size ... ";
74 if ((ret=modulusArray5.compare(modulusArray))!=0)
75 cout << "Error : two arrays are not be identical !"<<ret<<endl;
83 MEDMODULUSARRAY modulusArray6(1,array6);
85 cout<<"ModuloArray 1 :"<<endl;
86 for(int i=-10;i<15;i++)
87 cout <<" - A["<<i<<"]="<<modulusArray6[i]<<endl;
91 MEDMODULUSARRAY modulusArray7(1,array7);
92 cout<<"Same arrays, same order ... ";
93 if ((ret=modulusArray6.compare(modulusArray7))!=1)
94 cout << "Error : two arrays are identical !"<<ret<<endl;
98 MEDMODULUSARRAY modulusArray8(1,array8);
99 cout<<"Different arrays ... ";
100 if ((ret=modulusArray6.compare(modulusArray8))!=0)
101 cout << "Error : two arrays are different !"<<ret<<endl;
107 int array60[2]={1,2} ;
108 MEDMODULUSARRAY modulusArray60(2,array60);
110 cout<<"ModuloArray 2 :"<<endl;
111 for(int i=-10;i<15;i++)
112 cout <<" - A["<<i<<"]="<<modulusArray60[i]<<endl;
115 int array70[2]={1,2} ;
116 MEDMODULUSARRAY modulusArray70(2,array70);
117 cout<<"Same arrays, same order ... ";
118 if ((ret=modulusArray60.compare(modulusArray70))!=1)
119 cout << "Error : two arrays are identical !"<<ret<<endl;
122 int array80[2]={2,2} ;
123 MEDMODULUSARRAY modulusArray80(2,array80);
124 cout<<"Different arrays ... ";
125 if ((ret=modulusArray60.compare(modulusArray80))!=0)
126 cout << "Error : two arrays are different !"<<ret<<endl;
129 int array90[2]={2,1} ;
130 MEDMODULUSARRAY modulusArray90(2,array90);
131 cout<<"Same arrays, reverse order ... ";
132 if ((ret=modulusArray60.compare(modulusArray90))!=-1)
133 cout << "Error : two arrays are in reverse order !"<<ret<<endl;