মডিউল:fa-IPA/sandbox/testcases
লুয়া ত্রুটি package.lua এর 80 নং লাইনে: module 'Module:fa-IPA/sandbox' not found।
local tests = require("Module:UnitTests")
local m_IPA = require("Module:fa-IPA/sandbox")
local sc_fa = require("Module:scripts").getByCode("fa-Arab")
local sc_tg = require("Module:scripts").getByCode("Cyrl")
local lang_fa = require("Module:languages").getByCode("fa")
local lang_tg = require("Module:languages").getByCode("tg")
function link(term)
return require("Module:links").full_link {
term = term,
lang = lang_fa,
sc = sc_fa
}
end
function link_tg(term)
return require("Module:links").full_link {
term = term,
lang = lang_tg,
sc = sc_tg
}
end
local function tag_IPA(IPA)
return '<span class="IPA">' .. IPA .. '</span>'
end
function tests:check_output_fa(term, romanisation, expected)
self:equals(
link(term),
tag_IPA(m_IPA.fa_IPA(romanisation, false)),
tag_IPA(expected)
)
end
function tests:check_output_fa_phonetic(term, romanisation, expected)
self:equals(
link(term),
tag_IPA(m_IPA.fa_IPA(romanisation, true)),
tag_IPA(expected)
)
end
function tests:check_output_fa_cls(term, romanisation, expected)
self:equals(
link(term),
tag_IPA(m_IPA.fa_cls_IPA(romanisation)),
tag_IPA(expected)
)
end
function tests:check_output_tg(term, romanisation, expected)
self:equals(
link_tg(term),
tag_IPA(m_IPA.tg_IPA(romanisation)),
tag_IPA(expected)
)
end
function tests:check_output_prs(term, romanisation, expected)
self:equals(
link(term),
tag_IPA(m_IPA.prs_IPA(romanisation)),
tag_IPA(expected)
)
end
function tests:test_classical_persian()
examples = {
{ "خوش", "xwaš", "xʷaʃ"},
{ "خواب", "xwāb", "xʷɑːb"},
{ "ابرنواختر", "abar naw ax`tar", "abaɾ naw axˈtaɾ"},
{ "ابراهیم", "ibrā`hīm", "ibɾɑːˈhiːm"},
{ "امام", "i`mām", "iˈmɑːm"},
{ "پیشوا", "pēš`vā", "peːʃˈwɑː"},
{ "نو", "naw", "naw"},
{ "مستعمره", "musta'ma`ra", "mustaʔmaˈɾa"},
{ "آزاد", "ā`zād", "ɑːˈzɑːð"},
{ "دادن", "dā`dan", "dɑːˈðan"},
{ "قول", "qawl", "qawl"},
{ "دولت", "dawlat", "dawlat"},
{ "آخور", "āxwar", "ɑːxʷaɾ"},
{ "لغو", "lağw", "laɣw"},
{ "معتدل", "mu'tadil", "muʔtaðil"},
{ "خوی", "xway", "xʷaj"},
{ "خوید", "xwēd", "xʷeːð"},
}
--[[ Copy the following to add more examples:
{ "", "", ""},
]]
tests:iterate(examples, "check_output_fa_cls")
end
function tests:test_dari_persian()
examples = {
{ "خوش", "xwaš", "xʊʃ"},
{ "خواب", "xwāb", "xɒːb"},
{ "ابرنواختر", "abar-naw-ax`tar", "abaɾ naw axˈtaɾ"},
{ "ابراهیم", "ibrā`hīm", "ɪbɾɒːˈhiːm"},
{ "امام", "i`mām", "ɪˈmɒːm"},
{ "پیشوا", "pēš`vā", "peːʃˈwɒː"},
{ "نو", "naw", "naw"},
{ "مستعمره", "musta'ma`ra", "mʊstaʔmaˈɾa"},
{ "آزاد", "ā`zād", "ɒːˈzɒːd"},
{ "قول", "qawl", "qawl"},
{ "دولت", "dawlat", "dawlat"},
{ "آخور", "āxwar", "ɒːxʊɾ"},
{ "لغو", "lağw", "laɣw"},
{ "گور", "gawr", "ɡawɾ"},
{ "معتدل", "mu'tadil", "mʊʔtadɪl"},
{ "خوی", "xway", "xʊj"},
{ "خوید", "xwēd", "xeːd"},
}
--[[ Copy the following to add more examples:
{ "", "", ""},
]]
tests:iterate(examples, "check_output_prs")
end
function tests:test_iranian_persian()
examples = {
{ "خوش", "xwaš", "xoʃ"},
{ "خواب", "xwāb", "xɒːb"},
{ "ابرنواختر", "abar naw ax`tar", "æbæɾ now æxˈtæɾ"},
{ "ابراهیم", "ibrā`hīm", "ebɾɒːˈhiːm"},
{ "امام", "i`mām", "eˈmɒːm"},
{ "پیشوا", "pēš`vā", "piːʃˈvɒː"},
{ "نو", "naw", "now"},
{ "مستعمره", "musta'ma`ra", "mostæʔmæˈɾe"},
{ "آزاد", "ā`zād", "ɒːˈzɒːd"},
{ "قول", "qawl", "ɢowl"},
{ "دولت", "dawlat", "dowlæt"},
{ "آخور", "āxwar", "ɒːxoɾ"},
{ "لغو", "lağw", "læɢv"},
{ "گور", "gawr", "ɡowɾ"},
{ "معتدل", "mu'tadil", "moʔtædel"},
{ "خوی", "xway", "xoj"},
{ "خوید", "xwēd", "xiːd"},
}
--[[ Copy the following to add more examples:
{ "", "", ""},
]]
tests:iterate(examples, "check_output_fa")
end
function tests:test_phonetic_iranian_persian()
examples = {
{ "توپ", "tōp", "t̪ʰuːpʰ"},
{ "دبستان", "dabistān", "d̪æbest̪ʰɒːn"},
{ "کار", "kār", "kʰɒːɹ"},
{ "کمی", "`kamē", "ˈcʰæmiː"},
{ "گیج", "gēj", "ɟiːd̥͡ʒ̥"},
{ "گل", "gul", "ɡ̥ol̥"},
{ "چند", "čand", "t͡ʃʰæn̪d̪̥"},
{ "کتابچه", "kitābča", "cʰetʰɒːb̥t͡ʃʰe"},
{ "سگ", "sag", "sæɟ̥"},
{ "عشق", "išq", "ʔeʃq"},
{ "قلب", "qalb", "qælb̥"},
{ "غزال", "ğazāl", "qæzɒːl̥"},
{ "گاو", "gāw", "ɡ̥ɒːv"},
{ "موسیقی", "mūsīqī", "muːsiːʁiː"},
{ "نقطه", "nuqta", "noxt̪ʰe"},
{ "آهنگ", "āhang", "ʔɒːɦæɲɟ̥"},
{ "سمفونی", "samfunī", "sæɱfoniː"},
{ "زنبور", "zanbūr", "zæmbuːɹ"},
{ "انواع", "anwā'", "ʔæɱvɒːʔ"},
{ "انگور", "angūr", "ʔæŋɡuːɹ"},
{ "عنقا", "anqā", "ʔæɴɢɒː"},
{ "اصل", "asl", "ʔæsɬ"},
}
--[[ Copy the following to add more examples:
{ "", "", ""},
]]
tests:iterate(examples, "check_output_fa_phonetic")
end
function tests:test_tajik()
examples = {
{ "хуш", "xwaš", "xuʃ"},
{ "хоб", "xwāb", "xɔb"},
{ "абарнавахтар", "abarnawax`tar", "abaɾnavaxˈtaɾ"},
{ "Иброҳим", "ibrā`hīm", "ibɾɔˈhim"},
{ "имом", "i`mām", "iˈmɔm"},
{ "пешво", "pēš`vā", "peʃˈvɔ"},
{ "нав", "naw", "nav"},
{ "мустаъмара", "musta'ma`ra", "mustaʔmaˈɾa"},
{ "фoтеҳ", "fā`tih", "fɔˈteh"},
{ "диҳад", "di`had", "diˈhad"},
{ "фасеҳ", "fa`sīh", "faˈseh"},
{ "васеъ", "va`sī\'", "vaˈseʔ"},
{ "охур", "āxwar", "ɔxuɾ"},
{ "лағв", "lağw", "laɣv"},
{ "биҳишт", "bihišt", "bihiʃt"},
{ "мӯътадил", "mu'tadil", "mɵʔtadil"},
{ "хуй", "xway", "xuj"},
{ "хед", "xwēd", "xed"},
}
--[[ Copy the following to add more examples:
{ "", "", ""},
]]
tests:iterate(examples, "check_output_tg")
end
return tests