Révision 122
Ajouté par malameynar il y a environ 4 ans
main.c | ||
---|---|---|
int decode_int(char c)
|
||
{
|
||
int r=c-'0';
|
||
if (r>9){
|
||
if (r<0 || r>9){
|
||
r=-1;
|
||
}
|
||
|
||
... | ... | |
if (trame_cmp("$APRMC...", "GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
}
|
||
test_decode_int();
|
||
}
|
||
test_decode_int(void){
|
||
int i;
|
||
|
||
|
||
for(i=0;i<128;i++){
|
||
printf("%c",i);
|
||
if(i>47 && i<58){
|
||
printf("cas 1\n");
|
||
if(decode_int(i)==-1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
printf("%d",i);
|
||
exit(-1);
|
||
}
|
||
}
|
||
else{
|
||
printf("cas 2\n");
|
||
if(decode_int(i)!=-1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
printf("%d",i);
|
||
exit(-1);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
ajout de la fonction test_decode_int qui est testé pour tous les caractères ascci