11 of 22 tests failed. (refresh)

TermRespellingExpectedActualComments
test_haz_persian:
Failedخوابxwābχɔːb̥xɔːb̥
Failedابرنواخترabarnaw.ax`tarʔä.bäɾ.näw.äχ.t̪ʰǽɾʔä.bäɾ.näw.ʔäx.t̪ʰǽɾ
Failedابراهیمibrā`hīmʔib.ɾɔː.jíːmʔib.ɾɔː.jíːm
Passedامامi`māmʔi.mɔ́ːmʔi.mɔ́ːm
Passedپیشواpēš`vāpʰeːʃ.wɔ́ːpʰeːʃ.wɔ́ː
Failedمستعمرهmusta'ma`ramus.t̪ʰɔː.mä.ɾǽmus.t̪ʰɔː.mä.ɾǽ
Passedآزادā`zādʔɔː.zɔ́ːd̪̥ʔɔː.zɔ́ːd̪̥
Passedمعتدلmu'tadilmʊː.t̪ʰä.d̪il̥mʊː.t̪ʰä.d̪il̥
Failedخویدxwēdχeːd̪̥xeːd̪̥
Passedمحمدmuhammadmu.wäm.mäd̪̥mu.wäm.mäd̪̥
Passedلیکنlēkinli.kʰinli.kʰin
Passedدندانdandānd̪än̪.d̪ɔːnd̪än̪.d̪ɔːn
Passedبندbandbän̪d̪̥bän̪d̪̥
PassedکٹهkaTakʰä.ʈäkʰä.ʈä
TermRespellingExpectedActualComments
test_kbl_persian:
Failedخوشxwašχʊʃxʊʃ
Failedخوابxwābχʌːbxɑːb
Failedابرنواخترabarnaw.ax`tarʔä.bäɾ.näw.äχ.t̪ʰǽɾʔä.bäɾ.näw.ʔäx.t̪ʰǽɾ
Failedابراهیمibrā`hīmʔɪb.ɾʌː.jíːmʔɪb.ɾɑː.jíːm
Failedپیشواpēš`vāpʰeːʃ.wʌ́ːpʰeːʃ.wɑ́ː
Failedمستعمرهmusta'ma`ramʊs.t̪ʰʌː.mä.ɾǽmʊs.t̪ʰɑː.mä.ɾǽ
Passedمعتدلmu'tadilmoː.t̪ʰä.d̪ɪlmoː.t̪ʰä.d̪ɪl
Passedمحمدmuhammadmʊ.wäm.mäd̪mʊ.wäm.mäd̪

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), romanisation},
		tag_IPA(m_IPA.fa_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:check_output_prs_kbl(term, romanisation, expected)
	self:equals(
		{link(term), romanisation},
		tag_IPA(m_IPA.prs_kbl_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:check_output_prs_haz(term, romanisation, expected)
	self:equals(
		{link(term), romanisation},
		tag_IPA(m_IPA.prs_haz_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:check_output_fa_cls(term, romanisation, expected)
	self:equals(
		{link(term), romanisation},
		tag_IPA(m_IPA.fa_cls_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:check_output_tg(term, romanisation, expected)
	self:equals(
		{link(term), romanisation},
		tag_IPA(m_IPA.tg_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:check_output_prs(term, romanisation, expected)
	self:equals(
		{link(term), romanisation},
		tag_IPA(m_IPA.prs_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:test_kbl_persian()
	examples = {
		{ "خوش", "xwaš", "χʊʃ"},
		{ "خواب", "xwāb", "χʌːb"},
		{ "ابرنواختر", "abarnaw.ax`tar", "ʔä.bäɾ.näw.äχ.t̪ʰǽɾ"},
		{ "ابراهیم", "ibrā`hīm", "ʔɪb.ɾʌː.jíːm"},
		{ "پیشوا", "pēš`vā", "pʰeːʃ.wʌ́ː"},
		{ "مستعمره", "musta'ma`ra", "mʊs.t̪ʰʌː.mä.ɾǽ"},
		{ "معتدل", "mu'tadil", "moː.t̪ʰä.d̪ɪl"},
		{ "محمد", "muhammad", "mʊ.wäm.mäd̪"},
	}
--[[	Copy the following to add more examples:
		{ "", "", ""},
]]
	
	tests:iterate(examples, "check_output_prs_kbl")
end

function tests:test_haz_persian()
	examples = {
		{ "خواب", "xwāb", "χɔːb̥"},
		{ "ابرنواختر", "abarnaw.ax`tar", "ʔä.bäɾ.näw.äχ.t̪ʰǽɾ"},
		{ "ابراهیم", "ibrā`hīm", "ʔib.ɾɔː.jíːm"},
		{ "امام", "i`mām", "ʔi.mɔ́ːm"},
		{ "پیشوا", "pēš`vā", "pʰeːʃ.wɔ́ː"},
		{ "مستعمره", "musta'ma`ra", "mus.t̪ʰɔː.mä.ɾǽ"},
		{ "آزاد", "ā`zād", "ʔɔː.zɔ́ːd̪̥"},
		{ "معتدل", "mu'tadil", "mʊː.t̪ʰä.d̪il̥"},
		{ "خوید", "xwēd", "χeːd̪̥"},
		{ "محمد", "muhammad", "mu.wäm.mäd̪̥"},
		{ "لیکن", "lēkin", "li.kʰin"},
		{ "دندان", "dandān", "d̪än̪.d̪ɔːn"},
		{ "بند", "band", "bän̪d̪̥"},
		{ "کٹه", "kaTa", "kʰä.ʈä"},
	}
--[[	Copy the following to add more examples:
		{ "", "", ""},
]]
	
	tests:iterate(examples, "check_output_prs_haz")
end
return tests