Révision 27
Ajouté par Enzo LACHEZE il y a environ 3 ans
main.c | ||
---|---|---|
0};
|
||
|
||
|
||
int trame_cmp(char* trame, char* type)
|
||
/*int trame_cmp(char* trame, char* type)
|
||
{
|
||
int i ;
|
||
int res;
|
||
... | ... | |
}
|
||
}
|
||
return res;
|
||
}
|
||
}*/
|
||
|
||
int decode_int(char c)
|
||
{
|
||
int res;
|
||
res=c-48;
|
||
if(res>9)
|
||
{
|
||
res=-1;
|
||
}
|
||
return res;
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
static int cpt=0;
|
||
cpt++;
|
||
//printf ("> %s\n",trame);
|
||
printf ("> %s\n",trame);
|
||
|
||
if (trame_cmp(trame, "GPGGA")==1)
|
||
/*if (trame_cmp(trame, "GPGGA")==1)
|
||
{
|
||
printf ("> %s\n",trame);
|
||
}
|
||
}*/
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
... | ... | |
if (5!=5){
|
||
printf ("Erreur Test unitaire basique.\n");
|
||
exit(-1);
|
||
}
|
||
if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
}
|
||
//test trame
|
||
/*if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
... | ... | |
if (trame_cmp("$APRMC...", "GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}*/
|
||
//test decode_int
|
||
if(decode_int('5')!=5){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('0')!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('9')!=9){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('A')!=-1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('Z')!=-1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
Formats disponibles : Unified diff
question 6 finie et testée