Révision 254
Ajouté par alpuech il y a environ 3 ans
branch/PUECH_Alexis/sp4a12/main.c | ||
---|---|---|
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
static int cpt=0 ;
|
||
cpt++ ;
|
||
printf ("> %s\n",trame);
|
||
static int cpt=0;
|
||
if(trame_cmp(trame,"GPGGA")==1)
|
||
{
|
||
printf ("> %s\n",trame);
|
||
cpt++;
|
||
}
|
||
}
|
||
|
||
//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){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-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);
|
||
}
|
||
}
|
||
|
||
int decode_int(char c)//Fonction qui permet de passer d'un caratere a un entier
|
||
{
|
||
if(c>='0' && c<='9')
|
||
{
|
||
c-=48;
|
||
}
|
||
else
|
||
{
|
||
return -1;
|
||
}
|
||
}
|
||
|
||
int test_decode_int()//A verifer
|
||
{
|
||
int verif=1;
|
||
if(decode_int('0')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('1')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('2')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('3')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('4')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('5')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('6')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('7')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('8')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
if(decode_int('9')!=0)
|
||
{
|
||
verif=0;
|
||
}
|
||
|
||
return verif;
|
||
}
|
||
|
||
|
||
int trame_cmp(char * trame,char * type)
|
||
{
|
||
int i;
|
||
int verif=1;
|
||
|
||
for(i=0;i<5;i++)
|
||
{
|
||
if(trame[i+1]!=type[i])//verifie que le debut de la trame correspond au caractere type
|
||
{
|
||
verif=0;
|
||
}
|
||
}
|
||
return verif;
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
||
{
|
Formats disponibles : Unified diff
question 4 5 et 6