aboutsummaryrefslogtreecommitdiff
path: root/test/test_lectionary_ef.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_lectionary_ef.ml')
-rw-r--r--test/test_lectionary_ef.ml68
1 files changed, 68 insertions, 0 deletions
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) ]