Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Feb 19, 2024
1 parent ff1bf4c commit 1d2dcff
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LDFLAGS += -fprofile-arcs -ftest-coverage -lm

CFLAGS += -DDEFAULT_SOLSYS=3 -DDEFAULT_CIO_LOCATOR_FILE=\"cio_ra.bin\"

OBJECTS := $(subst obj/,,$(OBJECTS))
OBJECTS := novas.o nutation.o solsys3.o

.PHONY: run
run: clean-cov clean-data test test_cio_file test-super data ../cio_ra.bin
Expand Down
27 changes: 27 additions & 0 deletions test/src/test-super.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,38 @@ static int test_get_utc_to_tt() {
return 0;
}

static int test_nutation_lp_provider() {
double t = (tdb - NOVAS_JD_J2000) / 36525.0;
double de, dp, de0, dp0;

int status = 1;


if(!is_ok("nutation_lp_provider:set_nutation_lp_provider", set_nutation_lp_provider(iau2000b))) goto cleanup; // @suppress("Goto statement used")
if(!is_ok("nutation_lp_provider:nutation_angles", nutation_angles(t, NOVAS_REDUCED_ACCURACY, &de, &dp))) goto cleanup; // @suppress("Goto statement used")
if(!is_ok("nutation_lp_provider:iau2000b", iau2000b(tdb, 0.0, &de0, &dp0))) goto cleanup; // @suppress("Goto statement used")

de0 /= ASEC2RAD;
dp0 /= ASEC2RAD;

if(!is_ok("nutation_lp_provider:check_de", fabs(de - de0) > 1e-7)) goto cleanup; // @suppress("Goto statement used")
if(!is_ok("nutation_lp_provider:check_dp", fabs(dp - dp0) > 1e-7)) goto cleanup; // @suppress("Goto statement used")

status = 0;

cleanup:

set_nutation_lp_provider(nu2000k);
return status;
}

static int test_dates() {
double offsets[] = {-10000.0, 0.0, 10000.0, 10000.0, 10000.01 };
int i, n = 0;

if(test_get_ut1_to_tt()) n++;
if(test_get_utc_to_tt()) n++;
if(test_nutation_lp_provider()) n++;

for(i = 0; i < 5; i++) {
tdb = J2000 + offsets[i];
Expand Down Expand Up @@ -520,6 +545,8 @@ static int test_ephem_provider() {
return status;
}



int main() {
int n = 0;

Expand Down

0 comments on commit 1d2dcff

Please sign in to comment.