3 #include "MEDMEM_ModulusArray.hxx"
6 using namespace MEDMEM;
8 int main (int argc, char ** argv) {
12 int array[5]={0,1,2,1,4} ;
13 MEDMODULUSARRAY modulusArray(5,array);
15 cout<<"ModuloArray :"<<endl;
16 for(int i=-10;i<15;i++)
17 cout <<" - A["<<i<<"]="<<modulusArray[i]<<endl;
23 int array2[5]={1,4,0,1,2} ;
24 MEDMODULUSARRAY modulusArray2(5,array2) ;
25 cout<<"Same arrays, same order ... ";
26 if ((ret=modulusArray2.compare(modulusArray))!=1)
27 cout << "Error : two arrays must be identical !"<<ret<<endl;
31 int array3[5]={1,2,1,0,4} ;
32 MEDMODULUSARRAY modulusArray3(5,array3) ;
33 cout<<"Same arrays, reverse order ... ";
34 if ((ret=modulusArray3.compare(modulusArray))!=-1)
35 cout << "Error : two arrays are in reverse order !"<<ret<<endl;
39 int array4[6]={1,2,1,0} ;
40 MEDMODULUSARRAY modulusArray4(4,array4) ;
41 cout<<"Different arrays size ... ";
42 if ((ret=modulusArray4.compare(modulusArray))!=0)
43 cout << "Error : two arrays have different size !"<<ret<<endl;
47 int array5[5]={1,2,1,0,1} ;
48 MEDMODULUSARRAY modulusArray5(5,array5) ;
49 cout<<"Different array, same size ... ";
50 if ((ret=modulusArray5.compare(modulusArray))!=0)
51 cout << "Error : two arrays are not be identical !"<<ret<<endl;
59 MEDMODULUSARRAY modulusArray6(1,array6);
61 cout<<"ModuloArray 1 :"<<endl;
62 for(int i=-10;i<15;i++)
63 cout <<" - A["<<i<<"]="<<modulusArray6[i]<<endl;
67 MEDMODULUSARRAY modulusArray7(1,array7);
68 cout<<"Same arrays, same order ... ";
69 if ((ret=modulusArray6.compare(modulusArray7))!=1)
70 cout << "Error : two arrays are identical !"<<ret<<endl;
74 MEDMODULUSARRAY modulusArray8(1,array8);
75 cout<<"Different arrays ... ";
76 if ((ret=modulusArray6.compare(modulusArray8))!=0)
77 cout << "Error : two arrays are different !"<<ret<<endl;
83 int array60[2]={1,2} ;
84 MEDMODULUSARRAY modulusArray60(2,array60);
86 cout<<"ModuloArray 2 :"<<endl;
87 for(int i=-10;i<15;i++)
88 cout <<" - A["<<i<<"]="<<modulusArray60[i]<<endl;
91 int array70[2]={1,2} ;
92 MEDMODULUSARRAY modulusArray70(2,array70);
93 cout<<"Same arrays, same order ... ";
94 if ((ret=modulusArray60.compare(modulusArray70))!=1)
95 cout << "Error : two arrays are identical !"<<ret<<endl;
98 int array80[2]={2,2} ;
99 MEDMODULUSARRAY modulusArray80(2,array80);
100 cout<<"Different arrays ... ";
101 if ((ret=modulusArray60.compare(modulusArray80))!=0)
102 cout << "Error : two arrays are different !"<<ret<<endl;
105 int array90[2]={2,1} ;
106 MEDMODULUSARRAY modulusArray90(2,array90);
107 cout<<"Same arrays, reverse order ... ";
108 if ((ret=modulusArray60.compare(modulusArray90))!=-1)
109 cout << "Error : two arrays are in reverse order !"<<ret<<endl;