aboutsummaryrefslogtreecommitdiff
path: root/test/test_names.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-11 11:59:43 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-11 11:59:43 +0200
commitabade24943f2f77c058b5ff768093b8babc9a8c3 (patch)
tree33285f68860d21144bdad8388fabaf073b4771cb /test/test_names.ml
parent8b6c0036cb6c7f0e48a9370f53be25fd2bb243f4 (diff)
downloadcolitur-abade24943f2f77c058b5ff768093b8babc9a8c3.tar.gz
colitur-abade24943f2f77c058b5ff768093b8babc9a8c3.zip
kernel: Vocab, Celebration and Temporal parametric types
Rite specificity is carried by type parameters plus a vocab record of operations rather than by functors: the same guarantee that a rite cannot name another rite's season, without threading module plumbing through every kernel module. Celebration takes only the rank parameter, since it has no season field and OCaml rejects a type variable that appears in no field.
Diffstat (limited to 'test/test_names.ml')
-rw-r--r--test/test_names.ml22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/test_names.ml b/test/test_names.ml
index 9db8217..f340c62 100644
--- a/test/test_names.ml
+++ b/test/test_names.ml
@@ -74,6 +74,25 @@ let test_date_spec_sexp_roundtrip () =
Alcotest.(check bool) "sexp roundtrip" true (ds = ds')
| Error e -> Alcotest.failf "fixed: %s" e)
+module Cel = Colitur_kernel.Celebration
+module S = Colitur_kernel.Slug
+module Col = Colitur_kernel.Colour
+module Sub = Colitur_kernel.Subject
+
+(* A throwaway rank vocabulary, to exercise the parametric type. *)
+type demo_rank = High | Low [@@deriving sexp]
+
+let test_celebration () =
+ let c =
+ Cel.make ~slug:(S.of_string_exn "ef-easter-sunday")
+ ~names:(N.of_list [ (lang "la", "Dominica Resurrectionis") ])
+ ~rank:High ~colour:Col.White ~subject:Sub.Lord ~layer:"temporal" ()
+ in
+ Alcotest.(check string) "slug" "ef-easter-sunday" (S.to_string c.Cel.slug);
+ Alcotest.(check bool) "default citations empty" true (c.Cel.citations = []);
+ let sexp = Cel.sexp_of_t sexp_of_demo_rank c in
+ Alcotest.(check bool) "sexp roundtrip" true (Cel.t_of_sexp demo_rank_of_sexp sexp = c)
+
let suite =
( "Names/Citation/DateSpec",
[ Alcotest.test_case "names basics" `Quick test_names_basics;
@@ -83,4 +102,5 @@ let suite =
Alcotest.test_case "names sexp roundtrip" `Quick test_names_sexp_roundtrip;
Alcotest.test_case "citation" `Quick test_citation;
Alcotest.test_case "date_spec" `Quick test_date_spec;
- Alcotest.test_case "date_spec sexp roundtrip" `Quick test_date_spec_sexp_roundtrip ] )
+ Alcotest.test_case "date_spec sexp roundtrip" `Quick test_date_spec_sexp_roundtrip;
+ Alcotest.test_case "celebration" `Quick test_celebration ] )