Enumerate the exercises

This commit is contained in:
2023-12-11 16:13:48 +00:00
parent 3558a24b47
commit 3052288380
13 changed files with 4 additions and 2 deletions

29
02_leap_years.lua Normal file
View File

@@ -0,0 +1,29 @@
-- Implement is_leap_year() below, returning whether the given year is
-- a leap year according to the Gregorian calendar.
--
-- Solution --------------------------------------------------------------------
function is_leap_year(year)
-- Your implementation here
end
-- Tests -----------------------------------------------------------------------
local luaunit = require("luaunit.luaunit")
function test_2004_is_leap_year()
luaunit.assertTrue(is_leap_year(2004))
end
function test_1993_is_not_leap_year()
luaunit.assertFalse(is_leap_year(1993))
end
function test_1900_is_not_leap_year()
luaunit.assertFalse(is_leap_year(1900))
end
function test_2000_is_leap_year()
luaunit.assertTrue(is_leap_year(2000))
end
os.exit(luaunit.LuaUnit.run())