Révision 82
Ajouté par Titouan PODGORSKI il y a environ 3 ans
branch/Podgorski/sp4a12/main.c | ||
---|---|---|
return b;
|
||
}
|
||
|
||
int decode_nombre(char *ch,int n){
|
||
|
||
int i,res=0;
|
||
for(i=0;i<n;i++){
|
||
|
||
res+=decode_int(ch[i])*pow(10,(n-i-1));
|
||
}
|
||
return res;
|
||
}
|
||
|
||
|
||
int trame_cmp(char *trame, char *type){
|
||
|
||
int i,test=1;
|
||
... | ... | |
printf ("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
void test_decode_nombre(void){
|
||
|
||
}
|
||
if (decode_nombre("123",3)!=123){
|
||
printf ("Erreur Test unitaire decode_nombre.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("987654321",2)!=98){
|
||
printf ("Erreur Test unitaire decode_nombre.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("66543",4)!=6654){
|
||
printf ("Erreur Test unitaire decode_nombre.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
Implémentation des fonctions decode_nombre et test_decode_nombre (Question 7)