4 #include "MEDMEM_ModulusArray.hxx"
5 using namespace MEDMEM;
7 int main (int argc, char ** argv) {
11 int array[5]={0,1,2,1,4} ;
12 MEDMODULUSARRAY modulusArray(5,array);
14 cout<<"ModuloArray :"<<endl;
15 for(int i=-10;i<15;i++)
16 cout <<" - A["<<i<<"]="<<modulusArray[i]<<endl;
22 int array2[5]={1,4,0,1,2} ;
23 MEDMODULUSARRAY modulusArray2(5,array2) ;
24 cout<<"Same arrays, same order ... ";
25 if ((ret=modulusArray2.compare(modulusArray))!=1)
26 cout << "Error : two arrays must be identical !"<<ret<<endl;
30 int array3[5]={1,2,1,0,4} ;
31 MEDMODULUSARRAY modulusArray3(5,array3) ;
32 cout<<"Same arrays, reverse order ... ";
33 if ((ret=modulusArray3.compare(modulusArray))!=-1)
34 cout << "Error : two arrays are in reverse order !"<<ret<<endl;
38 int array4[6]={1,2,1,0} ;
39 MEDMODULUSARRAY modulusArray4(4,array4) ;
40 cout<<"Different arrays size ... ";
41 if ((ret=modulusArray4.compare(modulusArray))!=0)
42 cout << "Error : two arrays have different size !"<<ret<<endl;
46 int array5[5]={1,2,1,0,1} ;
47 MEDMODULUSARRAY modulusArray5(5,array5) ;
48 cout<<"Different array, same size ... ";
49 if ((ret=modulusArray5.compare(modulusArray))!=0)
50 cout << "Error : two arrays are not be identical !"<<ret<<endl;
58 MEDMODULUSARRAY modulusArray6(1,array6);
60 cout<<"ModuloArray 1 :"<<endl;
61 for(int i=-10;i<15;i++)
62 cout <<" - A["<<i<<"]="<<modulusArray6[i]<<endl;
66 MEDMODULUSARRAY modulusArray7(1,array7);
67 cout<<"Same arrays, same order ... ";
68 if ((ret=modulusArray6.compare(modulusArray7))!=1)
69 cout << "Error : two arrays are identical !"<<ret<<endl;
73 MEDMODULUSARRAY modulusArray8(1,array8);
74 cout<<"Different arrays ... ";
75 if ((ret=modulusArray6.compare(modulusArray8))!=0)
76 cout << "Error : two arrays are different !"<<ret<<endl;
82 int array60[2]={1,2} ;
83 MEDMODULUSARRAY modulusArray60(2,array60);
85 cout<<"ModuloArray 2 :"<<endl;
86 for(int i=-10;i<15;i++)
87 cout <<" - A["<<i<<"]="<<modulusArray60[i]<<endl;
90 int array70[2]={1,2} ;
91 MEDMODULUSARRAY modulusArray70(2,array70);
92 cout<<"Same arrays, same order ... ";
93 if ((ret=modulusArray60.compare(modulusArray70))!=1)
94 cout << "Error : two arrays are identical !"<<ret<<endl;
97 int array80[2]={2,2} ;
98 MEDMODULUSARRAY modulusArray80(2,array80);
99 cout<<"Different arrays ... ";
100 if ((ret=modulusArray60.compare(modulusArray80))!=0)
101 cout << "Error : two arrays are different !"<<ret<<endl;
104 int array90[2]={2,1} ;
105 MEDMODULUSARRAY modulusArray90(2,array90);
106 cout<<"Same arrays, reverse order ... ";
107 if ((ret=modulusArray60.compare(modulusArray90))!=-1)
108 cout << "Error : two arrays are in reverse order !"<<ret<<endl;