summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-15 00:16:35 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-15 00:16:35 +0200
commit124d7e2261c721c4a49f7203efc276088c7cb217 (patch)
tree9aa82ff189c924e9327236d77acd6891114108cb /test
parentf1d90a83ece4d8301061e8247e23ec2af8293ab4 (diff)
downloadcolitur-124d7e2261c721c4a49f7203efc276088c7cb217.tar.gz
colitur-124d7e2261c721c4a49f7203efc276088c7cb217.zip
kernel+ef: resolve readings, chain steps 1 and 2
Liturgical_day.citations has read "always empty until Plan 4" since Plan 3; it is now filled. Rite.t gains a readings function, rite-supplied for the same reason transfer_target is: what a day with no proper falls back to is a rubric, not a universal. Calendar calls it and passes its own temporal function as the callback the rite needs to reach another date. Steps 1 and 2 only: the observed celebration's own proper, else the day's own temporal slug. Nothing encodes "Lent has daily propers" -- the presence of an entry is the discriminator.
Diffstat (limited to 'test')
-rw-r--r--test/test_calendar.ml6
-rw-r--r--test/test_colitur.ml3
-rw-r--r--test/test_lectionary_ef.ml68
-rw-r--r--test/test_validate.ml6
4 files changed, 80 insertions, 3 deletions
diff --git a/test/test_calendar.ml b/test/test_calendar.ml
index 22f5f04..2f6df6d 100644
--- a/test/test_calendar.ml
+++ b/test/test_calendar.ml
@@ -99,9 +99,13 @@ module Fixture = struct
let rec search d = if (occupant d).Cel.rank = Lo then d else search (D.add_days d 1) in
search (D.add_days origin 1)
+ (* No fixture here exercises citations -- readings is a harmless constant
+ [], the same role [empty_layer] plays for the sanctoral side. *)
+ let readings ~observed:_ ~temporal:_ ~date:_ ~temporal_at:_ = []
+
let rite : (season, rank) Rite.t =
{ Rite.id = "synthetic-calendar"; vocab; year_start; temporal; anchors = (fun _ -> []);
- rules; season_runs = [ A; B ]; transfer_target }
+ rules; season_runs = [ A; B ]; transfer_target; readings }
let entry ~month ~day ~slug ~rank =
{ Layer.date = (match Date_spec.fixed ~month ~day with Ok d -> d | Error e -> failwith e);
diff --git a/test/test_colitur.ml b/test/test_colitur.ml
index 66aec59..db2d41c 100644
--- a/test/test_colitur.ml
+++ b/test/test_colitur.ml
@@ -5,4 +5,5 @@ let () =
Test_overlay.suite; Test_temporal_ef.suite; Test_validate.suite; Test_precedence.suite;
Test_calendar.suite; Test_precedence_ef.suite; Test_sanctoral_ef.suite; Test_rite_ef.suite;
Test_differential.suite; Test_oracle.suite; Test_golden.suite;
- ("lectionary", Test_lectionary.suite) ]
+ ("lectionary", Test_lectionary.suite);
+ ("lectionary-ef", Test_lectionary_ef.suite) ]
diff --git a/test/test_lectionary_ef.ml b/test/test_lectionary_ef.ml
new file mode 100644
index 0000000..a1a324f
--- /dev/null
+++ b/test/test_lectionary_ef.ml
@@ -0,0 +1,68 @@
+open Colitur_kernel
+open Rite_ef
+
+(* Same pattern test_rite_ef.ml already uses: both [Calendar.year] and
+ [Calendar.day] take the rite AND the sanctoral layer (Rite.t carries no
+ layer of its own -- see rite_ef.mli's own note on why), so step 1's
+ sanctoral-proper case needs the REAL data/ef/sanctoral.sexp +
+ data/ef/adjustments.sexp loaded, not a bare [Rite_ef.context]. Relative
+ to this test's own build directory (_build/default/test/); test/dune
+ declares both as deps. *)
+let sanctoral_path = "../data/ef/sanctoral.sexp"
+let adjustments_path = "../data/ef/adjustments.sexp"
+
+let real_layer () =
+ let layer =
+ match Layer.load Vocab_ef.rank_of_sexp sanctoral_path with
+ | Ok l -> l
+ | Error e -> Alcotest.failf "%s: failed to load: %s" sanctoral_path e
+ in
+ let overlay =
+ match Overlay.load Vocab_ef.rank_of_sexp adjustments_path with
+ | Ok o -> o
+ | Error e -> Alcotest.failf "%s: failed to load: %s" adjustments_path e
+ in
+ let layer, diagnostics = Overlay.apply layer overlay in
+ Alcotest.(check (list string)) "the committed overlay applies cleanly, no diagnostics" []
+ (List.map Overlay.diagnostic_to_string diagnostics);
+ layer
+
+(* [Calendar.day] (not [year]): the liturgical year "opening in civil year y"
+ is Advent-anchored (RG 61), so [Calendar.year _ _ 2030] covers Advent 2030
+ through November 2031 -- it would never contain 13 January 2030, which
+ belongs to the liturgical year that opened in Advent 2029. [Calendar.day]
+ finds the containing liturgical year itself; see calendar.mli. *)
+let day y m d =
+ let date = match Date.make ~year:y ~month:m ~day:d with
+ | Ok x -> x | Error e -> Alcotest.fail e in
+ Calendar.day Rite_ef.context (real_layer ()) date
+
+let refs (ld : _ Liturgical_day.t) =
+ List.map (fun c -> c.Citation.reference) ld.citations
+
+(* Chain step 1: the observed celebration's own proper wins.
+
+ NOT 2030: that is the one pinned collision year (test_golden.ml,
+ [test_holy_family_excludes_baptism_2030]) where 13 January is itself the
+ Holy Family Sunday and RG 112(a) excludes the Baptism commemoration
+ entirely -- [observed] there is [ef-time-after-epiphany-sunday-1], not
+ this slug, so it is the wrong year to exercise step 1 against. 2026 is an
+ ordinary year (13 January a Tuesday, no Sunday collision), where the
+ fixed Commemoration of the Baptism of the Lord (Class2, subject Lord,
+ data/ef/sanctoral.sexp) is observed outright. *)
+let test_step1_sanctoral_proper () =
+ Alcotest.(check (list string))
+ "13 January 2026, Commemoration of the Baptism of the Lord"
+ [ "Isa 60:1-6"; "John 1:29-34" ]
+ (refs (day 2026 1 13))
+
+(* Chain step 2: the day's own temporal slug has a proper (Lent has one daily). *)
+let test_step2_lenten_feria_has_its_own () =
+ Alcotest.(check (list string))
+ "Monday of the 1st week of Lent is not the Sunday's Mass"
+ [ "Ezech 34:11-16"; "Matt 25:31-46" ]
+ (refs (day 2026 2 23))
+
+let suite =
+ [ ("step 1: sanctoral proper", `Quick, test_step1_sanctoral_proper);
+ ("step 2: own temporal proper", `Quick, test_step2_lenten_feria_has_its_own) ]
diff --git a/test/test_validate.ml b/test/test_validate.ml
index 501dd2e..9fa3c5c 100644
--- a/test/test_validate.ml
+++ b/test/test_validate.ml
@@ -276,10 +276,14 @@ module Synthetic = struct
defaults against the default empty [layer], since nothing ever contests
the temporal office there) so the resolution fixtures further down can
override them without duplicating every other field. *)
+ (* No fixture here exercises citations -- readings is a harmless constant
+ [], the same role the other placeholder defaults above play. *)
+ let readings ~observed:_ ~temporal:_ ~date:_ ~temporal_at:_ = []
+
let rite ?(vocab = vocab) ?(anchors = fun _ -> []) ?(season_runs = [ A; B ]) ?(rules = rules)
?(transfer_target = fun _ origin _ -> origin) temporal : (season, rank) Rite.t =
{ Rite.id = "synthetic"; vocab; year_start; temporal; anchors; rules; season_runs;
- transfer_target }
+ transfer_target; readings }
(* Empty by default: every check built before Task 12 exercises the
TEMPORAL-only pass, where an empty layer is exactly the fixture that