Jump to content

Module:mn-IPA/testcases

From Wiktionary, the free dictionary

12 of 14 tests failed. (refresh)

TextExpectedActual
test_phonemic_IPA:
Failedсайн! (sajn!)/saiŋ!//ˈsɛːŋ!/
Failedсайн (sajn)/saiŋ//ˈsɛːŋ/
Failedавтобус (avtobus) respelled as "афто́бус"/afˈtʰɔpʊs//afˈtʰɔβʊs/
PassedБудда (Budda) respelled as "Будда́~"/pʊtˈta//pʊtˈta/
Passedтакси (taksi) respelled as "такси́~"/tʰakʰˈsi//tʰakʰˈsi/
Failedая (aja)/aj//ˈaj/
Failedай (aj)/ai//ˈɛː/
Failedцонх (conx)/t͡sɔŋx//ˈt͡sʰɔŋx/
Failedбайна (bajna)/pain//ˈpɛːn/
Failedэнэ (ene) respelled as "инэ"/in//ˈin/
Failedэнэ (ene)/in//ˈen/
Failedмонгол хэл (mongol xel) respelled as "мо́нгәл хил"/ˈmɔŋɡəɮ xiɮ//ˈmɔŋkəɮ xiɮ/
Failedмонгол хэл (mongol xel)/ˈmɔŋɡəɮ xiɮ//ˈmɔŋkɔɮ xeɮ/
Failedсайн байна уу (sajn bajna uu)/saim pain ʊː//ˈsɛːm pɛːn ʊː/

local tests = require 'Module:UnitTests'

local to_IPA = require 'Module:mn-IPA'.to_IPA

local mn = require 'Module:languages'.getByCode 'mn'
local full_link = require 'Module:links'.full_link
local function link(text)
	return full_link { term = text, lang = mn }
end

local tag_text = require 'Module:script utilities'.tag_text
local function tag(text)
	return tag_text(text, mn)
end

function tests:test_phonemic_IPA()
	local examples = {
		{ 'сайн!', 'saiŋ!' },
		{ 'сайн', 'saiŋ' },
		{ 'автобус', 'afˈtʰɔpʊs', 'афто́бус' }, -- saving a successfully implemented respelling example with a stress mark
		{ 'Будда', 'pʊtˈta', 'Будда́~' }, -- saving a successfully implemented respelling example with a stress mark
		{ 'такси', 'tʰakʰˈsi', 'такси́~' }, -- stress mark, irregular stress, should ~ be required if the syllable is the final syllable is stressed?
		{ 'ая', 'aj' },
		{ 'ай', 'ai' },
		{ 'цонх', 't͡sɔŋx' },
		{ 'байна', 'pain' }, -- final short vowel dropped
		{ 'энэ', 'in', 'инэ' }, -- forced Ulaanbaatar realisation of "э" as /i/, final short vowel dropped
		{ 'энэ', 'in' }, -- automatic Ulaanbaatar realisation of "э" as /i/, final short vowel dropped
		{ 'монгол хэл', 'ˈmɔŋɡəɮ xiɮ', 'мо́нгәл хил' }, -- with respelling, stress mark and shwa, forced Ulaanbaatar realisation of "э as /i/"
		{ 'монгол хэл', 'ˈmɔŋɡəɮ xiɮ'},	-- regular and predictable stress, vowel reduction (ə), automatic Ulaanbaatar realisation of "э" as /i/
		{ 'сайн байна уу', 'saim pain ʊː' }, -- predictable assimilation /n/ + /b/ or /p/ = /m.../
	}
	
	local options = {
		display = function (IPA)
			return '<span class="IPA">/' .. IPA .. '/</span>'
		end
	}
	self:iterate(examples, function (self, term, IPA, respelling)
		local term_display = link(term)
		
		if respelling then
			term_display = term_display .. ' respelled as "' .. tag(respelling) .. '"'
		end
		
		self:equals(term_display, to_IPA(respelling or term), IPA, options)
	end)
end

return tests