Révision 97
Ajouté par Yaye Oumy NDONG il y a environ 3 ans
branch/Ndong_Yaye_Oumy/sp4a12/main.c | ||
---|---|---|
|
||
int trame_cmp(char* trame,char *type){
|
||
int i, ok =1 ;
|
||
for(i=0 ;i<=5 ;i=i+1){
|
||
for(i=0 ;i<=4 ;i=i+1){
|
||
if (trame[i+1] !=type[i]){
|
||
ok=0;
|
||
}
|
||
} return ok;
|
||
}
|
||
return ok;
|
||
}
|
||
|
||
/*int decode_int(char car){
|
||
int entier=car;
|
||
if(car<='9' && car>='0'){
|
||
entier= entier- 48;
|
||
}else{
|
||
entier=-1;
|
||
}
|
||
return entier;
|
||
}*/
|
||
|
||
/*void test_decode_int (void){
|
||
if(decode_int('0')!=0){
|
||
printf("ereur test unitaire");
|
||
}
|
||
if(decode_int('4')==0){
|
||
printf("ereur test unitaire");
|
||
}
|
||
if(decode_int('5')!=5){
|
||
printf("ereur test unitaire");
|
||
}
|
||
if(decode_int('A')!=(-1)){
|
||
printf("ereur test unitaire");
|
||
}
|
||
}*/
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
int s;
|
||
static int cpt=0;
|
||
cpt++;
|
||
trame_cmp("$GPGGA suite chaine","GPGGA");
|
||
cpt++;
|
||
//s=decode_int('0');
|
||
s=trame_cmp(trame,"GPGGA");
|
||
printf("%d",s);
|
||
if (s==1){
|
||
printf("%s",trame);
|
||
}
|
||
/*if (s==1){
|
||
printf("%s",trame);
|
||
}*/
|
||
|
||
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
if (5!=5){
|
||
void tests_unitaires(void){
|
||
|
||
/*if (5!=5){
|
||
printf ("Erreur Test unitaire basique.\n");
|
||
exit(-1);
|
||
exit(-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);
|
||
}
|
||
/*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);
|
||
}*/
|
||
}
|
||
|
||
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
question 5 séance 1 (sélection des trames GPGGA)