pg_orrery/test/expected/v012_features.out
Ryan Malloy 84ce1f1b8d Add v0.12.0: equatorial GiST operator class + DE moon equatorial functions
Feature A: GiST index for equatorial type with KNN ordering (<-> strategy 15).
24-byte float-precision spherical bounding box, RA-wrapping aware merge/split,
Vincenty lower-bound distance for correct KNN pruning. Apollo-hardened with
epsilon-widened bounds, circular-aware picksplit, compile-time size assertions.

Feature B: 4 new DE moon equatorial functions (galilean_equatorial_de,
saturn_moon_equatorial_de, uranus_moon_equatorial_de, mars_moon_equatorial_de).
Same-provider rule enforced, transparent VSOP87 fallback.

120 -> 132 SQL objects. 22 regression suites passing.
2026-02-24 13:15:34 -07:00

134 lines
6.2 KiB
Plaintext

-- v0.12.0 feature tests: DE moon equatorial functions
-- ============================================================
-- Test 1: galilean_equatorial_de fallback matches VSOP87 variant
-- Without DE configured, DE variant should produce identical results
-- ============================================================
SELECT 'galilean_eq_de_fallback' AS test,
moon_id,
round(eq_ra(galilean_equatorial_de(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) AS de_ra,
round(eq_ra(galilean_equatorial(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) AS vsop_ra,
round(eq_ra(galilean_equatorial_de(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) =
round(eq_ra(galilean_equatorial(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) AS match
FROM generate_series(0, 3) AS moon_id
ORDER BY moon_id;
test | moon_id | de_ra | vsop_ra | match
-------------------------+---------+--------+---------+-------
galilean_eq_de_fallback | 0 | 4.1957 | 4.1957 | t
galilean_eq_de_fallback | 1 | 4.1950 | 4.1950 | t
galilean_eq_de_fallback | 2 | 4.1937 | 4.1937 | t
galilean_eq_de_fallback | 3 | 4.2057 | 4.2057 | t
(4 rows)
-- ============================================================
-- Test 2: saturn_moon_equatorial_de fallback (Titan, id=5)
-- ============================================================
SELECT 'saturn_eq_de_fallback' AS test,
round(eq_ra(saturn_moon_equatorial_de(5, '2024-06-15 12:00:00+00'))::numeric, 4) AS de_ra,
round(eq_ra(saturn_moon_equatorial(5, '2024-06-15 12:00:00+00'))::numeric, 4) AS vsop_ra,
round(eq_ra(saturn_moon_equatorial_de(5, '2024-06-15 12:00:00+00'))::numeric, 4) =
round(eq_ra(saturn_moon_equatorial(5, '2024-06-15 12:00:00+00'))::numeric, 4) AS match;
test | de_ra | vsop_ra | match
-----------------------+---------+---------+-------
saturn_eq_de_fallback | 23.3909 | 23.3909 | t
(1 row)
-- ============================================================
-- Test 3: uranus_moon_equatorial_de fallback (Titania, id=3)
-- ============================================================
SELECT 'uranus_eq_de_fallback' AS test,
round(eq_ra(uranus_moon_equatorial_de(3, '2024-06-15 12:00:00+00'))::numeric, 4) AS de_ra,
round(eq_ra(uranus_moon_equatorial(3, '2024-06-15 12:00:00+00'))::numeric, 4) AS vsop_ra,
round(eq_ra(uranus_moon_equatorial_de(3, '2024-06-15 12:00:00+00'))::numeric, 4) =
round(eq_ra(uranus_moon_equatorial(3, '2024-06-15 12:00:00+00'))::numeric, 4) AS match;
test | de_ra | vsop_ra | match
-----------------------+--------+---------+-------
uranus_eq_de_fallback | 3.5124 | 3.5124 | t
(1 row)
-- ============================================================
-- Test 4: mars_moon_equatorial_de fallback (Phobos + Deimos)
-- ============================================================
SELECT 'mars_eq_de_fallback' AS test,
moon_id,
round(eq_ra(mars_moon_equatorial_de(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) AS de_ra,
round(eq_ra(mars_moon_equatorial(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) AS vsop_ra,
round(eq_ra(mars_moon_equatorial_de(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) =
round(eq_ra(mars_moon_equatorial(moon_id, '2024-06-15 12:00:00+00'))::numeric, 4) AS match
FROM generate_series(0, 1) AS moon_id
ORDER BY moon_id;
test | moon_id | de_ra | vsop_ra | match
---------------------+---------+--------+---------+-------
mars_eq_de_fallback | 0 | 2.1851 | 2.1851 | t
mars_eq_de_fallback | 1 | 2.1851 | 2.1851 | t
(2 rows)
-- ============================================================
-- Test 5: All DE moon equatorial return valid RA/Dec ranges
-- ============================================================
SELECT 'de_moon_eq_valid' AS test,
'galilean' AS family,
moon_id,
eq_ra(galilean_equatorial_de(moon_id, '2024-06-15 12:00:00+00')) BETWEEN 0 AND 24 AS ra_valid,
eq_dec(galilean_equatorial_de(moon_id, '2024-06-15 12:00:00+00')) BETWEEN -90 AND 90 AS dec_valid
FROM generate_series(0, 3) AS moon_id
ORDER BY moon_id;
test | family | moon_id | ra_valid | dec_valid
------------------+----------+---------+----------+-----------
de_moon_eq_valid | galilean | 0 | t | t
de_moon_eq_valid | galilean | 1 | t | t
de_moon_eq_valid | galilean | 2 | t | t
de_moon_eq_valid | galilean | 3 | t | t
(4 rows)
-- ============================================================
-- Test 6: Invalid body_id rejection for all 4 families
-- ============================================================
DO $$
BEGIN
PERFORM galilean_equatorial_de(5, '2024-06-15 12:00:00+00');
RAISE EXCEPTION 'should have failed';
EXCEPTION WHEN numeric_value_out_of_range THEN
RAISE NOTICE 'galilean_eq_de_invalid: correctly rejected';
END;
$$;
NOTICE: galilean_eq_de_invalid: correctly rejected
DO $$
BEGIN
PERFORM saturn_moon_equatorial_de(8, '2024-06-15 12:00:00+00');
RAISE EXCEPTION 'should have failed';
EXCEPTION WHEN numeric_value_out_of_range THEN
RAISE NOTICE 'saturn_eq_de_invalid: correctly rejected';
END;
$$;
NOTICE: saturn_eq_de_invalid: correctly rejected
DO $$
BEGIN
PERFORM uranus_moon_equatorial_de(5, '2024-06-15 12:00:00+00');
RAISE EXCEPTION 'should have failed';
EXCEPTION WHEN numeric_value_out_of_range THEN
RAISE NOTICE 'uranus_eq_de_invalid: correctly rejected';
END;
$$;
NOTICE: uranus_eq_de_invalid: correctly rejected
DO $$
BEGIN
PERFORM mars_moon_equatorial_de(2, '2024-06-15 12:00:00+00');
RAISE EXCEPTION 'should have failed';
EXCEPTION WHEN numeric_value_out_of_range THEN
RAISE NOTICE 'mars_eq_de_invalid: correctly rejected';
END;
$$;
NOTICE: mars_eq_de_invalid: correctly rejected
-- ============================================================
-- Test 7: Negative body_id rejection
-- ============================================================
DO $$
BEGIN
PERFORM galilean_equatorial_de(-1, '2024-06-15 12:00:00+00');
RAISE EXCEPTION 'should have failed';
EXCEPTION WHEN numeric_value_out_of_range THEN
RAISE NOTICE 'galilean_eq_de_negative: correctly rejected';
END;
$$;
NOTICE: galilean_eq_de_negative: correctly rejected