1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "MEDMEM_ModulusArray.hxx"
23 using namespace MEDMEM;
25 int main (int argc, char ** argv) {
28 int array[5]={0,1,2,1,4} ;
29 MEDMODULUSARRAY modulusArray(5,array);
31 cout<<"ModuloArray :"<<endl;
32 for(int i=-10;i<15;i++)
33 cout <<" - A["<<i<<"]="<<modulusArray[i]<<endl;
39 int array2[5]={1,4,0,1,2} ;
40 MEDMODULUSARRAY modulusArray2(5,array2) ;
41 cout<<"Same arrays, same order ... ";
42 if ((ret=modulusArray2.compare(modulusArray))!=1)
43 cout << "Error : two arrays must be identical !"<<ret<<endl;
47 int array3[5]={1,2,1,0,4} ;
48 MEDMODULUSARRAY modulusArray3(5,array3) ;
49 cout<<"Same arrays, reverse order ... ";
50 if ((ret=modulusArray3.compare(modulusArray))!=-1)
51 cout << "Error : two arrays are in reverse order !"<<ret<<endl;
55 int array4[6]={1,2,1,0} ;
56 MEDMODULUSARRAY modulusArray4(4,array4) ;
57 cout<<"Different arrays size ... ";
58 if ((ret=modulusArray4.compare(modulusArray))!=0)
59 cout << "Error : two arrays have different size !"<<ret<<endl;
63 int array5[5]={1,2,1,0,1} ;
64 MEDMODULUSARRAY modulusArray5(5,array5) ;
65 cout<<"Different array, same size ... ";
66 if ((ret=modulusArray5.compare(modulusArray))!=0)
67 cout << "Error : two arrays are not be identical !"<<ret<<endl;
75 MEDMODULUSARRAY modulusArray6(1,array6);
77 cout<<"ModuloArray 1 :"<<endl;
78 for(int i=-10;i<15;i++)
79 cout <<" - A["<<i<<"]="<<modulusArray6[i]<<endl;
83 MEDMODULUSARRAY modulusArray7(1,array7);
84 cout<<"Same arrays, same order ... ";
85 if ((ret=modulusArray6.compare(modulusArray7))!=1)
86 cout << "Error : two arrays are identical !"<<ret<<endl;
90 MEDMODULUSARRAY modulusArray8(1,array8);
91 cout<<"Different arrays ... ";
92 if ((ret=modulusArray6.compare(modulusArray8))!=0)
93 cout << "Error : two arrays are different !"<<ret<<endl;
99 int array60[2]={1,2} ;
100 MEDMODULUSARRAY modulusArray60(2,array60);
102 cout<<"ModuloArray 2 :"<<endl;
103 for(int i=-10;i<15;i++)
104 cout <<" - A["<<i<<"]="<<modulusArray60[i]<<endl;
107 int array70[2]={1,2} ;
108 MEDMODULUSARRAY modulusArray70(2,array70);
109 cout<<"Same arrays, same order ... ";
110 if ((ret=modulusArray60.compare(modulusArray70))!=1)
111 cout << "Error : two arrays are identical !"<<ret<<endl;
114 int array80[2]={2,2} ;
115 MEDMODULUSARRAY modulusArray80(2,array80);
116 cout<<"Different arrays ... ";
117 if ((ret=modulusArray60.compare(modulusArray80))!=0)
118 cout << "Error : two arrays are different !"<<ret<<endl;
121 int array90[2]={2,1} ;
122 MEDMODULUSARRAY modulusArray90(2,array90);
123 cout<<"Same arrays, reverse order ... ";
124 if ((ret=modulusArray60.compare(modulusArray90))!=-1)
125 cout << "Error : two arrays are in reverse order !"<<ret<<endl;