Révision 147
Ajouté par Guillaume DAVID il y a environ 3 ans
branch/david_guillaume/sp4a12/main.c | ||
---|---|---|
0};
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
void traitement(char * trame){
|
||
static int cpt=0;
|
||
cpt++;
|
||
|
||
... | ... | |
}
|
||
}
|
||
|
||
int trame_cmp(char *trame, char *type)
|
||
{
|
||
int trame_cmp(char *trame, char *type){
|
||
int test=1;
|
||
int i;
|
||
|
||
... | ... | |
|
||
return test;
|
||
}
|
||
|
||
int decode_int(char c){
|
||
int res;
|
||
|
||
if((c>=48)&&(c<=58)){
|
||
res=c-48;
|
||
}
|
||
else{
|
||
res=-1;
|
||
}
|
||
return res;
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
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");
|
||
... | ... | |
if(trame_cmp("$APRMC suite chaine","GPGGA")!=0){
|
||
printf("Erreur test unitaire trame_cmp\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
test_decode_int();
|
||
}
|
||
|
||
void test_decode_int(void){
|
||
if(decode_int('0')!=0){
|
||
printf("Erreur test unitaire decode-int10\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('1')!=1){
|
||
printf("Erreur test unitaire decode-int11\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('2')!=2){
|
||
printf("Erreur test unitaire decode-int12\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('3')!=3){
|
||
printf("Erreur test unitaire decode-int13\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('4')!=4){
|
||
printf("Erreur test unitaire decode-int14\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('5')!=5){
|
||
printf("Erreur test unitaire decode-int15\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('6')!=6){
|
||
printf("Erreur test unitaire decode-int16\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('7')!=7){
|
||
printf("Erreur test unitaire decode-int17\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('8')!=8){
|
||
printf("Erreur test unitaire decode-int18\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('9')!=9){
|
||
printf("Erreur test unitaire decode-int19\n");
|
||
exit(-1);
|
||
}
|
||
|
||
if(decode_int('A')!=-1){
|
||
printf("Erreur test unitaire decode-int2\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('Z')!=-1){
|
||
printf("Erreur test unitaire decode-int3\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
implementation decode_int et ses test unitaires