Jump to content

Module:new-IPA/testcases

From Wiktionary, the free dictionary

All tests passed. (refresh)

TextExpectedActualComments
test_phonetic:
Passedहलो (halo)[həlo][həlo]
Passedभाय् (bhæ)[bʱæː][bʱæː]
Passedछेँ (chẽ)[t͡ɕʰẽ][t͡ɕʰẽ]
Passedसर्गः (sarga:)[səɾɡəː][səɾɡəː]
Passedसँक्वः (sãkwa:)[sə̃kwɔː][sə̃kwɔː]
Passedप्याखं (pyākhaṃ)[pjakʰə̃ː][pjakʰə̃ː]
Passedनवःघाँय् (nawa:ghæ̃)[nəwɔːɡʱæ̃ː][nəwɔːɡʱæ̃ː]

local tests = require("Module:UnitTests")
local m_IPA = require("Module:new-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 = {
{ "हलो", "həlo" },
{ "भाय्", "bʱæː" },
{ "छेँ", "t͡ɕʰẽ" },
{ "सर्गः", "səɾɡəː" },
{ "सँक्वः", "sə̃kwɔː" },
{ "प्याखं", "pjakʰə̃ː" },
{ "नवःघाँय्", "nəwɔːɡʱæ̃ː" },
	}
tests:iterate(examples, "check_output")

end

return tests