1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "MEDMEM_ModulusArray.hxx"
25 using namespace MEDMEM;
27 int main (int argc, char ** argv) {
30 int array[5]={0,1,2,1,4} ;
31 MEDMODULUSARRAY modulusArray(5,array);
33 cout<<"ModuloArray :"<<endl;
34 for(int i=-10;i<15;i++)
35 cout <<" - A["<<i<<"]="<<modulusArray[i]<<endl;
41 int array2[5]={1,4,0,1,2} ;
42 MEDMODULUSARRAY modulusArray2(5,array2) ;
43 cout<<"Same arrays, same order ... ";
44 if ((ret=modulusArray2.compare(modulusArray))!=1)
45 cout << "Error : two arrays must be identical !"<<ret<<endl;
49 int array3[5]={1,2,1,0,4} ;
50 MEDMODULUSARRAY modulusArray3(5,array3) ;
51 cout<<"Same arrays, reverse order ... ";
52 if ((ret=modulusArray3.compare(modulusArray))!=-1)
53 cout << "Error : two arrays are in reverse order !"<<ret<<endl;
57 int array4[6]={1,2,1,0} ;
58 MEDMODULUSARRAY modulusArray4(4,array4) ;
59 cout<<"Different arrays size ... ";
60 if ((ret=modulusArray4.compare(modulusArray))!=0)
61 cout << "Error : two arrays have different size !"<<ret<<endl;
65 int array5[5]={1,2,1,0,1} ;
66 MEDMODULUSARRAY modulusArray5(5,array5) ;
67 cout<<"Different array, same size ... ";
68 if ((ret=modulusArray5.compare(modulusArray))!=0)
69 cout << "Error : two arrays are not be identical !"<<ret<<endl;
77 MEDMODULUSARRAY modulusArray6(1,array6);
79 cout<<"ModuloArray 1 :"<<endl;
80 for(int i=-10;i<15;i++)
81 cout <<" - A["<<i<<"]="<<modulusArray6[i]<<endl;
85 MEDMODULUSARRAY modulusArray7(1,array7);
86 cout<<"Same arrays, same order ... ";
87 if ((ret=modulusArray6.compare(modulusArray7))!=1)
88 cout << "Error : two arrays are identical !"<<ret<<endl;
92 MEDMODULUSARRAY modulusArray8(1,array8);
93 cout<<"Different arrays ... ";
94 if ((ret=modulusArray6.compare(modulusArray8))!=0)
95 cout << "Error : two arrays are different !"<<ret<<endl;
101 int array60[2]={1,2} ;
102 MEDMODULUSARRAY modulusArray60(2,array60);
104 cout<<"ModuloArray 2 :"<<endl;
105 for(int i=-10;i<15;i++)
106 cout <<" - A["<<i<<"]="<<modulusArray60[i]<<endl;
109 int array70[2]={1,2} ;
110 MEDMODULUSARRAY modulusArray70(2,array70);
111 cout<<"Same arrays, same order ... ";
112 if ((ret=modulusArray60.compare(modulusArray70))!=1)
113 cout << "Error : two arrays are identical !"<<ret<<endl;
116 int array80[2]={2,2} ;
117 MEDMODULUSARRAY modulusArray80(2,array80);
118 cout<<"Different arrays ... ";
119 if ((ret=modulusArray60.compare(modulusArray80))!=0)
120 cout << "Error : two arrays are different !"<<ret<<endl;
123 int array90[2]={2,1} ;
124 MEDMODULUSARRAY modulusArray90(2,array90);
125 cout<<"Same arrays, reverse order ... ";
126 if ((ret=modulusArray60.compare(modulusArray90))!=-1)
127 cout << "Error : two arrays are in reverse order !"<<ret<<endl;