aboutsummaryrefslogtreecommitdiff
path: root/internal/psalter/psalter_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 12:41:29 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 12:41:29 +0200
commitab71c67414666800f19fdd3f6515f15c90cb822e (patch)
tree2b8e566f9a7cf5254689a941f26bbfdd1d035be8 /internal/psalter/psalter_test.go
parentf9a71c6e5512116a678ddcd0910c22d0aae5df25 (diff)
downloadlectio-ab71c67414666800f19fdd3f6515f15c90cb822e.tar.gz
lectio-ab71c67414666800f19fdd3f6515f15c90cb822e.zip
psalter: port psalm versification
Diffstat (limited to 'internal/psalter/psalter_test.go')
-rw-r--r--internal/psalter/psalter_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/psalter/psalter_test.go b/internal/psalter/psalter_test.go
new file mode 100644
index 0000000..612bf1d
--- /dev/null
+++ b/internal/psalter/psalter_test.go
@@ -0,0 +1,28 @@
+package psalter
+
+import "testing"
+
+func TestDrbVerse(t *testing.T) {
+ cases := []struct{ psalm, v, want int }{
+ {34, 2, 1}, // Ps 34: k=1, title folded
+ {34, 3, 2},
+ {51, 3, 1}, // Ps 51: k=2 (two-line title)
+ {63, 2, 1}, // Ps 63: k=1
+ {1, 5, 5}, // untitled: identity
+ {34, 1, 1}, // clamp: never below 1
+ }
+ for _, c := range cases {
+ if got := DrbVerse(c.psalm, c.v); got != c.want {
+ t.Errorf("DrbVerse(%d,%d)=%d want %d", c.psalm, c.v, got, c.want)
+ }
+ }
+}
+
+func TestHebrewToVulgateChapter(t *testing.T) {
+ cases := []struct{ h, want int }{{8, 8}, {34, 33}, {9, 9}, {10, 9}, {116, 114}, {147, 146}, {150, 150}}
+ for _, c := range cases {
+ if got := HebrewToVulgateChapter(c.h); got != c.want {
+ t.Errorf("HebrewToVulgateChapter(%d)=%d want %d", c.h, got, c.want)
+ }
+ }
+}