Module:palindromes/testcases
Jump to navigation
Jump to search
- The following documentation is located at Module:palindromes/testcases/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
7 of 82 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
واحد | false | false | |
ترجم | false | false | |
ر | false | false | |
نون | true | true | |
باب | true | true | |
تحت | true | true | |
يرى | true | true | |
آباء | true | true | |
أشاء | true | true | |
يجئ | true | true | |
أنا | true | true | |
همة | true | true | |
وضؤ | true | true |
Text | Expected | Actual | |
---|---|---|---|
नून | false | true | |
ननून | true | false | |
नूनू | true | false | |
प्रतंप्र | true | false |
Text | Expected | Actual | |
---|---|---|---|
tázat | true | true |
Text | Expected | Actual | |
---|---|---|---|
σορός | true | true | |
αλλά | true | true |
Text | Expected | Actual | |
---|---|---|---|
a | false | false | |
ab | false | false | |
aa | false | false | |
aba | true | true | |
a.a | false | false | |
abc | false | false | |
AAA | false | false | |
palindromemordnilap | true | true | |
non- | false | false | |
-n- | false | false | |
I, man, am regal - a German am I | true | true | |
Never odd or even | true | true | |
If I had a hi-fi | true | true | |
Madam, I'm Adam | true | true | |
Too hot to hoot | true | true | |
No lemons, no melon | true | true | |
Too bad I hid a boot | true | true | |
Lisa Bonet ate no basil | true | true | |
Warsaw was raw | true | true | |
Was it a car or a cat I saw? | true | true | |
Rise to vote, sir | true | true | |
Do geese see god? | true | true | |
"Do nine men interpret?" "Nine men," I nod | true | true | |
Rats live on no evil star | true | true | |
Won't lovers revolt now? | true | true | |
Race fast, safe car | true | true | |
Pa's a sap | true | true | |
Ma is as selfless as I am | true | true | |
May a moody baby doom a yam? | true | true | |
Ah, Satan sees Natasha | true | true | |
No devil lived on | true | true | |
Lonely Tylenol | true | true | |
Not a banana baton | true | true | |
No "x" in "Nixon" | true | true | |
O, stone, be not so | true | true | |
O Geronimo, no minor ego | true | true | |
"Naomi," I moan | true | true | |
"A Toyota's a Toyota" | true | true | |
A dog, a panic in a pagoda | true | true | |
Oh no! Don Ho! | true | true | |
Nurse, I spy gypsies - run! | true | true | |
Senile felines | true | true | |
Now I see bees I won | true | true | |
UFO tofu | true | true | |
We panic in a pew | true | true | |
Oozy rat in a sanitary zoo | true | true | |
God! A red nugget! A fat egg under a dog! | true | true | |
Go hang a salami, I'm a lasagna hog | true | true | |
à la | true | true |
Text | Expected | Actual | |
---|---|---|---|
ΝΙΨΟΝ ΑΝΟΜΗΜΑΤΑ ΜΗ ΜΟΝΑΝ ΟΨΙΝ | true | true | |
Νίψον ἀνομήματα, μὴ μόναν ὄψιν | true | true |
Text | Expected | Actual | |
---|---|---|---|
ףרשנו רעבתן שבדבש ןתבער ונשרף | true | true | |
פרשנו רעבתן שבדבש נתבער ונשרף | true | true | |
ﭏ׳װױײ ט ייי־ווול״א׳ | true | true |
Text | Expected | Actual | |
---|---|---|---|
szusz | true | true | |
kérek | true | false | |
kerék | true | false | |
csúcs | true | true |
Text | Expected | Actual | |
---|---|---|---|
いかにもにがい | true | true | |
akka | false | false | |
akka | false | true |
Text | Expected | Actual | |
---|---|---|---|
قاپاق | true | true |
local tests = require('Module:UnitTests')
local m_palindromes = require('Module:palindromes')
local m_languages = require("Module:languages")
local function check_palindrome(word, expected, langcode, sc_code)
sc = sc_code and require('Module:scripts').getByCode(sc_code) or nil
tests:equals(
word,
m_palindromes.is_palindrome(word, m_languages.getByCode(langcode), sc),
expected
)
end
function tests:test_palindrome_en()
check_palindrome('a', false, "en")
check_palindrome('ab', false, "en")
check_palindrome('aa', false, "en")
check_palindrome('aba', true, "en")
check_palindrome('a.a', false, "en")
check_palindrome('abc', false, "en")
check_palindrome('AAA', false, "en")
check_palindrome('palindromemordnilap', true, "en")
check_palindrome('non-', false, "en")
-- unsure about these two cases:
--check_palindrome('7/7', false, 'en')
--check_palindrome('B & B', false, 'en')
check_palindrome("-n-", false, "en")
check_palindrome("I, man, am regal - a German am I", true, 'en')
check_palindrome("Never odd or even", true, 'en')
check_palindrome("If I had a hi-fi", true, 'en')
check_palindrome("Madam, I\'m Adam", true, 'en')
check_palindrome("Too hot to hoot", true, 'en')
check_palindrome("No lemons, no melon", true, 'en')
check_palindrome("Too bad I hid a boot", true, 'en')
check_palindrome("Lisa Bonet ate no basil", true, 'en')
check_palindrome("Warsaw was raw", true, 'en')
check_palindrome("Was it a car or a cat I saw?", true, 'en')
check_palindrome("Rise to vote, sir", true, 'en')
check_palindrome("Do geese see god?", true, 'en')
check_palindrome("\"Do nine men interpret?\" \"Nine men,\" I nod", true, 'en')
check_palindrome("Rats live on no evil star", true, 'en')
check_palindrome("Won\'t lovers revolt now?", true, 'en')
check_palindrome("Race fast, safe car", true, 'en')
check_palindrome("Pa\'s a sap", true, 'en')
check_palindrome("Ma is as selfless as I am", true, 'en')
check_palindrome("May a moody baby doom a yam?", true, 'en')
check_palindrome("Ah, Satan sees Natasha", true, 'en')
check_palindrome("No devil lived on", true, 'en')
check_palindrome("Lonely Tylenol", true, 'en')
check_palindrome("Not a banana baton", true, 'en')
check_palindrome("No \"x\" in \"Nixon\"", true, 'en')
check_palindrome("O, stone, be not so", true, 'en')
check_palindrome("O Geronimo, no minor ego", true, 'en')
check_palindrome("\"Naomi,\" I moan", true, 'en')
check_palindrome("\"A Toyota\'s a Toyota\"", true, 'en')
check_palindrome("A dog, a panic in a pagoda", true, 'en')
check_palindrome("Oh no! Don Ho!", true, 'en')
check_palindrome("Nurse, I spy gypsies - run!", true, 'en')
check_palindrome("Senile felines", true, 'en')
check_palindrome("Now I see bees I won", true, 'en')
check_palindrome("UFO tofu", true, 'en')
check_palindrome("We panic in a pew", true, 'en')
check_palindrome("Oozy rat in a sanitary zoo", true, 'en')
check_palindrome("God! A red nugget! A fat egg under a dog!", true, 'en')
check_palindrome("Go hang a salami, I\'m a lasagna hog", true, 'en')
check_palindrome("à la", true, 'en')
end
function tests:test_palindrome_he()
check_palindrome("ףרשנו רעבתן שבדבש ןתבער ונשרף", true, "he")
check_palindrome("פרשנו רעבתן שבדבש נתבער ונשרף", true, "he")
check_palindrome("ﭏ׳װױײ ט ייי־ווול״א׳", true, "he")
end
function tests:test_palindrome_grc()
check_palindrome("ΝΙΨΟΝ ΑΝΟΜΗΜΑΤΑ ΜΗ ΜΟΝΑΝ ΟΨΙΝ", true, 'grc')
check_palindrome("Νίψον ἀνομήματα, μὴ μόναν ὄψιν", true, 'grc')
end
function tests:test_palindrome_hu()
check_palindrome("szusz", true, 'hu')
check_palindrome("kérek", true, 'hu')
check_palindrome("kerék", true, 'hu')
check_palindrome("csúcs", true, 'hu')
end
function tests:test_palindrome_el()
check_palindrome("σορός", true, "el")
check_palindrome("αλλά", true, "el")
end
function tests:test_palindrome_cs()
check_palindrome("tázat", true, "cs")
end
function tests:test_palindrome_ota()
check_palindrome("قاپاق", true, "ota")
end
function tests:test_palindrome_ja()
check_palindrome("いかにもにがい", true, "ja")
check_palindrome("akka", false, "ja", "Latn")
check_palindrome("akka", false, "ja")
end
function tests:test_palindrome_ar()
check_palindrome("واحد", false, "ar")
check_palindrome("ترجم", false, "ar")
check_palindrome("ر", false, "ar")
check_palindrome("نون", true, "ar")
check_palindrome("باب", true, "ar")
check_palindrome("تحت", true, "ar")
check_palindrome("يرى", true, "ar")
check_palindrome("آباء", true, "ar")
check_palindrome("أشاء", true, "ar")
check_palindrome("يجئ", true, "ar")
check_palindrome("أنا", true, "ar")
check_palindrome("همة", true, "ar")
check_palindrome("وضؤ", true, "ar")
end
function tests:test_palindrome_bho()
check_palindrome("नून", false, "bho")
check_palindrome("ननून", true, "bho")
check_palindrome("नूनू", true, "bho")
check_palindrome("प्रतंप्र", true, "bho")
end
return tests