Révision 22
Ajouté par Lea DUVIVIER il y a environ 3 ans
main.c | ||
---|---|---|
"$GPVTG,99.4,T,,M,0.4,N,0.7,K*57",
|
||
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
|
||
int trame_cmp(char * trame, char * type)
|
||
{
|
||
int i;
|
||
int ok;
|
||
ok=1;
|
||
for(i=0;i<5;i=i+1)
|
||
|
||
{
|
||
if(trame[i+1]!=type[i])
|
||
{
|
||
ok=0;
|
||
}
|
||
|
||
}
|
||
return ok;
|
||
}
|
||
int decode_int(char c)
|
||
{
|
||
int decode;
|
||
if(c<='9' && c>='0')
|
||
{
|
||
decode=c-48;
|
||
}
|
||
return decode;
|
||
}
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
... | ... | |
printf ("Erreur Test unitaire basique.\n");
|
||
exit(-1);
|
||
}
|
||
/*if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}*/
|
||
}
|
||
if (trame_cmp("$GPRMC suite chaine","GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (trame_cmp("$GPRMC... ", "GPRMC" )!=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);
|
||
}
|
||
if(decode_int("5")!=5)
|
||
{
|
||
printf("Erreur du test decode int");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
Formats disponibles : Unified diff
Fonctionnement de decode_int et de trame_cp avec les tests unitaires qui fonctionnent