The four rules, one example year each
All 6 scenarios hold
The classic introductory example is the Gregorian leap year rules. The first rule below gives one example year per rule. The second uses value sets, and shows that each rule holds across eras.
A custom type converter reads Yes and No in the expectation column.
The table has six rows for four rules. The last two rows are outside the four rules. They are year zero and a year before the common era, where the same arithmetic applies.
expected outcome
broken scenario
| Scenario | Year | Is Leap Year? |
|---|---|---|
| Not divisible by 4 | 2001 | No |
| Divisible by 4 | 2004 | Yes |
| Divisible by 100 but not by 400 | 2100 | No |
| Divisible by 400 | 2000 | Yes |
| Year zero | 0 | Yes |
| A year before the common era | -1 | No |