Functional Weave
Code in Rust

manufacturing.lot-number@1.0.0

vectors.json

2,039 bytes · view raw

[
  { "name": "first day of the year, first line, first lot", "args": ["2026-01-01", 1, 1], "expect": "26001-01-001" },
  { "name": "1 March 2026 is day 60 in a common year", "args": ["2026-03-01", 3, 12], "expect": "26060-03-012" },
  { "name": "1 March 2024 is day 61: the leap day moves it", "args": ["2024-03-01", 3, 12], "expect": "24061-03-012" },
  { "name": "29 February 2024 is day 60", "args": ["2024-02-29", 7, 5], "expect": "24060-07-005" },
  { "name": "31 December in a common year is day 365", "args": ["2026-12-31", 10, 100], "expect": "26365-10-100" },
  { "name": "31 December in a leap year is day 366", "args": ["2024-12-31", 2, 1], "expect": "24366-02-001" },
  { "name": "2000 was a leap year (divisible by 400): 31 December is day 366 and the year is 00", "args": ["2000-12-31", 1, 1], "expect": "00366-01-001" },
  { "name": "1900 was not a leap year (divisible by 100): 1 March is day 60", "args": ["1900-03-01", 1, 1], "expect": "00060-01-001" },
  { "name": "the largest line and sequence fill the fields", "args": ["2026-09-23", 99, 999], "expect": "26266-99-999" },
  { "name": "line 0 is an error", "args": ["2026-09-23", 0, 1], "expectError": "line must be a whole number from 1 to 99" },
  { "name": "line 100 does not fit two digits", "args": ["2026-09-23", 100, 1], "expectError": "line must be a whole number from 1 to 99" },
  { "name": "sequence 1000 does not fit three digits", "args": ["2026-09-23", 1, 1000], "expectError": "sequence must be a whole number from 1 to 999" },
  { "name": "sequence 0 is an error", "args": ["2026-09-23", 1, 0], "expectError": "sequence must be a whole number from 1 to 999" },
  { "name": "a fractional line is an error", "args": ["2026-09-23", 1.5, 1], "expectError": "line must be a whole number from 1 to 99" },
  { "name": "a date that does not exist is an error", "args": ["2026-02-30", 1, 1], "expectError": "is not a real calendar date" },
  { "name": "a date that is not ISO is an error", "args": ["23/09/2026", 1, 1], "expectError": "is not an ISO date" }
]