မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:hi-IPA/testcases

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:hi-IPA/testcases/doc

local tests = require("Module:UnitTests")
local m_IPA = require("Module:hi-IPA")

local function tag_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

function tests:check_output(term, expected, comment1, narrow, comment2)
	local persianized = m_IPA.toIPA(term, "persianized")
	self:equals(
		m_IPA.link(term),
		tag_IPA(persianized),
		tag_IPA(expected),
		{ comment = comment1 }
	)
	
	if narrow then
		self:equals(
			m_IPA.link(term),
			tag_IPA(m_IPA.narrow_IPA(persianized)),
			tag_IPA(narrow),
			{ comment = comment2 }
		)
	end
end

function tests:test_all()
	examples = {
		{ "अशिष्ट॰ता", "ə.ʃɪʂʈ.t̪ɑː", "syllabification"},
		{ "अशिष्ट-ता", "ə.ʃɪʂʈ.t̪ɑː", "syllabification"},
		{ "अल्प्संख्यक", "əlp.səŋ.kʰjək", "syllabification"},
		{ "अंडकोष", "əɳɖ.koːʂ", "syllabification"},
		{ "अंग्रेज़", "əŋ.ɡɾeːz", "syllabification"},
		{ "अंटर्क्टिका", "əɳ.ʈəɾk.ʈɪ.kɑː", "syllabification"},
		{ "मैं", "mɛ̃ː" },
        { "देश", "d̪eːʃ" },
        { "मेरा", "meː.ɾɑː"},
        { "खिलौना", "kʰɪ.lɔː.nɑː" },
        { "नौटंकी", "nɔː.ʈəŋ.kiː" },
        { "हौं", "ɦɔ̃ː" },
        { "मुँह", "mũːʱ" },
        { "माह", "mɑːʱ" },
        { "बहना", "bəʱ.nɑː" },
        { "विवाह", "ʋɪ.ʋɑːʱ" },
        { "ग़म", "ɣəm" },
        { "ख़रगोश", "xəɾ.ɡoːʃ" },
        { "इकट्ठा", "ɪ.kəʈ.ʈʰɑː" },
        { "संस्थान", "sən.st̪ʰɑːn" },
        { "मधु", "mə.d̪ʱuː", "final u is lengthened, aspiration should not be split in syllabification" },
        {"मियाँ", "miː.jɑ̃ː", "i + y lengthens i"},
        {"मुहाफ़ज़ाह", "mʊ.ɦɑːf.zɑːʱ"},
        {"स्त्रीत्व", "st̪ɾiːt̪.ʋᵊ"},
        {"शास्त्र", "ʃɑːs.t̪ɾᵊ"},
        {"समाचार", "sə.mɑː.t͡ʃɑːɾ"},
        {"श्रावण", "ʃɾɑː.ʋəɳ"},
        {"हमें", "ɦə.mẽː"},
		{ "में", "mẽː" },
        {"भैया", "bʱə.iː.jɑː"},
        {"सुलह", "sʊ.ləʱ"},
        {"दृष्टि", "d̪ɾɪʂ.ʈiː"},
        {"सोई", "soː.iː"},
        {"खाइए", "kʰɑː.ɪ.eː"},
        {"शक्ति", "ʃək.t̪iː"},
        {"उस्ताद", "ʊs.t̪ɑːd̪"},
        {"पंकज", "pəŋ.kəd͡ʒ"},
        {"माला", "mɑː.lɑː"},
        {"दीवार", "d̪iː.ʋɑːɾ"},
        {"सुरुची", "sʊ.ɾʊ.t͡ʃiː"},
        {"निरस्त्र", "nɪ.ɾəs.t̪ɾᵊ"},
        {"निर्वृत्त", "nɪɾ.ʋɾɪt̪t̪"},
        {"मृत्युंजय", "mɾɪt̪.jʊn.d͡ʒəj"},
        {"पितृओं", "pɪt̪.ɾõː"},
        {"गर्भ॰पात", "ɡəɾbʱ.pɑːt̪"},
        {"गर्भ", "ɡəɾbʱ"},
        {"वस्त्र", "ʋəs.t̪ɾᵊ"},
        {"यक्ष्मा", "jək.ʂmɑː"},
        {"उत्प्रेक्षा", "ʊt̪.pɾeːk.ʂɑː"},
        {"झुंझलाहट", "d͡ʒʱʊn.d͡ʒʱlɑː.ɦəʈ"},
        {"संख्या", "səŋ.kʰjɑː"},
        {"घुँघरू", "ɡʱʊŋ.ɡʱɾuː"},
        {"संभ्रांत", "səm.bʱɾɑːnt̪"},
        {"इन्फ़्लुएंज़ा", "ɪn.flʊ.eːn.zɑː"},
        {"इंफ़्लुएंज़ा", "ɪn.flʊ.eːn.zɑː"},
        {"हिमाचल प्रदेश", "/ɦɪ.mɑː.t͡ʃəl pɾə.d̪eːʃ/" },
        {"तंक़ीद", "[t̪ɐ̃ɴ.qiːd̪]", "anusvara before uvulars"},
        {
        	"चेरापूंजी",
        	"t͡ʃeː.ɾɑː.puːn.d͡ʒiː", nil,
    		"t͡ʃeː.ɾäː.pũːn.d͡ʒiː", "nasal allophone before postalveolar"
        },
	}
--[[	Copy the following to add more examples:
		{ "", "" },
]]
	
	tests:iterate(examples, "check_output")
end

return tests