Révision 154
Ajouté par Guillaume DAVID il y a environ 3 ans
main.c | ||
---|---|---|
}
|
||
return res;
|
||
}
|
||
|
||
int decode_nombre(char *ch,int n){
|
||
int r=0;
|
||
int i;
|
||
|
||
for(i=0;i<n;i++){
|
||
r=10*r+decode_int(ch[i]);
|
||
}
|
||
return r;
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
... | ... | |
exit(-1);
|
||
}
|
||
|
||
test_decode_int();
|
||
test_decode_int();
|
||
|
||
test_decode_nombre();
|
||
}
|
||
|
||
void test_decode_int(void){
|
||
... | ... | |
exit(-1);
|
||
}
|
||
}
|
||
|
||
void test_decode_nombre(void){
|
||
char t[5];
|
||
t[0]='1';t[1]='2';t[2]='3';t[3]='4';
|
||
|
||
if(decode_nombre(t,1)!=1){
|
||
printf("Erreur test unitaire decode-nombre1\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_nombre(t,4)!=1234){
|
||
printf("Erreur test unitaire decode-nombre2\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
implantation decode_nombre et ses tests_unitaires