Révision 236
Ajouté par ahkurklu il y a presque 4 ans
branch/KURKLU/sp4a12/main.c | ||
---|---|---|
}
|
||
|
||
|
||
float conversion_longitude_float(char*degres){
|
||
char deg[3];
|
||
char min[2];
|
||
char sec[4];
|
||
float vald,valm,vals;
|
||
float resultat = 0;
|
||
int i;
|
||
for(i=0;i<3;i++){
|
||
deg[i] = degres[i];
|
||
}
|
||
for(i=3;i<5;i++){
|
||
min[i-3] = degres[i];
|
||
}
|
||
for(i=6;i<10;i++){
|
||
sec[i-6] = degres[i];
|
||
}
|
||
vald = decode_nombre(deg,3);
|
||
valm = decode_nombre(min,2);
|
||
vals = decode_nombre(sec,4);
|
||
|
||
resultat = resultat + vald;
|
||
resultat = resultat + valm/60;
|
||
resultat = resultat + ((vals*0.0001)*60)/3600;
|
||
|
||
return resultat;
|
||
}
|
||
|
||
|
||
void test_unitaire_conversion_lat_float(void){
|
||
float i = conversion_latitute_float("3723.2475");
|
||
float j = 37.3874588;
|
||
... | ... | |
printf("Erreur test unitaire conversion lat\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
void test_unitaire_conversion_long_float(void){
|
||
float i = conversion_longitude_float("16322.4589");
|
||
float j = 163.374315;
|
||
if(i != j ){
|
||
printf("Erreur test unitaire conversion long\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
... | ... | |
}
|
||
test_unitaire_decode_int();
|
||
test_unitaire_decode_nombre();
|
||
test_unitaire_conversion_lat_float();
|
||
test_unitaire_conversion_lat_float();
|
||
test_unitaire_conversion_long_float();
|
||
}
|
||
|
||
|
Formats disponibles : Unified diff
Question 10 ajout fonction convertissant chaine de caractère contenant la longitude en nombre flottant + test unitaire