Révision 519
Ajouté par lefraisse il y a presque 4 ans
branch/FRAISSE/sp4a12/main.c | ||
---|---|---|
//renvoie la valeur d?cimale associ?e ? un caract?re donn?
|
||
int decode_int(char c){
|
||
int n;
|
||
if ((0=<n)&&(9>=n)){
|
||
if (('0'<=c)&&('9'>=c)){
|
||
n=c-'0';
|
||
}
|
||
else
|
||
... | ... | |
} Position ;
|
||
|
||
//Conversion de la latitude/longitude en sexagesimal vers les degr?s flottants
|
||
//On consid?re que les points ont ?t? supprim? de la chapine de caract?re (cf decode trame)
|
||
float conversion(char * ch){
|
||
int i=0,j;
|
||
float deglat,deglong;
|
||
... | ... | |
}
|
||
|
||
//Calcul de la distance entre deux positions GPS
|
||
float calcul_distance(Position p_1,Position p_2){
|
||
float r=6378.137;
|
||
return 2*r*asin(sqrt(pow(sin(pi/180*(p_1.latitude-p_2.latitude)/2),2)+cos(pi/180*p_1.latitude)*cos(pi/180*p_2.latitude)*pow(sin(pi/180*(p_1.longitude-p_2.longitude)/2),2)));
|
||
}
|
||
//float calcul_distance(Position p1,Position p2){
|
||
// float r=6378.137;
|
||
// return 2*r*asin(sqrt(pow(sin(pi/180*(p_1.latitude-p_2.latitude)/2),2)+cos(pi/180*p_1.latitude)*cos(pi/180*p_2.latitude)*pow(sin(pi/180*(p_1.longitude-p_2.longitude)/2),2)));
|
||
//}
|
||
|
||
//Calcul de la vitesse entre 2 positions Gps
|
||
float calcul
|
||
//float calcul_vitesse(Position p1,Position p2){
|
||
|
||
//}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
... | ... | |
}
|
||
|
||
void test_decode_int(void){
|
||
if(decode_int('1')!=1){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('2')!=2){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('3')!=3){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('4')!=4){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('5')!=5){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('6')!=6){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('7')!=7){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('8')!=8){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('9')!=9){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if(decode_int('3')!=3){
|
||
if(decode_int('A')!=-1){
|
||
printf("Erreur Test decode int decode_int.\n");
|
||
exit(-1);
|
||
}
|
Formats disponibles : Unified diff