Révision 29
Ajouté par Enzo LACHEZE il y a environ 3 ans
main.c | ||
---|---|---|
}
|
||
return res;
|
||
}
|
||
|
||
int decode_nombre(char* ch, int n)
|
||
{
|
||
int i;
|
||
int s=0;
|
||
for(i=0;i<n;i++)
|
||
{
|
||
s=(s*10)+decode_int(ch[i]);
|
||
}
|
||
return s;
|
||
}
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
... | ... | |
exit(-1);
|
||
}*/
|
||
//test decode_int
|
||
if(decode_int('5')!=5){
|
||
/*if(decode_int('5')!=5){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
... | ... | |
if(decode_int('Z')!=-1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}*/
|
||
//test decode_nombre
|
||
if(decode_nombre("7541",2)!=75){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_nombre("7541",3)!=754){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_nombre("123",3)!=123){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_nombre("987654321",2)!=98){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
Formats disponibles : Unified diff
question 7 faites, test decode_nombre valide