diff options
Diffstat (limited to 'test/test_computus.ml')
| -rw-r--r-- | test/test_computus.ml | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/test_computus.ml b/test/test_computus.ml index 1502ad2..cbb8cab 100644 --- a/test/test_computus.ml +++ b/test/test_computus.ml @@ -31,8 +31,26 @@ let test_gregorian_invariants_exhaustive () = Alcotest.(check bool) (Printf.sprintf "%d Easter in [Mar22,Apr25]" y) true ok done +let test_anchors_2026 () = + (* Easter 2026 = Apr 5 *) + Alcotest.(check (triple int int int)) "Ash Wednesday 2026" (2026, 2, 18) (ymd (C.ash_wednesday 2026)); + Alcotest.(check (triple int int int)) "Palm Sunday 2026" (2026, 3, 29) (ymd (C.palm_sunday 2026)); + Alcotest.(check (triple int int int)) "Ascension 2026" (2026, 5, 14) (ymd (C.ascension 2026)); + Alcotest.(check (triple int int int)) "Pentecost 2026" (2026, 5, 24) (ymd (C.pentecost 2026)) + +let test_anchor_weekdays_exhaustive () = + for y = 1583 to 9999 do + Alcotest.(check bool) (Printf.sprintf "%d Ash Wed = Wed" y) true (D.weekday (C.ash_wednesday y) = D.Wed); + Alcotest.(check bool) (Printf.sprintf "%d Palm Sun = Sun" y) true (D.weekday (C.palm_sunday y) = D.Sun); + Alcotest.(check bool) (Printf.sprintf "%d Ascension = Thu" y) true (D.weekday (C.ascension y) = D.Thu); + Alcotest.(check bool) (Printf.sprintf "%d Pentecost = Sun" y) true (D.weekday (C.pentecost y) = D.Sun); + Alcotest.(check bool) (Printf.sprintf "%d Corpus Christi = Thu" y) true (D.weekday (C.corpus_christi y) = D.Thu) + done + let suite = ( "Computus", [ Alcotest.test_case "Gregorian known dates" `Quick test_gregorian_known; Alcotest.test_case "Julian known dates" `Quick test_julian_known; - Alcotest.test_case "Gregorian invariants 1583..9999" `Slow test_gregorian_invariants_exhaustive ] ) + Alcotest.test_case "Gregorian invariants 1583..9999" `Slow test_gregorian_invariants_exhaustive; + Alcotest.test_case "anchors 2026" `Quick test_anchors_2026; + Alcotest.test_case "anchor weekdays 1583..9999" `Slow test_anchor_weekdays_exhaustive ] ) |
