Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

All tests passed. (refresh)

Text Expected Actual
test_01_has_language:
Passed mut.hasLanguage("sv") true true
Passed mut.hasLanguage("xx") false false
Passed mut.hasLanguage("xyz") false false
Text Expected Actual
test_02_get_code_reverse_query:
Passed mut.getCode("sv") xx xx
Passed mut.getCode("sV") xx xx
Passed mut.getCode("svenska") sv sv
Passed mut.getCode("Svenska") sv sv
Passed mut.getCode("Älvdalska") ovd ovd
Passed mut.getCode("ESPERANTO") eo eo
Passed mut.getCode("norska") xx xx
Passed mut.getCode("norska","alsoetym") h-nor h-nor
Passed mut.getCode("samiska","onlyetym") h-smi h-smi
Passed mut.getCode("engelska","onlyetym") xx xx
Text Expected Actual
test_03_get_language:
Passed mut.getLanguage("sv") svenska svenska
Passed mut.getLanguage("sV") okänt språk okänt språk
Passed mut.getLanguage("svenska") okänt språk okänt språk
Passed mut.getLanguage("Svenska") okänt språk okänt språk
Passed mut.getLanguage("ovd") älvdalska älvdalska
Passed mut.getLanguageUCFirst("ovd") Älvdalska Älvdalska
Passed mut.getLanguage("nn") nynorska nynorska
Passed mut.getLanguage("h-nor") okänt språk okänt språk
Passed mut.getLanguage("h-nor","alsoetym") norska norska
Text Expected Actual
test_04_get_script:
Text Expected Actual
test_05_get_sort_rules:
Passed mut.getSortRules("sv") {"å>z~", "ä>z¡", "ö>z°", "ü>y", "æ>z¡", "ø>z°"} {"å>z~", "ä>z¡", "ö>z°", "ü>y", "æ>z¡", "ø>z°"}
Passed mut.getSortRules("xx") {} {}
Passed mut.getSortRules("notfound") {} {}
Text Expected Actual
test_06_is_obviously_invalid:
Passed mut.isObviouslyInvalid("sv") false false
Passed mut.isObviouslyInvalid("Sv") true true
Passed mut.isObviouslyInvalid("jav") false false
Passed mut.isObviouslyInvalid("ido") true true
Passed mut.isObviouslyInvalid("xx") true true
Passed mut.isObviouslyInvalid("--") false false
Passed mut.isObviouslyInvalid("a") true true
Passed mut.isObviouslyInvalid("zh-min-nan") false false
Passed mut.isObviouslyInvalid("zh-min+nan") true true
Passed mut.isObviouslyInvalid("zh-min-n-n") true true
Passed mut.isObviouslyInvalid("zuh-min-nan") true true
Passed mut.isObviouslyInvalid("h-smi") false false
Passed mut.isObviouslyInvalid("lak") false false
Passed mut.isObviouslyInvalid("spanska") true true
Passed mut.isObviouslyInvalid("indonesiska") true true
Text Expected Actual
test_07_get_entry_name:
Passed mut.getEntryName("ab", "а-бҳәа́") а-бҳәа а-бҳәа
Passed mut.getEntryName("la", "abdērītānus") abderitanus abderitanus
Passed mut.getEntryName("lt", "abãtė") abatė abatė
Passed mut.getEntryName("lt", "abažū̃ras") abažūras abažūras
Passed mut.getEntryName("se", "boaš'šu") boaššu boaššu
Passed mut.getEntryName("ru", "автомотри́са") автомотриса автомотриса
Passed mut.getEntryName("sr", "ја̏се̄н") јасен јасен
Passed mut.getEntryName("zu", "dlâla") dlala dlala
Passed mut.getEntryName("zu", "ī́sele") isele isele
Text Expected Actual
test_08_get_entry_name_rtl:
Passed mut.getEntryName("ur", "آدرنیہ,") آدرنیہ آدرنیہ
Passed mut.getEntryName("ur", "آزمودہ,") آزمودہ آزمودہ
Passed mut.getEntryName("ur", "آشچریہ,") آشچریہ آشچریہ
Passed mut.getEntryName("he", "אֵין") אין אין
Passed mut.getEntryName("he", "אֵינְסוֹף") אינסוף אינסוף
Passed mut.getEntryName("he", "יֵשׁ") יש יש
Passed mut.getEntryName("he", "עֶצֶם") עצם עצם
Passed mut.getEntryName("he", "אִם וְרַק אִם") אם ורק אם אם ורק אם
Passed mut.getEntryName("ar", "أَرِسْطُو") أرسطو أرسطو
Passed mut.getEntryName("ar", "إِبِيقُورِيّ") إبيقوري إبيقوري
Passed mut.getEntryName("ar", "اِخْتِيَار") اختيار اختيار
Passed mut.getEntryName("ar", "تَعَدُّدُ الْقُدَماءِ") تعدد القدماء تعدد القدماء
Passed mut.getEntryName("ar", "تَنْوِير") تنوير تنوير
local t = require('Modul:UnitTests')
local mut = require('Modul:lang')

