local dates = require "activity.dates" describe("Days in a year", function() it("should support regular years", function() assert.are.equal(365, dates.days_in(1970)) assert.are.equal(365, dates.days_in(2001)) end) it("should support lean years", function() assert.are.equal(366, dates.days_in(2004)) assert.are.equal(366, dates.days_in(1980)) end) it("should support *00 years", function() assert.are.equal(366, dates.days_in(2000)) assert.are.equal(365, dates.days_in(2100)) assert.are.equal(365, dates.days_in(2200)) assert.are.equal(365, dates.days_in(2300)) assert.are.equal(366, dates.days_in(2400)) end) end) describe("This year is", function() local this_year = tonumber(os.date"%Y") -- Quite useless test it(tostring(this_year), function() assert.are.equal(this_year, dates.this_year()) end) end) describe("First week day of", function() it("2023 is Sunday", function() assert.are.equal(1, dates.first_week_day(2023)) end) it("2022 is Saturday", function() assert.are.equal(7, dates.first_week_day(2022)) end) it("2020 is Wednesday", function() assert.are.equal(4, dates.first_week_day(2020)) end) end)