Jump to content

Module:mai-IPA/testcases

From Wiktionary, the free dictionary

All tests passed. (refresh)

TextExpectedActualComments
test_phonetic:
Passedआऒ (āo)[ɔ][ɔ]
Passedऒकरा (okᵊrā)[okᵊɾaː][okᵊɾaː]
Passedछन्हि (chanhɨ)[t͡ɕʰəɪnʱ][t͡ɕʰəɪnʱ]
Passedऎकरा (ekᵊrā)[ekᵊɾaː][ekᵊɾaː]
Passedओकरा (ōkᵊrā)[okᵊɾaː][okᵊɾaː]
Passedएकरा (ēkᵊrā)[ekᵊɾaː][ekᵊɾaː]
Passed (ǒ)[ɔ][ɔ]
Passed (ě)[ɛ][ɛ]
Passedकएल (kaēl)[kəeːl][kəeːl]
Passedकय़ल (kaël)[kæl][kæl]
Passedजाय़त (jāët)[d͡ʑæt][d͡ʑæt]
Passedकऎल (kael)[kæl][kæl]
Passedचारि (cārɨ)[t͡ɕaːɪɾ][t͡ɕaːɪɾ]
Passedचॏमुख (cǒmukh)[t͡ɕɔmʊkʰ][t͡ɕɔmʊkʰ]
Passedरवि (ravɨ)[ɾəɪb][ɾəɪb]

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

local function tag_IPA(IPA)
		if phonetic then
			IPA = '/' .. IPA .. '/'
		else
			IPA = '[' .. IPA .. ']'
		end
	return '<span class="IPA">' .. IPA .. '</span>'
end
function tests:check_output(term, expected, comment)
	self:equals(
		m_IPA.link(term),
		tag_IPA(m_IPA.toIPA(term, "standard")),
		tag_IPA(expected),
		{ comment = comment }
	)
end

function tests:test_phonetic()
	examples = {
	
{ "आऒ", "ɔ" },
{ "ऒकरा", "okᵊɾaː" },
{ "छन्हि", "t͡ɕʰəɪnʱ"},
{"ऎकरा", "ekᵊɾaː"},
{ "ओकरा", "okᵊɾaː" },
{"एकरा", "ekᵊɾaː"},
{ "ॵ", "ɔ"},
{ "ꣾ", "ɛ"},
{ "कएल", "kəeːl" },
{ "कय़ल", "kæl" },
{ "जाय़त", "d͡ʑæt" },
{ "कऎल", "kæl" },
{ "चारि", "t͡ɕaːɪɾ" },
{ "चॏमुख", "t͡ɕɔmʊkʰ" },
{ "रवि", "ɾəɪb" },

	}
tests:iterate(examples, "check_output")

end

return tests