Skip to content

Commit 83202c2

Browse files
committed
A few more tests for frames
1 parent 15d363e commit 83202c2

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

src/frames.c

-3
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,6 @@ int novas_hor_to_app(const novas_frame *frame, double az, double el, RefractionM
794794
return novas_error(-1, EINVAL, fn, "observer not on Earth: where=%d", frame->observer.where);
795795
}
796796

797-
if(sys < 0 || sys >= NOVAS_REFERENCE_SYSTEMS)
798-
return novas_error(-1, EINVAL, fn, "invalid reference system: %d", sys);
799-
800797
time = (novas_timespec *) &frame->time;
801798

802799
if(ref_model) {

test/src/test-super.c

+20-11
Original file line numberDiff line numberDiff line change
@@ -489,32 +489,41 @@ static int test_app_hor(enum novas_reference_system sys) {
489489
static int test_app_geom(enum novas_reference_system sys) {
490490
char label[50];
491491
novas_timespec ts = {};
492-
observer obs = {};
493-
novas_frame frame = {};
492+
observer obs[2] = {{}};
493+
novas_frame frame[2] = {};
494494
cat_entry c = {};
495495
double pos0[3] = {}, pos1[3] = {};
496496
sky_pos app = {};
497+
int i;
497498

498499
sprintf(label, "app_hor:sys=%d:set_time", sys);
499500
if(!is_ok(label, novas_set_time(NOVAS_TT, tdb, 32, 0.0, &ts))) return 1;
500501

501-
sprintf(label, "app_hor:sys=%d:make_observer", sys);
502-
if(!is_ok(label, make_observer_at_geocenter(&obs))) return 1;
502+
sprintf(label, "app_hor:sys=%d:make_observer:gc", sys);
503+
if(!is_ok(label, make_observer_at_geocenter(&obs[0]))) return 1;
504+
505+
sprintf(label, "app_hor:sys=%d:make_observer:gc", sys);
506+
if(!is_ok(label, make_observer_on_surface(1.0, 2.0, 3.0, 4.0, 1001.0, &obs[1]))) return 1;
503507

504508
sprintf(label, "app_hor:sys=%d:make_frame", sys);
505-
if(!is_ok(label, novas_make_frame(NOVAS_REDUCED_ACCURACY, &obs, &ts, 0.0, 0.0, &frame))) return 1;
509+
if(!is_ok(label, novas_make_frame(NOVAS_REDUCED_ACCURACY, &obs[0], &ts, 0.0, 0.0, &frame[0]))) return 1;
510+
511+
sprintf(label, "app_hor:sys=%d:make_frame", sys);
512+
if(!is_ok(label, novas_make_frame(NOVAS_REDUCED_ACCURACY, &obs[1], &ts, 0.0, 0.0, &frame[1]))) return 1;
506513

507514
starvectors(&source.star, pos0, NULL);
508515

509-
sprintf(label, "app_hor:sys=%d:geom_to_app", sys);
510-
if(!is_ok(label, novas_geom_to_app(&frame, pos0, sys, &app))) return 1;
516+
for(i = 0; i < 2; i++) {
517+
sprintf(label, "app_hor:sys=%d:obs=%d:geom_to_app", sys, i);
518+
if(!is_ok(label, novas_geom_to_app(&frame[i], pos0, sys, &app))) return 1;
511519

512-
sprintf(label, "app_hor:sys=%d:app_to_geom", sys);
520+
sprintf(label, "app_hor:sys=%d:obs=%d:app_to_geom", sys, i);
513521

514-
if(!is_ok(label, novas_app_to_geom(&frame, sys, app.ra, app.dec, vlen(pos0), pos1))) return 1;
522+
if(!is_ok(label, novas_app_to_geom(&frame[i], sys, app.ra, app.dec, vlen(pos0), pos1))) return 1;
515523

516-
sprintf(label, "app_hor:sys=%d:check", sys);
517-
if(!is_ok(label, check_equal_pos(pos1, pos0, 1e-8 * vlen(pos0)))) return 1;
524+
sprintf(label, "app_hor:sys=%d:obs=%d:check", sys, i);
525+
if(!is_ok(label, check_equal_pos(pos1, pos0, 1e-8 * vlen(pos0)))) return 1;
526+
}
518527

519528
return 0;
520529
}

0 commit comments

Comments
 (0)