diff options
Diffstat (limited to 'internal/calendar/precedence_ef_repro_test.go')
| -rw-r--r-- | internal/calendar/precedence_ef_repro_test.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/internal/calendar/precedence_ef_repro_test.go b/internal/calendar/precedence_ef_repro_test.go new file mode 100644 index 0000000..6c333d0 --- /dev/null +++ b/internal/calendar/precedence_ef_repro_test.go @@ -0,0 +1,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) + } + } +} |
