icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Add snapshot test of Date add/until

Open sffc opened this issue 2 months ago • 5 comments

We have some hand-written tests, but I would like to have more thorough tests that check the whole space, to make sure that any changes to the algorithm, such as #7077, don't change the resulting behavior.

I wonder if we could leverage the Arbitrary impls from #7206 to assist in this.

sffc avatar Nov 04 '25 00:11 sffc

What I had in mind was a more comprehensive coverage test for a certain range of dates and durations. For example:

  1. Every date between 2000-01-01 and 2004-12-31 (1826 days)
  2. Durations as follows:
    • -P65D through P65D (131 durations)
    • -P30M through P30M (61 durations)
    • -P30M1D through P30M1D (61 durations)
    • -P10Y through P10Y (21 durations)
    • -P10Y1M through P10Y1M (21 durations)
    • -P10Y1D through P10Y1D (21 durations)
    • -P10Y1M1D through P10Y1M1D (21 durations)

Across 18 calendars, this results in: 18 * 1826 * 337 = 11,076,516 tests.

If that's too many tests, I'm okay reducing the number of dates, but I want to make sure that we cover leap days and leap months in every calendar.

Open to suggestions.

sffc avatar Nov 16 '25 23:11 sffc

This issue isn't fixed; the linked PR added some infrastructure but not comprehensive coverage.

sffc avatar Dec 02 '25 22:12 sffc

Thanks for the update. I can continue working on the remaining coverage if needed. Please let me know what additional cases should be tested or fixed.

SATVIKsynopsis avatar Dec 09 '25 23:12 SATVIKsynopsis

@SATVIKsynopsis I gave some suggestions in https://github.com/unicode-org/icu4x/issues/7215#issuecomment-3539458618.

sffc avatar Dec 10 '25 01:12 sffc

Sure, I will work on those suggestions and make a PR soon.

SATVIKsynopsis avatar Dec 10 '25 03:12 SATVIKsynopsis