Révision 91
Ajouté par Khalid YAZID il y a environ 3 ans
branch/yazid/sp4a12/main.c | ||
---|---|---|
}
|
||
}
|
||
return test;
|
||
}
|
||
int decode_int(char c){
|
||
int x=c;
|
||
x=x-48;
|
||
return x;
|
||
}
|
||
void test_decode_int(void){
|
||
int i,j,s;
|
||
char *C[]= {"0","1","2","3","4","5","6","7","8","9"};
|
||
int T[]= {0,1,2,3,4,5,6,7,9,8};
|
||
for(i=0;i<10;i++){
|
||
s=0;
|
||
for(j=0;j<10;j++){
|
||
if (decode_int(*C[i])==T[j]){
|
||
s=1;
|
||
}
|
||
}
|
||
if (s!=1){
|
||
printf("ERREUR DECODE_INT.\n");
|
||
}
|
||
}
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
... | ... | |
if (5!=5){
|
||
printf ("Erreur Test unitaire basique.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
test_decode_int();
|
||
|
||
/* if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
Formats disponibles : Unified diff
Implantation de la fonction decode_int() et le test unitaire test_decode_int(void) de
decode_int() qui teste exhaustivement la fonction decode_int().