Module:ar-IPA/testcases
(Redirected from Module:ar-pronunciation/testcases)
- This module testcase page lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
local tests = require("Module:UnitTests")
local m_IPA = require("Module:ar-pronunciation")
local function tag_IPA(IPA)
return '<span class="IPA">' .. IPA .. '</span>'
end
local function not_Latin(text)
return not string.find(text, "[a-z]")
end
local options = { display = tag_IPA, show_difference = true }
function tests:check_output(term, expected, comment)
options.comment = comment
local is_Arabic = not_Latin(term)
self:equals(
is_Arabic and m_IPA.link(term) or term,
m_IPA.toIPA(is_Arabic and { Arabic = term } or { tr = term}, true),
expected,
options
)
end
function tests:test_Arabic()
local examples = {
{ "طَبَّ", "tˤab.ba" },
{ "رُوسِيَا", "ruː.si.jaː" },
{ "أَنْتَ", "ʔan.ta" },
{ "ذٰلِكَ", "ðaː.li.ka" },
{ "صَغِير", "sˤa.ɣiːr" },
{ "إِصْبَع", "ʔisˤ.baʕ" },
{ "عَلَى", "ʕa.laː" },
{ "جَزِيرَة", "d͡ʒa.ziː.ra" },
{ "أَرْبَعَة", "ʔar.ba.ʕa" },
{ "حُبّ", "ħubb" },
{ "عَرَبِيّ", "ʕa.ra.bijj" },
{ "خَاصّ", "xaːsˤsˤ" },
{ "خَاصَّة", "xaːsˤ.sˤa" },
{ "يَوْمُ ٱلِٱثْنَيْنِ", "jaw.mu liθ.naj.ni", "" },
{ "تُدُووِلَ", "tu.duː.wi.la" },
"Allah",
{ "اللّٰه", "aɫ.ɫaːh", "special case" },
{ "عَبْدُ اللّٰه", "ʕab.du‿ɫ.ɫaːh", "special case" },
{ "لِلّٰه", "lil.laːh", "special case of the special case" },
"Phrases",
{
"الْمَمْلَكَة الْعَرَبِيَّة السُّعُودِيَّة",
"al.mam.la.ka‿l.ʕa.ra.bij.ja‿s.su.ʕuː.dij.ja"
},
{"مَعَ اَلسَّلَامَة", "ma.ʕa‿s.sa.laː.ma"},
{
"لٰكِنَّ الرَّئِيسَ كَانَ أَذْكَى مِمَّا تَوَقَّعَ النَّاسُ",
"laː.kin.na‿r.ra.ʔiː.sa kaː.na ʔað.kaː mim.maː ta.waq.qa.ʕa‿n.naː.su"
},
{ "بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيمِ", "bis.mi‿l.laː.hi‿r.raħ.maː.ni‿r.ra.ħiː.mi" },
{ "إِنْ شَاءَ ٱللَٰهُ", "ʔin ʃaː.ʔa‿ɫ.ɫaː.hu" },
{ "بِٱلْهَنَاءِ وَٱلشِّفَاء", "bil.ha.naː.ʔi waʃ.ʃi.faːʔ" },
"vowel shortening",
{ "فِي الْبَيْت", "fi‿l.bajt" },
{ "مَا ٱسْمُك", "ma‿s.muk" },
{ "ذُو الْقَرْنَيْن", "ðu‿l.qar.najn" },
{ "إِلَّا الله", "ʔil.la‿ɫ.ɫaːh" },
{ "فِي ٱتِّحَادِنَا", "fi‿t.ti.ħaː.di.naː" },
{ "فِي الله", "fi‿l.laːh" },
--[[ Copy the following to add more examples:
{ "", "" },
]]
}
self:iterate(examples, "check_output")
end
function tests:test1_transliteration()
local examples = {
{ "tilivizyōn", "ti.li.viz.joːn" },
{ "ʾinglīziyy", "ʔinɡliː.zijj" },
--[[ Copy the following to add more examples:
{ "", "" },
]]
}
self:iterate(examples, "check_output")
end
return tests