Modul:palindromes/testcases

A Wikiszótárból, a nyitott szótárból

5 teszt sikertelen. (frissítés)

Szöveg Várt Tényleges
test_palindrome_ar:
Sikeres واحد false false
Sikeres ترجم false false
Sikeres ر false false
Sikeres نون true true
Sikeres باب true true
Sikeres تحت true true
Sikeres يرى true true
Sikeres آباء true true
Sikeres أشاء true true
Sikeres يجئ true true
Sikeres أنا true true
Sikeres همة true true
Sikeres وضؤ true true
Szöveg Várt Tényleges
test_palindrome_bho:
Sikertelen नून false true
Sikertelen ननून true false
Sikertelen नूनू true false
Sikertelen प्रतंप्र true false
Szöveg Várt Tényleges
test_palindrome_cs:
Sikeres tázat true true
Szöveg Várt Tényleges
test_palindrome_el:
Sikeres σορός true true
Sikeres αλλά true true
Szöveg Várt Tényleges
test_palindrome_en:
Sikeres a false false
Sikeres ab false false
Sikeres aa false false
Sikeres aba true true
Sikeres a.a false false
Sikeres abc false false
Sikeres AAA false false
Sikeres palindromemordnilap true true
Sikeres non- false false
Sikeres -n- false false
Sikeres I, man, am regal - a German am I true true
Sikeres Never odd or even true true
Sikeres If I had a hi-fi true true
Sikeres Madam, I'm Adam true true
Sikeres Too hot to hoot true true
Sikeres No lemons, no melon true true
Sikeres Too bad I hid a boot true true
Sikeres Lisa Bonet ate no basil true true
Sikeres Warsaw was raw true true
Sikeres Was it a car or a cat I saw? true true
Sikeres Rise to vote, sir true true
Sikeres Do geese see god? true true
Sikeres "Do nine men interpret?" "Nine men," I nod true true
Sikeres Rats live on no evil star true true
Sikeres Won't lovers revolt now? true true
Sikeres Race fast, safe car true true
Sikeres Pa's a sap true true
Sikeres Ma is as selfless as I am true true
Sikeres May a moody baby doom a yam? true true
Sikeres Ah, Satan sees Natasha true true
Sikeres No devil lived on true true
Sikeres Lonely Tylenol true true
Sikeres Not a banana baton true true
Sikeres No "x" in "Nixon" true true
Sikeres O, stone, be not so true true
Sikeres O Geronimo, no minor ego true true
Sikeres "Naomi," I moan true true
Sikeres "A Toyota's a Toyota" true true
Sikeres A dog, a panic in a pagoda true true
Sikeres Oh no! Don Ho! true true
Sikeres Nurse, I spy gypsies - run! true true
Sikeres Senile felines true true
Sikeres Now I see bees I won true true
Sikeres UFO tofu true true
Sikeres We panic in a pew true true
Sikeres Oozy rat in a sanitary zoo true true
Sikeres God! A red nugget! A fat egg under a dog! true true
Sikeres Go hang a salami, I'm a lasagna hog true true
Sikeres à la true true
Szöveg Várt Tényleges
test_palindrome_grc:
Sikeres ΝΙΨΟΝ ΑΝΟΜΗΜΑΤΑ ΜΗ ΜΟΝΑΝ ΟΨΙΝ true true
Sikeres Νίψον ἀνομήματα, μὴ μόναν ὄψιν true true
Szöveg Várt Tényleges
test_palindrome_he:
Sikeres ףרשנו רעבתן שבדבש ןתבער ונשרף true true
Sikeres פרשנו רעבתן שבדבש נתבער ונשרף true true
Sikeres ﭏ׳װױײ ט ייי־ווול״א׳ true true
Szöveg Várt Tényleges
test_palindrome_hu:
Sikeres szusz true true
Sikeres kérek true true
Sikeres kerék true true
Sikeres csúcs true true
Szöveg Várt Tényleges
test_palindrome_ja:
Sikeres いかにもにがい true true
Sikeres akka false false
Sikertelen akka false true
Szöveg Várt Tényleges
test_palindrome_ota:
Sikeres قاپاق 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