Révision 281
Ajouté par Yaye Oumy NDONG il y a environ 3 ans
branch/Ndong_Yaye_Oumy/sp4a12/main.c | ||
---|---|---|
int decode_int(char car){
|
||
int entier;
|
||
if(car<='9' && car>='0'){
|
||
entier= car- 48;
|
||
entier= car-48;
|
||
}else{
|
||
entier=-1;
|
||
}
|
||
... | ... | |
return s;
|
||
}
|
||
|
||
|
||
void test_decode_nombre (void){
|
||
if(decode_nombre('0',1)!=0){
|
||
printf("ereur test unitaire");
|
||
}
|
||
if(decode_nombre('5145',2)!=51){
|
||
printf("ereur test unitaire");
|
||
}
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
int s;
|
||
static int cpt=0;
|
||
cpt++;
|
||
s=decode_nombre('7854',2);
|
||
//s=trame_cmp(trame,"GPGGA");
|
||
printf("%d",s);
|
||
|
||
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
|
||
/*if (5!=5){
|
||
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(decode_int('0')!=0){
|
||
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_nombre("5145",2)!=51){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_nombre("1234",2)!=12){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
|
||
}
|
||
|
||
|
Formats disponibles : Unified diff
modification de l'emplacement des tests unitaires pour les questions 6 et 7 (decode_int et decode_nombre)