Module:User:AmazingJus/tr/testcases

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

local function tagIPA(IPA) return ' ' .. IPA .. ' ' end

local function phonemic(IPA) return "/" .. IPA .. "/" end

local function phonetic(IPA) return "[" .. IPA .. "]" end

-- Convert a non-string value to a string representation, or do a series of -- functions to a string. local function display(arg) if type(arg) ~= "string" then return "(" .. tostring(arg) .. ")" end return tagIPA(phonetic(arg)) end

function tests:check_phonemic(example, expected) tests:equals(		example,		m_IPA.phonemic(example),		expected,		{ display = display }	) end

function tests:check_phonetic(example, expected) tests:equals(		example,		m_IPA.phonetic(example),		expected,		{ display = display }	) end

function tests:check_sezer(example, expected) tests:equals(		example,		m_IPA.sezer(example),		expected	) end

function tests:test_phonemic local examples = { { "ordu", "oɾˈdu" }, { "gâvur", "ɟaˈvuɾ" }, { "düğün", "dyˈɰyn" }, { "benim", "beˈnim" }, -- FIXME: Integrate the below to the module: { "benim", "ˈbe.nim" }, -- pos=pred { "Türkçe", "ˈtyɾk.t͡ʃe" }, -- pos=a { "nerede", "ˈne.ɾe.de" }, -- pos=adv { "sükûnet", "sy.cuːˈnet" }, -- long=1 { "iktisâden", "ic.tiˈsaː.den" }, -- pos=adv, -- long=1 { "kendi", "cenˈdi" }, -- e=1 { "seviyorum", "se.viˈjo.ɾum" }, -- pos=v { "Vaşington", "vaˈʃink.ton" }, -- pos=prop }	tests:iterate(examples, "check_phonemic") end

function tests:test_phonetic local examples = { { "ordu", "o̞ɾˈd̪ʊ" }, { "gâvur", "ɟɑˈβ̞uɾ̞̊" }, { "düğün", "d̪yˈɰ̟yn̪", "d̪yˈjyn̪" }, { "benim", "be̞ˈn̪im" }, { "benim", "ˈbe̞.n̪im" }, -- pos=pred { "Türkçe", "ˈt̪ʰyɾ̞̊k.t͡ʃɛ" }, -- pos=a { "nerede", "ˈn̪e̞.ɾe̞.d̪ɛ" }, -- pos=adv { "sükûnet", "s̪y.cʰuːˈn̪e̞t̪" }, -- long=1 { "iktisâden", "ic.t̪ʰiˈs̪ɑː.d̪æn̪" }, -- pos=adv, -- long=1 { "kendi", "cʰæn̪ˈd̪ɪ", "cʰe̞n̪ˈd̪ɪ" }, -- e=1 { "seviyorum", "s̪e̞.viˈjo̞.ɾum" }, -- pos=v { "Vaşington", "vɑˈʃiŋk.t̪ʰo̞n̪" }, -- pos=prop }	tests:iterate(examples, "check_phonetic") end

function tests:test_sezer local examples = { { "Vaşington", "vaşˈington" }, { "Ankara", "ˈankara" }, { "Oregon", "orˈegon" }, { "Ordu", "ˈordu" }, { "Edirne", "edˈirne" }, }	tests:iterate(examples, "check_sezer") end

return tests