Révision 30
Ajouté par gasacco il y a environ 4 ans
branch/sacco/sp4a12/main.c | ||
---|---|---|
return Coord_Dec;
|
||
|
||
}
|
||
|
||
float conversion(char * coord)
|
||
{
|
||
int i=0;
|
||
while (coord[i]!='.')
|
||
{
|
||
i=i+1;
|
||
if (i>5)
|
||
{
|
||
return 0;
|
||
}
|
||
}
|
||
if (i==4)
|
||
{
|
||
return conversion_Latitude_sexa_dec(coord);
|
||
}
|
||
else if (i==5)
|
||
{
|
||
return conversion_Long_sexa_dec(coord);
|
||
|
||
}
|
||
else
|
||
{
|
||
return -1;
|
||
}
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
... | ... | |
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion_Latitude_sexa_dec("3723.2475")-(float) 37.387459>0.0001){
|
||
if (conversion_Latitude_sexa_dec("3723.2475")-(float) 37.387458>0.0001){
|
||
printf("Erreur Test unitaire conversion_Latitude_sex_dec 1.\n");
|
||
exit(-1);
|
||
}
|
||
... | ... | |
printf("Erreur Test unitaire conversion_Latitude_sexa_dec.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion_Long_sexa_dec("00306.6036")-3.11006>0.0001){
|
||
if (conversion_Long_sexa_dec("00306.6036")- (float)3.11006>0.0001){
|
||
printf("Erreur Test unitaire conversion_Latitude_sexa_dec.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion_Long_sexa_dec("00008.0015")-0.133358>0.0001){
|
||
if (conversion_Long_sexa_dec("00008.0015")-(float)0.133358>0.0001){
|
||
printf("Erreur Test unitaire conversion_Latitude_sexa_dec.\n");
|
||
exit(-1);
|
||
|
||
}
|
||
if (conversion("3723.2475")-(float)37.387458>0.0001){
|
||
printf("Erreur Test unitaire conversion.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion("0045.0000")-(float)0.75>0.0001){
|
||
printf("Erreur Test unitaire conversion.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion("00306.6036")-(float)3.11006>0.0001){
|
||
printf("Erreur Test unitaire conversion.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion("00008.0015")-(float)0.133358>0.0001){
|
||
printf("Erreur Test unitaire conversion.\n");
|
||
exit(-1);
|
||
}
|
||
if (conversion("0.0")!=-1){
|
||
printf("Erreur test unitaire conversion.\n");
|
||
exit(-1);
|
||
}
|
||
|
||
}
|
Formats disponibles : Unified diff
Codage fonction conversion générique qui décode indifféremment la latitude/longitude