From b68f966688c9cf9e4970b4ecb9ae0298e1213e58 Mon Sep 17 00:00:00 2001
From: cmv <>
Date: Sat, 31 May 2003 17:52:05 +0000
Subject: [PATCH] tests directs de xephem lib cmv 31/05/2003

---
 XephemAstroLib/Makefile     |  5 ++++-
 XephemAstroLib/testxephem.c | 40 +++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 XephemAstroLib/testxephem.c

diff --git a/XephemAstroLib/Makefile b/XephemAstroLib/Makefile
index 3d932ce..22592e8 100755
--- a/XephemAstroLib/Makefile
+++ b/XephemAstroLib/Makefile
@@ -4,7 +4,7 @@ all: libxastro.a
 
 clean:
 	rm -f libxastro.a
-	rm -f *.o
+	rm -f *.o testxephem
 
 install:
 	if [ ! -d $(EXTINCPATH)/XAstro ] ; then mkdir $(EXTINCPATH)/XAstro ; fi
@@ -21,3 +21,6 @@ libxastro.a : $(OBJASTRO)
 
 %.o: %.c
 	$(COMPILE.c) -o $@ $<
+
+testxephem: testxephem.o
+	$(LINK.c) -o $@ $^ -L$(EXTLIBPATH) -lxastro -lc -lm
diff --git a/XephemAstroLib/testxephem.c b/XephemAstroLib/testxephem.c
new file mode 100644
index 0000000..9fd2824
--- /dev/null
+++ b/XephemAstroLib/testxephem.c
@@ -0,0 +1,40 @@
+/* Pour faire des tests de Xephem Librairie */
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <unistd.h>
+#include "P_.h"
+#include "astro.h"
+
+#define R2D (180./PI)
+
+int main(int narg,char** arg)
+{
+  int year=1989,month=7,day=21; /* UTC*/
+ double hour=12.5;
+ int npnum=8, pnum[8]={MERCURY,VENUS,MARS,JUPITER,SATURN,URANUS,NEPTUNE,PLUTO};
+ int i;
+ double mjd,sunecl,sunecb,sundist,geodist,geoecl,geoecb,diamang,mag,msp,mdp;
+
+ cal_mjd(month,day+hour/24.,year,&mjd);
+ printf("date %d/%d/%d %gh  -> mjd=%f\n",day,month,year,hour,mjd);
+
+ /* Soleil */
+ sunpos(mjd,&geoecl,&geodist,&geoecb);
+ printf("Sun: geo ecl=%g ecb=%g dist=%g\n",geoecl*R2D,geoecb*R2D,geodist);
+
+ /* Lune */
+ moon(mjd,&geoecl,&geoecb,&geodist,&msp,&mdp);
+ printf("Moon: geo ecl=%g ecb=%g dist=%g\n",geoecl*R2D,geoecb*R2D,geodist);
+
+ /* Planete */
+ printf("--- Planets\n");
+ for(i=0;i<npnum;i++) {
+   plans(mjd,pnum[i],&sunecl,&sunecb,&sundist,&geodist,&geoecl,&geoecb,&diamang,&mag);
+   printf("pnum=%d: sun ecl=%g ecb=%g dist=%g,",pnum[i],sunecl*R2D,sunecb*R2D,sundist);
+   printf(" geo ecl=%g ecb=%g dist=%g,",geoecl*R2D,geoecb*R2D,geodist);
+   printf(" diamang=%g\"/1UA mag=%g\n",diamang,mag);
+ }
+
+ exit(0);
+}
-- 
GitLab