39 lines
953 B
Lua
39 lines
953 B
Lua
-- Solution --------------------------------------------------------------------
|
|
function is_queen_threat(queen_position, pawn_position)
|
|
-- Your implementation here
|
|
end
|
|
|
|
-- Tests -----------------------------------------------------------------------
|
|
|
|
local luaunit = require("luaunit.luaunit")
|
|
|
|
function test_B4_theatens_G4()
|
|
luaunit.assertTrue(is_queen_threat("B4", "G4"))
|
|
end
|
|
|
|
function test_D7_theatens_D1()
|
|
luaunit.assertTrue(is_queen_threat("D7", "D1"))
|
|
end
|
|
|
|
function test_C5_theatens_F8()
|
|
luaunit.assertTrue(is_queen_threat("C5", "F8"))
|
|
end
|
|
|
|
function test_B3_theatens_D1()
|
|
luaunit.assertTrue(is_queen_threat("B3", "D1"))
|
|
end
|
|
|
|
function test_B4_does_not_threaten_F3()
|
|
luaunit.assertFalse(is_queen_threat("B4", "F3"))
|
|
end
|
|
|
|
function test_E2_does_not_threaten_G1()
|
|
luaunit.assertFalse(is_queen_threat("E2", "G1"))
|
|
end
|
|
|
|
function test_A8_does_not_threaten_G3()
|
|
luaunit.assertFalse(is_queen_threat("A8", "G3"))
|
|
end
|
|
|
|
os.exit(luaunit.LuaUnit.run())
|