function t:test_01_has_language()
    self:equals('mut.hasLanguage("sv")', mut.hasLanguage("sv"), true)
    self:equals('mut.hasLanguage("xx")', mut.hasLanguage("xx"), false)
    self:equals('mut.hasLanguage("xyz")', mut.hasLanguage("xyz"), false)
end

function t:test_02_get_code_reverse_query()
    self:equals('mut.getCode("sv")', mut.getCode("sv"), "xx") -- språkkod tillåts ej här
    self:equals('mut.getCode("sV")', mut.getCode("sV"), "xx") -- språkkod tillåts ej här
    self:equals('mut.getCode("svenska")', mut.getCode("svenska"), "sv")
    self:equals('mut.getCode("Svenska")', mut.getCode("Svenska"), "sv")
    self:equals('mut.getCode("Älvdalska")', mut.getCode("Älvdalska"), "ovd")
    self:equals('mut.getCode("ESPERANTO")', mut.getCode("ESPERANTO"), "eo")
    self:equals('mut.getCode("norska")', mut.getCode("norska"), "xx") -- koden "h-nor" är reserverad för etymologi
    self:equals('mut.getCode("norska","alsoetym")', mut.getCode("norska","alsoetym"), "h-nor")
    self:equals('mut.getCode("samiska","onlyetym")', mut.getCode("samiska","onlyetym"), "h-smi")
    self:equals('mut.getCode("engelska","onlyetym")', mut.getCode("engelska","onlyetym"), "xx")
end

function t:test_03_get_language()
    self:equals('mut.getLanguage("sv")', mut.getLanguage("sv"), "svenska")
    self:equals('mut.getLanguage("sV")', mut.getLanguage("sV"), "okänt språk")
    self:equals('mut.getLanguage("svenska")', mut.getLanguage("svenska"), "okänt språk")
    self:equals('mut.getLanguage("Svenska")', mut.getLanguage("Svenska"), "okänt språk")
    self:equals('mut.getLanguage("ovd")', mut.getLanguage("ovd"), "älvdalska")
    self:equals('mut.getLanguageUCFirst("ovd")', mut.getLanguageUCFirst("ovd"), "Älvdalska")
    self:equals('mut.getLanguage("nn")', mut.getLanguage("nn"), "nynorska")
    self:equals('mut.getLanguage("h-nor")', mut.getLanguage("h-nor"), "okänt språk") -- koden "h-nor" är reserverad för etymologi
    self:equals('mut.getLanguage("h-nor","alsoetym")', mut.getLanguage("h-nor","alsoetym"), "norska")
end

function t:test_04_get_script()
    --self:equals('mut.getScriptCode("ar")', mut.getScriptCode("ar"), "arab")  --inaktiverar tills denna funktion är redo att tas i bruk
    --self:equals('mut.getScriptCode("xx")', mut.getScriptCode("xx"), "")
    --self:equals('mut.getScriptCode("notfound")', mut.getScriptCode("notfound"), "")
end

function t:test_05_get_sort_rules()
	self:equals_deep('mut.getSortRules("sv")', mut.getSortRules("sv"), {"å>z~", "ä>z¡", "ö>z°", "ü>y", "æ>z¡", "ø>z°"})
	self:equals_deep('mut.getSortRules("xx")', mut.getSortRules("xx"), {})
	self:equals_deep('mut.getSortRules("notfound")', mut.getSortRules("notfound"), {})
end

