Révision 186
Ajouté par faba6 il y a presque 4 ans
main.c | ||
---|---|---|
}
|
||
|
||
|
||
|
||
int decode_int(char c){
|
||
int i;
|
||
if(c>='0'&&c<='9'){
|
||
i=c-48;
|
||
}
|
||
else
|
||
i=-1;
|
||
|
||
return i;
|
||
}
|
||
|
||
|
||
/*Ajouter vos tests unitaires dans cette fonction.*/
|
||
void tests_unitaires(void){
|
||
|
||
... | ... | |
|
||
}
|
||
|
||
|
||
void test_decode_int(void){
|
||
if(decode_int('a')==1){
|
||
printf("Erreur test unitaire test_decode\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('0')==1){
|
||
printf("test unitaire test_decode\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('0')!=1){
|
||
printf("Erreur test unitaire test_decode\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('3')!=1){
|
||
printf("Erreur test unitaire test_decode\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
/* Ne pas modifier cette fonction*/
|
||
int main(int argc,char ** argv)
|
||
... | ... | |
|
||
|
||
tests_unitaires();
|
||
test_decode_int();
|
||
|
||
|
||
|
Formats disponibles : Unified diff