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_anagram(str1, str2)
-- Your implementation here
-- Your implementation here
end
-- Tests -----------------------------------------------------------------------
@@ -9,31 +8,31 @@ end
local luaunit = require("luaunit.luaunit")
function test_listen_is_anagram_of_silent()
luaunit.assertTrue(is_anagram("listen", "silent"))
luaunit.assertTrue(is_anagram("listen", "silent"))
end
function test_astronomers_is_anagram_of_moon_starers()
luaunit.assertTrue(is_anagram("astronomers", "moon starers"))
luaunit.assertTrue(is_anagram("astronomers", "moon starers"))
end
function test_dormitory_is_anagram_of_dirty_room()
luaunit.assertTrue(is_anagram("dormitory", "dirty room"))
luaunit.assertTrue(is_anagram("dormitory", "dirty room"))
end
function test_foo_is_not_anagram_of_bar()
luaunit.assertFalse(is_anagram("foo", "bar"))
luaunit.assertFalse(is_anagram("foo", "bar"))
end
function test_foo_is_not_anagram_of_of()
luaunit.assertFalse(is_anagram("foo", "of"))
luaunit.assertFalse(is_anagram("foo", "of"))
end
function test_bar_is_not_anagram_of_barn()
luaunit.assertFalse(is_anagram("bar", "barn"))
luaunit.assertFalse(is_anagram("bar", "barn"))
end
function test_barn_is_not_anagram_of_bar()
luaunit.assertFalse(is_anagram("barn", "bar"))
luaunit.assertFalse(is_anagram("barn", "bar"))
end
os.exit(luaunit.LuaUnit.run())