aboutsummaryrefslogtreecommitdiff
path: root/test/test_overlay.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_overlay.ml')
-rw-r--r--test/test_overlay.ml13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/test_overlay.ml b/test/test_overlay.ml
index b5edd5a..f3d1aee 100644
--- a/test/test_overlay.ml
+++ b/test/test_overlay.ml
@@ -1,4 +1,7 @@
module L = Colitur_kernel.Layer
+
+let mkdate y m d =
+ match Colitur_kernel.Date.make ~year:y ~month:m ~day:d with Ok x -> x | Error e -> failwith e
module Cel = Colitur_kernel.Celebration
module S = Colitur_kernel.Slug
module DS = Colitur_kernel.Date_spec
@@ -47,9 +50,9 @@ let test_layer_basics () =
(List.map (fun e -> S.to_string e.L.cel.Cel.slug) l.L.entries)
let test_layer_index () =
- let idx = L.index_by_date (base ()) in
- Alcotest.(check int) "Jan 14 has one" 1 (List.length (L.on_date idx ~month:1 ~day:14));
- Alcotest.(check int) "Jan 20 has none" 0 (List.length (L.on_date idx ~month:1 ~day:20))
+ let idx = L.index (base ()) ~easter:Colitur_kernel.Computus.gregorian_easter ~years:[ 2026 ] in
+ Alcotest.(check int) "Jan 14 has one" 1 (List.length (L.on_date idx (mkdate 2026 1 14)));
+ Alcotest.(check int) "Jan 20 has none" 0 (List.length (L.on_date idx (mkdate 2026 1 20)))
(* Three entries sharing a date, inserted deliberately out of canonical
(by-slug) order: this is what actually pins accumulation (the bucket must
@@ -61,8 +64,8 @@ let test_layer_index_same_date () =
L.of_entries ~id:"base" ~name:"Test same-date"
[ entry ~month:3 ~day:17 "zeta"; entry ~month:3 ~day:17 "alpha"; entry ~month:3 ~day:17 "mu" ]
in
- let idx = L.index_by_date l in
- let bucket = L.on_date idx ~month:3 ~day:17 in
+ let idx = L.index l ~easter:Colitur_kernel.Computus.gregorian_easter ~years:[ 2026 ] in
+ let bucket = L.on_date idx (mkdate 2026 3 17) in
Alcotest.(check int) "three entries share Mar 17" 3 (List.length bucket);
Alcotest.(check (list string)) "bucket sorted by slug" [ "alpha"; "mu"; "zeta" ]
(List.map (fun e -> S.to_string e.L.cel.Cel.slug) bucket)