Révision 203
Ajouté par Stephen LOPEZ il y a environ 3 ans
branch/LOPEZ_Stephen/tp_sp4_2022_LOPEZ_Stephen/sp4a12/main.c | ||
---|---|---|
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <strings.h>
|
||
#include "trame.h"
|
||
#include "trame.h"
|
||
#include <math.h>
|
||
|
||
//Trames de tests ? modifier si n?cessaire.
|
||
char * trames[]= {"$GPGSV,3,2,10,15,03,077,,18,04,041,42,19,85,271,,20,08,214,*7C",
|
||
... | ... | |
float longitude;
|
||
} position ;
|
||
position p1;
|
||
position p2;
|
||
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
|
||
... | ... | |
return T;
|
||
}
|
||
|
||
float calcul_distance(position *p1, position *p2)
|
||
{
|
||
float distance;
|
||
distance=(2*3.14*6370/360)*sqrt(pow((p2->latitude-p1->latitude),2)*pow((p2->longitude-p1->longitude),2));
|
||
return distance;
|
||
}
|
||
|
||
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
|
||
... | ... | |
printf("Erreur Test unitaire decode_trame \n");}
|
||
exit(-1);
|
||
}
|
||
if (decode_trame("$GPGGA,141919.00,4545.1210,N,00306.6040,E,1,05,3.4,500.2,M,,M,,*75",&p1)!=1){
|
||
if (decode_trame("$GPGGA,141919.00,4545.1210,N,00306.6040,E,1,05,3.4,500.2,M,,M,,*75",&p1)!=1){
|
||
printf("La position et la trame sont invalide ");
|
||
if (decode_trame("$GPGGA,141919.00,4545.1210,N,00306.6040,E,1,05,3.4,500.2,M,,M,,*75",&p1)!=0){
|
||
printf("Erreur Test unitaire decode_trame \n");}
|
||
exit(-1);
|
||
}
|
||
*/
|
||
p1.latitude=latitude("4545.0000");
|
||
p1.longitude=longitude("00306.6036");
|
||
p2.latitude=latitude("4545.0242");
|
||
p2.longitude=longitude("00306.6039");
|
||
if((calcul_distance(p1,p2)-0.044>0.1)){
|
||
printf("Erreur Test unitaire calcul_distance");}
|
||
exit(-1);
|
||
}
|
||
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
question 4 bientôt terminée