bd739ccfdf
deck-engine gains --format json (language-independent, slug-based) so a new dist/interpreter-cli can score how significant a day's transits are without linking the engine itself — it depends only on the JSON shape, via its own minimal parser. Also documents the full reading pipeline end to end (CLAUDE.md, README, docs/) and adds docs/reading.md, a non-technical explanation of what a daily reading contains and means.
104 lines
3.7 KiB
C
104 lines
3.7 KiB
C
#include <assert.h>
|
|
#include <stdio.h>
|
|
|
|
#include "../src/significance.h"
|
|
|
|
static Aspect make_aspect(Body transiting, Body natal, AspectType type, double orb) {
|
|
Aspect a;
|
|
a.transiting_planet = transiting;
|
|
a.natal_planet = natal;
|
|
a.type = type;
|
|
a.orb = orb;
|
|
return a;
|
|
}
|
|
|
|
static void test_empty_day_is_quiet(void) {
|
|
DailyReading reading = {0};
|
|
DailyInterpretation interp;
|
|
|
|
interpret_daily_reading(&reading, &interp);
|
|
|
|
assert(interp.top_item_count == 0);
|
|
assert(interp.day_level == DAY_QUIET);
|
|
assert(!interpretation_deserves_framing(&interp));
|
|
|
|
printf("PASS test_empty_day_is_quiet\n");
|
|
}
|
|
|
|
static void test_exact_outer_planet_to_luminary_is_major(void) {
|
|
DailyReading reading = {0};
|
|
reading.transits.aspect_count = 1;
|
|
reading.transits.aspects[0] = make_aspect(PLANET_PLUTO, PLANET_SUN, ASPECT_SQUARE, 0.1);
|
|
|
|
DailyInterpretation interp;
|
|
interpret_daily_reading(&reading, &interp);
|
|
|
|
assert(interp.top_item_count == 1);
|
|
assert(interp.day_level == DAY_MAJOR);
|
|
assert(interpretation_deserves_framing(&interp));
|
|
assert(interp.top_items[0].aspect.transiting_planet == PLANET_PLUTO);
|
|
|
|
printf("PASS test_exact_outer_planet_to_luminary_is_major\n");
|
|
}
|
|
|
|
static void test_top_five_selected_and_ranked(void) {
|
|
/* 7 candidates spanning very tight/major to very loose/minor. The two
|
|
* weakest (a fast Moon transit and a wide-orb Venus-Mars trine, both
|
|
* with no luminary/slow-planet weight behind them) should be evicted,
|
|
* and the strongest (near-exact outer-planet opposition to natal Moon)
|
|
* should end up first. */
|
|
DailyReading reading = {0};
|
|
reading.transits.aspect_count = 7;
|
|
reading.transits.aspects[0] = make_aspect(PLANET_PLUTO, PLANET_MOON, ASPECT_OPPOSITION, 0.2);
|
|
reading.transits.aspects[1] = make_aspect(PLANET_SATURN, PLANET_SUN, ASPECT_SQUARE, 0.5);
|
|
reading.transits.aspects[2] = make_aspect(PLANET_URANUS, PLANET_MERCURY, ASPECT_TRINE, 1.0);
|
|
reading.transits.aspects[3] = make_aspect(PLANET_JUPITER, PLANET_VENUS, ASPECT_SEXTILE, 2.0);
|
|
reading.transits.aspects[4] = make_aspect(PLANET_MARS, PLANET_JUPITER, ASPECT_CONJUNCTION, 1.5);
|
|
reading.transits.aspects[5] = make_aspect(PLANET_MOON, PLANET_MERCURY, ASPECT_SEXTILE, 5.9);
|
|
reading.transits.aspects[6] = make_aspect(PLANET_VENUS, PLANET_MARS, ASPECT_TRINE, 5.8);
|
|
|
|
DailyInterpretation interp;
|
|
interpret_daily_reading(&reading, &interp);
|
|
|
|
assert(interp.top_item_count == 5);
|
|
|
|
for (int i = 1; i < interp.top_item_count; i++) {
|
|
assert(interp.top_items[i - 1].score >= interp.top_items[i].score);
|
|
}
|
|
|
|
for (int i = 0; i < interp.top_item_count; i++) {
|
|
Body t = interp.top_items[i].aspect.transiting_planet;
|
|
Body n = interp.top_items[i].aspect.natal_planet;
|
|
assert(!(t == PLANET_MOON && n == PLANET_MERCURY));
|
|
assert(!(t == PLANET_VENUS && n == PLANET_MARS));
|
|
}
|
|
|
|
assert(interp.top_items[0].aspect.transiting_planet == PLANET_PLUTO);
|
|
assert(interp.top_items[0].aspect.natal_planet == PLANET_MOON);
|
|
|
|
printf("PASS test_top_five_selected_and_ranked\n");
|
|
}
|
|
|
|
static void test_fewer_than_five_aspects_reports_actual_count(void) {
|
|
DailyReading reading = {0};
|
|
reading.transits.aspect_count = 2;
|
|
reading.transits.aspects[0] = make_aspect(PLANET_VENUS, PLANET_MARS, ASPECT_TRINE, 3.0);
|
|
reading.transits.aspects[1] = make_aspect(PLANET_MERCURY, PLANET_VENUS, ASPECT_SEXTILE, 4.0);
|
|
|
|
DailyInterpretation interp;
|
|
interpret_daily_reading(&reading, &interp);
|
|
|
|
assert(interp.top_item_count == 2);
|
|
|
|
printf("PASS test_fewer_than_five_aspects_reports_actual_count\n");
|
|
}
|
|
|
|
int main(void) {
|
|
test_empty_day_is_quiet();
|
|
test_exact_outer_planet_to_luminary_is_major();
|
|
test_top_five_selected_and_ranked();
|
|
test_fewer_than_five_aspects_reports_actual_count();
|
|
printf("All significance tests passed.\n");
|
|
return 0;
|
|
}
|