24 lines
713 B
Lua
24 lines
713 B
Lua
-- Solution --------------------------------------------------------------------
|
|
|
|
function greatest_common_divisor(x, y)
|
|
-- Your implementation here
|
|
end
|
|
|
|
-- Tests -----------------------------------------------------------------------
|
|
|
|
local luaunit = require("luaunit.luaunit")
|
|
|
|
function test_greatest_common_divisor_of_1386_and_3213_is_63()
|
|
luaunit.assertEquals(greatest_common_divisor(1386, 3213), 63)
|
|
end
|
|
|
|
function test_greatest_common_divisor_of_1470_and_3234_is_294()
|
|
luaunit.assertEquals(greatest_common_divisor(1470, 3234), 294)
|
|
end
|
|
|
|
function test_greatest_common_divisor_of_931_and_399_is_133()
|
|
luaunit.assertEquals(greatest_common_divisor(931, 399), 133)
|
|
end
|
|
|
|
os.exit(luaunit.LuaUnit.run())
|