From 013fbc03c413049c19effcb3d2d2a44da9cea4c7 Mon Sep 17 00:00:00 2001 From: Don Cross Date: Tue, 18 Aug 2020 17:46:10 -0400 Subject: [PATCH] Pluto test: fail if error increases above current amount. --- generate/ctest.c | 2 ++ generate/generate.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/generate/ctest.c b/generate/ctest.c index 867e3f25..97f653f8 100644 --- a/generate/ctest.c +++ b/generate/ctest.c @@ -3341,6 +3341,8 @@ static int PlutoCheck(void) printf("C PlutoCheck: ref pos = [%20.16lf, %20.16lf, %20.16lf]\n", x, y, z); printf("C PlutoCheck: del pos = [%20.16lf, %20.16lf, %20.16lf]\n", vector.x - x, vector.y - y, vector.z - z); printf("C PlutoCheck: error = %le\n", diff); + if (diff > 5.68e-05) + FAIL("C PlutoCheck: EXCESSIVE ERROR\n"); error = 0; fail: diff --git a/generate/generate.c b/generate/generate.c index 2e4250d1..3694d50e 100644 --- a/generate/generate.c +++ b/generate/generate.c @@ -44,6 +44,8 @@ #include "vsop.h" #include "top2013.h" +const double PLUTO_TOLERANCE_ARCMIN = 1.4; + int Verbose; #define DEBUG(...) do{if(Verbose)printf(__VA_ARGS__);}while(0) @@ -1456,7 +1458,7 @@ static int CheckTestVector(const char *filename, int lnum, const char *line, dou return error; } - tolerance = (body == BODY_PLUTO) ? 1.3 : 0.4; + tolerance = (body == BODY_PLUTO) ? PLUTO_TOLERANCE_ARCMIN : 0.4; if (*arcmin > tolerance) { fprintf(stderr, "CheckTestVector: Excessive angular error (%lf arcmin) on line %d of file %s\n", *arcmin, lnum, filename); @@ -1555,7 +1557,7 @@ static int CheckSkyPos(observer *location, const char *filename, int lnum, const /* Calculate pythagorean error as if both were planar coordinates. */ *arcmin_equ = sqrt(delta_ra*delta_ra + delta_dec*delta_dec); - tolerance = (body == BODY_PLUTO) ? 1.3 : 0.9; + tolerance = (body == BODY_PLUTO) ? PLUTO_TOLERANCE_ARCMIN : 0.9; if (*arcmin_equ > tolerance) { fprintf(stderr, "CheckSkyPos: excessive (RA,DEC) error = %lf arcmin at line %d of file %s\n", *arcmin_equ, lnum, filename); @@ -1588,7 +1590,7 @@ static int CheckSkyPos(observer *location, const char *filename, int lnum, const *arcmin_hor = sqrt(delta_az*delta_az + delta_alt*delta_alt); - tolerance = (body == BODY_PLUTO) ? 1.4 : 0.9; + tolerance = (body == BODY_PLUTO) ? PLUTO_TOLERANCE_ARCMIN : 0.9; if (*arcmin_hor > tolerance) { fprintf(stderr, "CheckSkyPos: excessive (az,alt) error = %lf arcmin for body %d at line %d of file %s\n", *arcmin_hor, body, lnum, filename);