aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-25 19:01:39 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-25 19:01:39 +0200
commita2be1f88ff9d2e4dd99689213692f2a03bbf999d (patch)
treeb369c70cd551ce8176fce591fdd6ebb61f9a065b /test
parentb9cb5060d2ba5aa7f7a9d6d97e3bced112e30fed (diff)
downloadcolitur-a2be1f88ff9d2e4dd99689213692f2a03bbf999d.tar.gz
colitur-a2be1f88ff9d2e4dd99689213692f2a03bbf999d.zip
feat(of): transcribe Tabula part I into precedence_of
The Tabula dierum liturgicorum's entries 1-4, one band branch each, scaled x10 as Precedence_ef's own table is. The Triduum is identified structurally by Easter offset because Temporal_of emits Good Friday and Holy Saturday as ordinary Lent week-6 ferias, leaving no slug to key on. Holy Thursday sits at entry 2, not entry 1: the Tabula's own entry 2 runs 'a feria II ad feriam V inclusive' and the Triduum opens with an evening Mass inside that civil day. Same granularity decision the litcal layer's L1 records on the season axis.
Diffstat (limited to 'test')
-rw-r--r--test/test_colitur.ml2
-rw-r--r--test/test_precedence_of.ml72
2 files changed, 73 insertions, 1 deletions
diff --git a/test/test_colitur.ml b/test/test_colitur.ml
index d1febea..b6675fd 100644
--- a/test/test_colitur.ml
+++ b/test/test_colitur.ml
@@ -11,7 +11,7 @@ let () =
Test_citation.render_suite;
("sigla", Test_citation.sigla_suite);
Test_config.suite;
- Test_overlay.suite; Test_overlay_ini.suite; Test_temporal_ef.suite; Test_temporal_of.suite; Test_litcal_of.suite;
+ Test_overlay.suite; Test_overlay_ini.suite; Test_temporal_ef.suite; Test_temporal_of.suite; Test_litcal_of.suite; Test_precedence_of.suite;
Test_validate.suite;
Test_precedence.suite;
Test_calendar.suite; Test_precedence_ef.suite; Test_sanctoral_ef.suite; Test_rite_ef.suite;
diff --git a/test/test_precedence_of.ml b/test/test_precedence_of.ml
new file mode 100644
index 0000000..bf514ff
--- /dev/null
+++ b/test/test_precedence_of.ml
@@ -0,0 +1,72 @@
+(* Table-driven, one Alcotest case per Tabula entry, so a transcription error
+ names the entry it broke. Mirrors test/test_precedence_ef.ml. *)
+open Colitur_kernel
+module Vocab_of = Rite_of.Vocab_of
+
+let mk_cel ?(layer = Rite_of.Precedence_of.universal_layer)
+ ?(status = Celebration.Feast) ?(colour = Colour.White)
+ ?(subject = Subject.Saint) ~slug ~rank () =
+ { Celebration.slug = Slug.of_string_exn slug;
+ names = Names.empty; rank; status; colour; subject;
+ citations = []; layer }
+
+let mk ?layer ?status ?colour ?subject ~slug ~rank ~origin () =
+ { Precedence.cel = mk_cel ?layer ?status ?colour ?subject ~slug ~rank ();
+ origin }
+
+let ctx ~iso ~season =
+ let date = Date.of_iso8601 iso |> Result.get_ok in
+ { Precedence.date; season; weekday = Date.weekday date }
+
+(* Each row: label, context, candidate, expected band value. *)
+let part1_cases =
+ [ ( "entry 1: Good Friday",
+ ctx ~iso:"2026-04-03" ~season:Vocab_of.Lent,
+ mk ~slug:"of-lent-6-friday" ~rank:Vocab_of.Feria ~origin:Precedence.Temporal (),
+ 10 );
+ ( "entry 1: Holy Saturday",
+ ctx ~iso:"2026-04-04" ~season:Vocab_of.Lent,
+ mk ~slug:"of-lent-6-saturday" ~rank:Vocab_of.Feria ~origin:Precedence.Temporal (),
+ 10 );
+ ( "entry 1: Easter Sunday",
+ ctx ~iso:"2026-04-05" ~season:Vocab_of.Easter,
+ mk ~slug:"of-easter-sunday" ~rank:Vocab_of.Sollemnitas ~origin:Precedence.Temporal (),
+ 10 );
+ ( "entry 2: Holy Thursday is a Holy Week feria, not the Triduum",
+ ctx ~iso:"2026-04-02" ~season:Vocab_of.Lent,
+ mk ~slug:"of-lent-6-thursday" ~rank:Vocab_of.Feria ~origin:Precedence.Temporal (),
+ 20 );
+ ( "entry 2: the Nativity",
+ ctx ~iso:"2026-12-25" ~season:Vocab_of.Christmas,
+ mk ~slug:"of-nativity" ~rank:Vocab_of.Sollemnitas ~origin:Precedence.Temporal (),
+ 20 );
+ ( "entry 2: a Sunday of Advent",
+ ctx ~iso:"2026-11-29" ~season:Vocab_of.Advent,
+ mk ~slug:"of-advent-sunday-1" ~rank:Vocab_of.Sollemnitas ~origin:Precedence.Temporal (),
+ 20 );
+ ( "entry 2: Ash Wednesday",
+ ctx ~iso:"2026-02-18" ~season:Vocab_of.Lent,
+ mk ~slug:"of-ash-wednesday" ~rank:Vocab_of.Feria ~origin:Precedence.Temporal (),
+ 20 );
+ ( "entry 2: a day within the Octave of Easter",
+ ctx ~iso:"2026-04-07" ~season:Vocab_of.Easter,
+ mk ~slug:"of-easter-octave-day-3" ~rank:Vocab_of.Sollemnitas ~origin:Precedence.Temporal (),
+ 20 );
+ ( "entry 3: a universal solemnity of a saint",
+ ctx ~iso:"2026-06-29" ~season:Vocab_of.Ordinary_time,
+ mk ~slug:"of-peter-and-paul" ~rank:Vocab_of.Sollemnitas ~origin:Precedence.Sanctoral (),
+ 30 );
+ ( "entry 4: a proper solemnity",
+ ctx ~iso:"2026-06-29" ~season:Vocab_of.Ordinary_time,
+ mk ~layer:"proper:diocese-of-poznan" ~slug:"of-local-patron"
+ ~rank:Vocab_of.Sollemnitas ~origin:Precedence.Sanctoral (),
+ 40 ) ]
+
+let test_part1 () =
+ List.iter
+ (fun (label, c, cand, expected) ->
+ Alcotest.(check int) label expected (Rite_of.Precedence_of.band c cand))
+ part1_cases
+
+let suite =
+ ("precedence-of", [ Alcotest.test_case "Tabula part I (entries 1-4)" `Quick test_part1 ])