1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package calendar_test
// Reproduction tests for three named EF precedence defects (colitur's
// differential/oracle audit against lectio's ~66-line EF precedence
// approximation, internal/calendar/precedence_ef.go). Each test fails before
// its fix and passes after -- see the report for the exact pre-fix failure
// message. These exercise the REAL tridentine sanctoral data
// (caldata.Tridentine()) through the public Compute entry point, since the
// bugs are about how real fixed-date feasts interact with the temporal
// calendar, not about precedenceEF's arithmetic in isolation (that is
// covered separately, package-internal, in precedence_ef_test.go).
import (
"testing"
"time"
"github.com/lukaszkasprzak/lectio/internal/caldata"
"github.com/lukaszkasprzak/lectio/internal/calendar"
)
func efCompute(date string) calendar.LiturgicalDay {
sel := calendar.DefaultSelection()
sel.Form = "old"
d, _ := time.Parse("2006-01-02", date)
return calendar.Compute(d.UTC(), sel, []calendar.Layer{caldata.Tridentine()})
}
// TestJosephYieldsToSundayOfLent: RG 91 entry 6 (Sundays of Lent, I class)
// vs entry 11 (I-class feasts of the universal Church not above) -- the
// Sunday holds; St Joseph (19 March) transfers to the next free day (RG 95,
// RG 96), landing on the 20th. Before the fix (defect 4: Sunday ranks), Lent
// Sundays were wrongly II class, so Joseph (I class) won outright every time
// this collision occurred.
func TestJosephYieldsToSundayOfLent(t *testing.T) {
for _, year := range []string{"2006", "2017", "2023", "2028", "2034", "2045"} {
sunday := efCompute(year + "-03-19")
if sunday.Observed.Slug == "joseph-spouse-of-the-bl-virgin-mary" {
t.Errorf("%s-03-19 observed = %q want the Lent Sunday (RG 91 entry 6 beats entry 11)", year, sunday.Observed.Slug)
}
next := efCompute(year + "-03-20")
if next.Observed.Slug != "joseph-spouse-of-the-bl-virgin-mary" {
t.Errorf("%s-03-20 observed = %q want joseph-spouse-of-the-bl-virgin-mary (transferred one day, RG 96)", year, next.Observed.Slug)
}
}
}
|