Jump to content

Module:User:AmazingJus/tr/testcases

From Wiktionary, the free dictionary

3 of 0 tests failed. (refresh)

TextExpectedActualComments
test_phonemic:
Script error during testing: Module:User:AmazingJus/tr/testcases:28: attempt to call field 'phonemic' (a nil value)
stack traceback:
	[C]: in function 'phonemic'
	Module:User:AmazingJus/tr/testcases:28: in function 'func'
	Module:UnitTests:296: in function 'iterate'
	Module:User:AmazingJus/tr/testcases:66: in function <Module:User:AmazingJus/tr/testcases:51>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:896: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActualComments
test_phonetic:
Script error during testing: Module:User:AmazingJus/tr/testcases:37: attempt to call field 'phonetic' (a nil value)
stack traceback:
	[C]: in function 'phonetic'
	Module:User:AmazingJus/tr/testcases:37: in function 'func'
	Module:UnitTests:296: in function 'iterate'
	Module:User:AmazingJus/tr/testcases:84: in function <Module:User:AmazingJus/tr/testcases:69>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:896: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActualComments
test_sezer:
Script error during testing: Module:User:AmazingJus/tr/testcases:46: attempt to call field 'sezer' (a nil value)
stack traceback:
	[C]: in function 'sezer'
	Module:User:AmazingJus/tr/testcases:46: in function 'func'
	Module:UnitTests:296: in function 'iterate'
	Module:User:AmazingJus/tr/testcases:96: in function <Module:User:AmazingJus/tr/testcases:87>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:896: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

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

local function tagIPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
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