function t:test_06_is_obviously_invalid()
    self:equals('mut.isObviouslyInvalid("sv")', mut.isObviouslyInvalid("sv"), false)
    self:equals('mut.isObviouslyInvalid("Sv")', mut.isObviouslyInvalid("Sv"), true)
    self:equals('mut.isObviouslyInvalid("jav")', mut.isObviouslyInvalid("jav"), false)
    self:equals('mut.isObviouslyInvalid("ido")', mut.isObviouslyInvalid("ido"), true)
    self:equals('mut.isObviouslyInvalid("xx")', mut.isObviouslyInvalid("xx"), true)
    self:equals('mut.isObviouslyInvalid("--")', mut.isObviouslyInvalid("--"), false)
    self:equals('mut.isObviouslyInvalid("a")', mut.isObviouslyInvalid("a"), true)
    self:equals('mut.isObviouslyInvalid("zh-min-nan")', mut.isObviouslyInvalid("zh-min-nan"), false)
    self:equals('mut.isObviouslyInvalid("zh-min+nan")', mut.isObviouslyInvalid("zh-min+nan"), true)
    self:equals('mut.isObviouslyInvalid("zh-min-n-n")', mut.isObviouslyInvalid("zh-min-n-n"), true)
    self:equals('mut.isObviouslyInvalid("zuh-min-nan")', mut.isObviouslyInvalid("zuh-min-nan"), true)
    self:equals('mut.isObviouslyInvalid("h-smi")', mut.isObviouslyInvalid("h-smi"), false)
    self:equals('mut.isObviouslyInvalid("lak")', mut.isObviouslyInvalid("lak"), false)
    self:equals('mut.isObviouslyInvalid("spanska")', mut.isObviouslyInvalid("spanska"), true)
    self:equals('mut.isObviouslyInvalid("indonesiska")', mut.isObviouslyInvalid("indonesiska"), true)
end

function t:test_07_get_entry_name()
	self:equals('mut.getEntryName("ab", "а-бҳәа́")', mut.getEntryName("ab", "а-бҳәа́"), "а-бҳәа")
	self:equals('mut.getEntryName("la", "abdērītānus")', mut.getEntryName("la", "abdērītānus"), "abderitanus")
	self:equals('mut.getEntryName("lt", "abãtė")', mut.getEntryName("lt", "abãtė"), "abatė")
	self:equals('mut.getEntryName("lt", "abažū̃ras")', mut.getEntryName("lt", "abažū̃ras"), "abažūras")
	self:equals('mut.getEntryName("se", "boaš\'šu")', mut.getEntryName("se", "boaš'šu"), "boaššu")
	self:equals('mut.getEntryName("ru", "автомотри́са")', mut.getEntryName("ru", "автомотри́са"), "автомотриса")
	self:equals('mut.getEntryName("sr", "ја̏се̄н")', mut.getEntryName("sr", "ја̏се̄н"), "јасен")
	self:equals('mut.getEntryName("zu", "dlâla")', mut.getEntryName("zu", "dlâla"), "dlala")
	self:equals('mut.getEntryName("zu", "ī́sele")', mut.getEntryName("zu", "ī́sele"), "isele")
end

function t:test_08_get_entry_name_rtl()
	self:equals('mut.getEntryName("ur", "آدرنیہ,")', mut.getEntryName("ur", "آدرنیہ"), "آدرنیہ")
	self:equals('mut.getEntryName("ur", "آزمودہ,")', mut.getEntryName("ur", "آزمودہ"), "آزمودہ")
	self:equals('mut.getEntryName("ur", "آشچریہ,")', mut.getEntryName("ur", "آشچریہ"), "آشچریہ")
	self:equals('mut.getEntryName("he", "אֵין")', mut.getEntryName("he", "אֵין"), "אין")
	self:equals('mut.getEntryName("he", "אֵינְסוֹף")', mut.getEntryName("he", "אֵינְסוֹף"), "אינסוף")
	self:equals('mut.getEntryName("he", "יֵשׁ")', mut.getEntryName("he", "יֵשׁ"), "יש")
	self:equals('mut.getEntryName("he", "עֶצֶם")', mut.getEntryName("he", "עֶצֶם"), "עצם")
	self:equals('mut.getEntryName("he", "אִם וְרַק אִם")', mut.getEntryName("he", "אִם וְרַק אִם"), "אם ורק אם")
	self:equals('mut.getEntryName("ar", "أَرِسْطُو")', mut.getEntryName("ar", "أَرِسْطُو"), "أرسطو")
	self:equals('mut.getEntryName("ar", "إِبِيقُورِيّ")', mut.getEntryName("ar", "إِبِيقُورِيّ"), "إبيقوري")
	self:equals('mut.getEntryName("ar", "اِخْتِيَار")', mut.getEntryName("ar", "اِخْتِيَار"), "اختيار")
	self:equals('mut.getEntryName("ar", "تَعَدُّدُ الْقُدَماءِ")', mut.getEntryName("ar", "تَعَدُّدُ الْقُدَماءِ"), "تعدد القدماء")
	self:equals('mut.getEntryName("ar", "تَنْوِير")', mut.getEntryName("ar", "تَنْوِير"), "تنوير")
end

return t