Révision 78
Ajouté par begresset il y a environ 4 ans
branch/gresset/sp4a12/main.c | ||
---|---|---|
"$GPVTG,99.4,T,,M,0.4,N,0.7,K*57",
|
||
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
//Comparaison des trames
|
||
int trame_cmp(char * trame, char * type){
|
||
|
||
int i=0, j=0, resultat=1;
|
||
... | ... | |
|
||
}
|
||
|
||
int decode_int(char c){
|
||
int a=0;
|
||
if (c>=48 && c<=57){
|
||
a=c-48;
|
||
}
|
||
else{
|
||
a=-1;
|
||
}
|
||
return a;
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
if (5!=5){
|
||
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("$APRMC...", "GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}*/
|
||
|
||
|
||
//Tests unitaires de decode_int
|
||
if (decode_int('0')!=0){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('1')!=1){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('2')!=2){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('3')!=3){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('4')!=4){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('5')!=5){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('6')!=6){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('7')!=7){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('8')!=8){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('9')!=9){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('A')!=-1){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('B')!=-1){
|
||
printf("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
Formats disponibles : Unified diff
Implantation de la fonction decode_int() et des tests unitaires.