Module:mn-IPA/testcases

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 ' /' .. IPA .. '/ '		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