summaryrefslogtreecommitdiff
path: root/test/test_validate.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_validate.ml')
-rw-r--r--test/test_validate.ml24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/test_validate.ml b/test/test_validate.ml
index b2d4f34..4b9c3c0 100644
--- a/test/test_validate.ml
+++ b/test/test_validate.ml
@@ -77,9 +77,10 @@ let extreme_years () =
let test_easter_extremes () =
let ys = extreme_years () in
- (* Both extremes genuinely occur in 1583..2500 (earliest 1818, latest
- 2038); requiring just "non-empty" would have passed even if the search
- silently found only one of them (register finding 15). *)
+ (* Both extremes genuinely occur in 1583..2500 (earliest 1598, latest
+ 1666 -- verified against Computus.gregorian_easter directly, not
+ transcribed); requiring just "non-empty" would have passed even if the
+ search silently found only one of them (register finding 15). *)
Alcotest.(check int) "found both extreme years (earliest 22 Mar and latest 25 Apr)" 2 (List.length ys);
List.iter check_year ys
@@ -539,6 +540,22 @@ let test_vocab_season_injectivity_fires () =
Alcotest.(check bool) "vocab check fires when season_to_string collapses two seasons to one string" true
(has_check "vocab" (run ~vocab:vocab_collapsed_seasons good))
+(* Plan 2 carried item 4: slug uniqueness moves into [Validate] itself, no
+ exemption. [target] (17 March, mid-run) is given the NEXT day's real slug
+ verbatim -- a genuine collision between two distinct dates in the same
+ walked year, touching only the [slug] field so every other check (season,
+ week, weekday, rank, colour, determinism, anchor) stays silent against it. *)
+let test_slugs_fires () =
+ let colliding_slug = (good (D.add_days target 1)).Temporal.office.Cel.slug in
+ let temporal d =
+ let t = good d in
+ if D.compare d target = 0 then
+ { t with Temporal.office = { t.Temporal.office with Cel.slug = colliding_slug } }
+ else t
+ in
+ Alcotest.(check bool) "slugs check fires when two dates in the year share a slug" true
+ (has_check "slugs" (run temporal))
+
(* ---- Task 12: resolution invariants ----
Each test below asserts that exactly one of the five new check labels
@@ -604,6 +621,7 @@ let suite =
Alcotest.test_case "anchor fires" `Quick test_anchor_fires;
Alcotest.test_case "vocab rank injectivity fires" `Quick test_vocab_rank_injectivity_fires;
Alcotest.test_case "vocab season injectivity fires" `Quick test_vocab_season_injectivity_fires;
+ Alcotest.test_case "slugs fires" `Quick test_slugs_fires;
Alcotest.test_case "lost fires on resolution exception" `Quick test_lost_fires_on_resolution_exception;
Alcotest.test_case "duplicated fires" `Quick test_duplicated_fires;
Alcotest.test_case "unconverged fires" `Quick test_unconverged_fires;