Add lua-format config and auto-format all exercises

This commit is contained in:
2023-12-11 12:11:47 +00:00
parent 467ca0446a
commit 017ef8bac4
9 changed files with 79 additions and 54 deletions

View File

@@ -1,7 +1,6 @@
-- Solution --------------------------------------------------------------------
function is_queen_threat(queen_position, pawn_position)
-- Your implementation here
-- Your implementation here
end
-- Tests -----------------------------------------------------------------------
@@ -9,31 +8,31 @@ end
local luaunit = require("luaunit.luaunit")
function test_B4_theatens_G4()
luaunit.assertTrue(is_queen_threat("B4", "G4"))
luaunit.assertTrue(is_queen_threat("B4", "G4"))
end
function test_D7_theatens_D1()
luaunit.assertTrue(is_queen_threat("D7", "D1"))
luaunit.assertTrue(is_queen_threat("D7", "D1"))
end
function test_C5_theatens_F8()
luaunit.assertTrue(is_queen_threat("C5", "F8"))
luaunit.assertTrue(is_queen_threat("C5", "F8"))
end
function test_B3_theatens_D1()
luaunit.assertTrue(is_queen_threat("B3", "D1"))
luaunit.assertTrue(is_queen_threat("B3", "D1"))
end
function test_B4_does_not_threaten_F3()
luaunit.assertFalse(is_queen_threat("B4", "F3"))
luaunit.assertFalse(is_queen_threat("B4", "F3"))
end
function test_E2_does_not_threaten_G1()
luaunit.assertFalse(is_queen_threat("E2", "G1"))
luaunit.assertFalse(is_queen_threat("E2", "G1"))
end
function test_A8_does_not_threaten_G3()
luaunit.assertFalse(is_queen_threat("A8", "G3"))
luaunit.assertFalse(is_queen_threat("A8", "G3"))
end
os.exit(luaunit.LuaUnit.run())