Révision 237
Ajouté par ahkurklu il y a presque 4 ans
branch/KURKLU/sp4a12/main.c | ||
---|---|---|
return resultat;
|
||
}
|
||
|
||
float conversion_lat_long_float(char*degres){
|
||
int i=0;
|
||
char c = degres[0];
|
||
float resultat;
|
||
while(c != '.'){
|
||
i=i+1;
|
||
c=degres[i];
|
||
}
|
||
if(i==4){
|
||
resultat=conversion_latitute_float(degres);
|
||
}
|
||
else if(i==5){
|
||
resultat=conversion_longitude_float(degres);
|
||
}
|
||
else {
|
||
printf("Erreur\n");
|
||
exit(-1);
|
||
}
|
||
|
||
return resultat;
|
||
}
|
||
|
||
|
||
void test_unitaire_conversion_lat_float(void){
|
||
float i = conversion_latitute_float("3723.2475");
|
||
float j = 37.3874588;
|
||
... | ... | |
}
|
||
}
|
||
|
||
|
||
void test_unitaire_conversion_long_lat_float(void){
|
||
float i = conversion_lat_long_float("09013.1234");
|
||
float j = 90.21872333 ;
|
||
if(i != j ){
|
||
printf("Erreur test unitaire conversion long lat 1\n");
|
||
exit(-1);
|
||
}
|
||
i=conversion_lat_long_float("12236.3645");;
|
||
j=122.606075;
|
||
if(i != j ){
|
||
printf("Erreur test unitaire conversion long lat 2\n");
|
||
exit(-1);
|
||
}
|
||
i=conversion_lat_long_float("1832.8125");;
|
||
j=18.546875;
|
||
if(i != j ){
|
||
printf("Erreur test unitaire conversion long lat 3\n");
|
||
exit(-1);
|
||
}
|
||
i=conversion_lat_long_float("4725.7654");
|
||
j=47.4294233;
|
||
if(i != j ){
|
||
printf("Erreur test unitaire conversion long lat 4\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
test_unitaire_decode_int();
|
||
test_unitaire_decode_nombre();
|
||
test_unitaire_conversion_lat_float();
|
||
test_unitaire_conversion_long_float();
|
||
test_unitaire_conversion_long_float();
|
||
test_unitaire_conversion_long_lat_float();
|
||
}
|
||
|
||
|
Formats disponibles : Unified diff
Question 11 ajout fonction générique avec les deux fonction précédente + test unitaire