Functional Weave
Code in Rust

dates.is-leap-year@1.0.0

vectors.json

1,407 bytes · view raw

[
  { "name": "2024 is divisible by 4, so a leap year", "args": [2024], "expect": true },
  { "name": "2026 is an ordinary year", "args": [2026], "expect": false },
  { "name": "1900 is a century year and not divisible by 400: not a leap year, though 1900 % 4 is 0", "args": [1900], "expect": false },
  { "name": "2000 is divisible by 400, so it is a leap year after all", "args": [2000], "expect": true },
  { "name": "2100 will not be a leap year", "args": [2100], "expect": false },
  { "name": "2400 will be", "args": [2400], "expect": true },
  { "name": "2023, the year before a leap year", "args": [2023], "expect": false },
  { "name": "year 1 is not a leap year", "args": [1], "expect": false },
  { "name": "year 4 is the first leap year in range", "args": [4], "expect": true },
  { "name": "9996 is the last leap year in range", "args": [9996], "expect": true },
  { "name": "9999 is the last supported year", "args": [9999], "expect": false },
  { "name": "year 0 is outside the supported range", "args": [0], "expectError": "outside the supported range" },
  { "name": "year 10000 is outside the supported range", "args": [10000], "expectError": "outside the supported range" },
  { "name": "a negative year is rejected", "args": [-4], "expectError": "outside the supported range" },
  { "name": "a fractional year is an error", "args": [2024.5], "expectError": "year must be an integer" }
]