Révision 255
Ajouté par Youssef MORSY il y a environ 3 ans
branch/MORSY/sp4a12/main.c | ||
---|---|---|
}
|
||
}
|
||
|
||
/*if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}*/
|
||
|
||
int decode_nombre(char *ch,int n){
|
||
int x=strlen(ch);
|
||
int i=0;
|
||
int s=0;
|
||
for (i=0;i<n;i++){
|
||
int a=decode_int(ch[i]);
|
||
s=s+a*pow(10,n-i-1);
|
||
}
|
||
void test_decode_nombre(void){
|
||
if (5!=5){
|
||
printf ("Erreur Test unitaire basique.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("35789",3)!=357){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
if (decode_nombre("25986452235",7)!=2598645){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("2",1)!=2){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("25986452235",7)==2578963){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
int l;
|
||
for (l=0;l<=1;l++){
|
||
if (decode_nombre("2",1)==i){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
int j;
|
||
for (j=2;j<=9;j++){
|
||
if (decode_nombre("2",1)==i){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
||
{
|
Formats disponibles : Unified diff
fin question 7