Révision 189
Ajouté par megoutteno il y a presque 4 ans
branch/Gouttenoire/sp4a12/main.c | ||
---|---|---|
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
// compare la trame et le type.
|
||
int decode_int(char c)
|
||
{
|
||
int res;
|
||
if (c>=48 && c<=57)
|
||
{
|
||
res = c-48;
|
||
}
|
||
|
||
else
|
||
{
|
||
return -1;
|
||
}
|
||
|
||
|
||
return res;
|
||
}
|
||
// test de la fonction decode_int
|
||
|
||
int trame_cmp(char* trame,char* type)
|
||
{
|
||
int i = 0, a = 0;
|
||
... | ... | |
else if ((trame[i+1] == '\0') || (type[i] == '\0') || (trame[i+1] == ','))
|
||
{
|
||
a = trame[i] - type[i];
|
||
|
||
}
|
||
else
|
||
{
|
||
... | ... | |
|
||
|
||
}
|
||
int decode_int(char c)
|
||
{
|
||
int res;
|
||
|
||
res = c-48;
|
||
|
||
|
||
return res;
|
||
}
|
||
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('A')!=(-1)){
|
||
printf ("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('5')!=(5)){
|
||
printf ("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
Formats disponibles : Unified diff
Question 7 : Test unitaire effectué