Module:ko-pron/testcases

local tests = require('Module:UnitTests') local m = require('Module:ko-pron')

local corresp = { ['ph'] = 1, ['rr'] = 2, ['rrr'] = 3, ['mc'] = 4, ['yr'] = 5, ['ipa'] = 6, }

function tests:rom(system, text, expected, args) local rom = m.romanise(text, corresp[system], args or {}) rom = mw.ustring.toNFC(rom)

if system == 'ph' then -- simplify HTML for sanity rom = rom:gsub('', '') rom = rom:gsub('', '') end

return self:equals(system .. ': ' .. text .. '', rom, expected, {		show_difference = true,	}) end

function tests:test_rom -- SEE ALSO: Module:ko-translit/testcases self:rom('rr', '신라', 'silla')

self:rom('ph', '옛한글', '예(ː)탄글', {		['l'] = "y",	}) self:rom('ph', '세 명', '세(ː) 명', {		['l'] = "y",	}) self:rom('ipa', '쥐', '[t͡ɕɥi] ~ [t͡ɕy]') self:rom('ipa', '밤말은 쥐가 듣고 낮말은 새가 듣는다', '[pa̠mma̠ɾɯn t͡ɕɥiɡa̠ tɯt̚k͈o̞ na̠nma̠ɾɯn sʰɛɡa̠ tɯnnɯnda̠] ~ [pa̠mma̠ɾɯn t͡ɕɥiɡa̠ tɯt̚k͈o̞ na̠nma̠ɾɯn sʰe̞ɡa̠ tɯnnɯnda̠] ~ [pa̠mma̠ɾɯn t͡ɕyɡa̠ tɯt̚k͈o̞ na̠nma̠ɾɯn sʰɛɡa̠ tɯnnɯnda̠]')

-- preserve hyphens and preserve pronunciation self:rom('rr', '학교-에 가다', 'hakgyo-e gada') self:rom('rr', '비-가 오다', 'bi-ga oda') self:rom('rr', '밭-이 있다', 'bach-i itda') self:rom('rr', '말-을 듣다', 'mar-eul deutda') self:rom('rr', '빛-나다', 'bin-nada') self:rom('rr', '빛-이 나다', 'bich-i nada') self:rom('rr', '병-이 나다', 'byeong-i nada') self:rom('rr', '밖-에', 'bakk-e') self:rom('rr', "학교에 가다", "hakgyoe gada") self:rom('rr', "비가 오다", "biga oda") self:rom('rr', "밭이 있다", "bachi itda") self:rom('rr', "말을 듣다", "mareul deutda") self:rom('rr', "빛나다", "binnada") self:rom('rr', "빛이 나다", "bichi nada") self:rom('rr', "병이 나다", "byeong'i nada") self:rom('rr', "밖에", "bakke")

-- Module_talk:ko-pron self:rom('ph', '개', '개/게') self:rom('ph', '왜', '왜/웨') self:rom('ph', '걔', '걔/계/게')

-- Module_talk:ko-pron self:rom('ipa', '일 녠', '[iʎ ʎje̞n] ~ [iɭ ɭe̞n]') self:rom('ipa', '서울 날씨', '[sʰʌ̹uɭ ɭa̠ɭɕ͈i]')

-- Module_talk:ko-pron self:rom('yr', '산보', 'sānqpo', {		['l'] = "y",		['com'] = "1",	}) self:rom('yr', '학교', 'hak.kyo') self:rom('yr', '감다', 'kam.ta', {		['com'] = "1",		-- dependent on part-of-speech	}) end

return tests