Write palindrome exercise
This commit is contained in:
34
palindromes.lua
Normal file
34
palindromes.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Solution --------------------------------------------------------------------
|
||||
function is_palindrome(str)
|
||||
-- Your implementation here
|
||||
end
|
||||
|
||||
-- Tests -----------------------------------------------------------------------
|
||||
|
||||
local luaunit = require("luaunit.luaunit")
|
||||
|
||||
function test_foo_is_not_palindrome()
|
||||
luaunit.assertFalse(is_palindrome("foo"))
|
||||
end
|
||||
|
||||
function test_wow_is_palindrome()
|
||||
luaunit.assertTrue(is_palindrome("wow"))
|
||||
end
|
||||
|
||||
function test_toast_is_not_palindrome()
|
||||
luaunit.assertFalse(is_palindrome("toast"))
|
||||
end
|
||||
|
||||
function test_Racecar_is_palindrome()
|
||||
luaunit.assertTrue(is_palindrome("Race car"))
|
||||
end
|
||||
|
||||
function test_Do_geese_see_God_is_palindrome()
|
||||
luaunit.assertTrue(is_palindrome("Do geese see God?"))
|
||||
end
|
||||
|
||||
function test_No_lemons_no_melon_is_palindrome()
|
||||
luaunit.assertTrue(is_palindrome("No lemons, no melon."))
|
||||
end
|
||||
|
||||
os.exit(luaunit.LuaUnit.run())
|
||||
Reference in New Issue
Block a user