summaryrefslogtreecommitdiff
path: root/test/test_lectionary_ef.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-21 22:39:12 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-21 22:39:12 +0200
commit384b0789c0f4d9beb936080a5592bb4aa6134295 (patch)
tree943842766c2dd09761e1d449cb3b1c56346e8dae /test/test_lectionary_ef.ml
parent2ac3e3e8fcc66e20bf1687ae15f033d20b02216d (diff)
downloadcolitur-384b0789c0f4d9beb936080a5592bb4aa6134295.tar.gz
colitur-384b0789c0f4d9beb936080a5592bb4aa6134295.zip
feat(kernel,ef): the lectionary reports which Mass it said
Rite.readings now returns (Mass_formulary.t option * Citation.t list) instead of a bare citation list, and Liturgical_day.t carries the result as a new formulary field. Validate holds a rite that resolves a formulary at all to resolving one on every day, the same discipline it already applies to citations; the EF lectionary chain resolves Some on every day of every year 1583-9999, confirmed by a direct sweep over 2005-2050 as well as through Validate itself. Plan Tasks 2 and 3 are merged into this one commit on the coordinator's own instruction: Rite.readings' signature and the field that consumes it are one atomic edit, and the intermediate state does not compile on its own. Each of the four lectionary steps now builds its own Mass_formulary.t at the point it decides, not by re-deriving it afterwards from the citations it returns: step 1 tags Proper with the observed slug, step 2 tags Own_slug with the day's own temporal slug, step 3 tags Preceding_sunday with the resumed Sunday's temporal slug, and step 4 tags Common with the Common's own id -- Commons.find now returns that id alongside its citations rather than discarding it, since it is only ever in scope at the point the assignment is looked up. The RG 309(a) Saturday votive Mass of Our Lady, which answers between steps 4 and 2 rather than as one of the four numbered steps, is tagged Own_slug too: Mass_formulary.source has no dedicated constructor for it, and its own guard only ever fires when the observed celebration already is the day's own (reused ferial) temporal slug, which is exactly what Own_slug documents. Recorded as a judgement call in the task report, not a specified answer. test/cli.t's `emit --format sexp` line count is repinned (8472 to 8881): that command serializes Liturgical_day.t whole, so the new field grows its output. `colitur day` itself is untouched -- verified byte-identical against the pre-change binary across 1583, 1900, 2026, 2038 and 9999.
Diffstat (limited to 'test/test_lectionary_ef.ml')
-rw-r--r--test/test_lectionary_ef.ml51
1 files changed, 49 insertions, 2 deletions
diff --git a/test/test_lectionary_ef.ml b/test/test_lectionary_ef.ml
index d56d187..bc2be8c 100644
--- a/test/test_lectionary_ef.ml
+++ b/test/test_lectionary_ef.ml
@@ -467,7 +467,7 @@ let test_step4_unreachable_commons_still_resolve () =
let for_saint s = Lectionary_ef.commons_for ~commons (Slug.of_string_exn s) in
let refs_of = function
| None -> [ "<no common>" ]
- | Some cs -> List.map (fun c -> c.Citation.reference) cs
+ | Some (_id, cs) -> List.map (fun c -> c.Citation.reference) cs
in
Alcotest.(check (list string))
"St Benedict (21 March), Common of Abbots"
@@ -580,6 +580,51 @@ let test_commons_load_rejects_bad_data () =
(Slug.of_string_exn "benedict")
= None)
+(* ---------------------------------------------------------------------- *)
+(* The formulary itself (Task 2): each step of the chain now reports HOW *)
+(* it resolved, not only what it resolved. One day per step -- the same *)
+(* dates this file already uses (and hand-verifies) elsewhere for the *)
+(* citations those days carry, so no new date needs independent checking. *)
+(* ---------------------------------------------------------------------- *)
+
+let formulary_cases =
+ [ (* step 1: a saint with his own proper -- same date as
+ [test_step1_proper_beats_any_common_john_of_god]. *)
+ (2038, 3, 8, "john-of-god", Colitur_kernel.Mass_formulary.Proper);
+ (* step 2: the day's own temporal slug -- same date as
+ [test_step2_lenten_feria_has_its_own], Monday of Lent I. *)
+ (2026, 2, 23, "ef-lent-1-monday", Colitur_kernel.Mass_formulary.Own_slug);
+ (* step 3: a feria resuming the preceding Sunday. The task brief's own
+ snippet pinned this date against week 9 ("ef-time-after-pentecost-
+ sunday-9"); running the real resolver against 2026 shows 3 August
+ 2026 is Monday of week 10, resuming 2 August's "...sunday-10" --
+ corrected per the brief's own "find the dates by running the current
+ binary if they drift" instruction. *)
+ (2026, 8, 3, "ef-time-after-pentecost-sunday-10",
+ Colitur_kernel.Mass_formulary.Preceding_sunday);
+ (* step 4: a saint sent to a Common -- same date as
+ [test_step4_commons_perpetua_and_felicity]; [said] is the Common's
+ OWN id (data/ef/commons.sexp), not the saint's slug. *)
+ (2038, 3, 6, "common-of-non-virgins-1", Colitur_kernel.Mass_formulary.Common) ]
+
+let test_formulary_reports_its_source () =
+ List.iter
+ (fun (y, m, d, expected_slug, expected_via) ->
+ let day = day y m d in
+ match day.Colitur_kernel.Liturgical_day.formulary with
+ | None -> Alcotest.failf "%04d-%02d-%02d: no formulary" y m d
+ | Some f ->
+ Alcotest.(check string)
+ (Printf.sprintf "%04d-%02d-%02d slug" y m d)
+ expected_slug
+ (Colitur_kernel.Slug.to_string f.Colitur_kernel.Mass_formulary.said);
+ Alcotest.(check string)
+ (Printf.sprintf "%04d-%02d-%02d source" y m d)
+ (Colitur_kernel.Mass_formulary.source_to_string expected_via)
+ (Colitur_kernel.Mass_formulary.source_to_string
+ f.Colitur_kernel.Mass_formulary.via))
+ formulary_cases
+
let suite =
[ ("step 1: sanctoral proper", `Quick, test_step1_sanctoral_proper);
("step 2: own temporal proper", `Quick, test_step2_lenten_feria_has_its_own);
@@ -618,4 +663,6 @@ let suite =
("the five propers no real year reaches are present", `Quick,
test_step4_unreachable_propers_are_present);
("Commons.load rejects the four silent-degradation defects", `Quick,
- test_commons_load_rejects_bad_data) ]
+ test_commons_load_rejects_bad_data);
+ ("the formulary reports its own source, one day per step", `Quick,
+ test_formulary_reports_its_source) ]