Module:qhv-pron/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 6: Line 6:
end
end


local function linkup(text)
local function linkup(text, noresp)
return "[[Contionary:" .. text .. "#High Valyrian|" .. text .. "]]"
return "[[Contionary:" .. text .. "#High Valyrian|" .. text .. "]]"
end
end


function tests:check_output(term, expected)
function tests:check_output(term, expected, noresp)
return tests:equals(
return tests:equals(
linkup(term),
noresp and linkup(noresp) .. "<br>(" .. term .. ")" or linkup(term),
m_IPA.crux(term),
m_IPA.crux(term),
expected,
expected,
Line 33: Line 33:
{"valonqar", "vaˈloɴqar"},
{"valonqar", "vaˈloɴqar"},
{"Thoros", "ˈθoɾos"},
{"Thoros", "ˈθoɾos"},
{"arakh", "aˈɾax"},
{"arákh", "aˈɾáx", "arakh"},
{"ēngos", "ˈeːŋɡos"},
{"ēngos", "ˈeːŋɡos"},
{"amīvindigon", "amiːˈvindiɡon"},
{"amīvindigon", "amiːˈvindiɡon"},
Line 40: Line 40:
{"riña", "ˈriɲa"},
{"riña", "ˈriɲa"},
{"zirȳla", "ziˈɾyːla"},
{"zirȳla", "ziˈɾyːla"},
{"ipradis", "iˈpradis"},
{"rholagon", "ṛoˈlaɡon"},
}
}
self:iterate(list, "check_output")
self:iterate(list, "check_output")
Line 48: Line 50:
{"vējōñe", "veːˈjoːɲe"},
{"vējōñe", "veːˈjoːɲe"},
{"vōljes", "ˈwoːʎes"},
{"vōljes", "ˈwoːʎes"},
{"vumbiarzy", "ˈwumbi͜arzy"},
{"vumbiarzy", "wumˈbi͜arzy"},
{"vȳs", "ˈɥyːs"},
{"vȳs", "ɥyːs"},
{"ȳgha", "ˈyːɣa"},
{"ȳgha", "ˈyːɣa"},
{"vajie", "ˈɥaɟi͜e"},
{"vajie", "ˈɥaɟi͜e"},

Latest revision as of 14:55, 1 July 2021


All tests passed. (refresh)
Text Expected Actual
test_antique:
Passed vējōñe veːˈjoːɲe veːˈjoːɲe
Passed vōljes ˈwoːʎes ˈwoːʎes
Passed vumbiarzy wumˈbi͜arzy wumˈbi͜arzy
Passed vȳs ɥyːs ɥyːs
Passed ȳgha ˈyːɣa ˈyːɣa
Passed vajie ˈɥaɟi͜e ˈɥaɟi͜e
Passed vūjigon ˈwuːɟiɡon ˈwuːɟiɡon
Passed qrillaodikio qrilˈlao̯diki͜o qrilˈlao̯diki͜o
Text Expected Actual
test_modern:
Passed drakarys draˈkaɾys draˈkaɾys
Passed valonqar vaˈloɴqar vaˈloɴqar
Passed Thoros ˈθoɾos ˈθoɾos
Passed arakh
(arákh)
aˈɾáx aˈɾáx
Passed ēngos ˈeːŋɡos ˈeːŋɡos
Passed amīvindigon amiːˈvindiɡon amiːˈvindiɡon
Passed ojehiknon ojeˈhiknon ojeˈhiknon
Passed pōja ˈpoːja ˈpoːja
Passed riña ˈriɲa ˈriɲa
Passed zirȳla ziˈɾyːla ziˈɾyːla
Passed ipradis iˈpradis iˈpradis
Passed rholagon ṛoˈlaɡon ṛoˈlaɡon

local tests = require('Module:UnitTests')
local m_IPA = require('Module:qhv-pron')

local function IPA_style(IPA)
	return '<span style="font-size:110%;font-family:Gentium,\'DejaVu Sans\',\'Segoe UI\',sans-serif>' .. IPA .. '</span>'
end

local function linkup(text, noresp)
	return "[[Contionary:" .. text .. "#High Valyrian|" .. text .. "]]"
end

function tests:check_output(term, expected, noresp)
	return tests:equals(
		noresp and linkup(noresp) .. "<br>(" .. term .. ")" or linkup(term),
		m_IPA.crux(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:check_output2(term, expected)
	return tests:equals(
		linkup(term),
		m_IPA.antique_crux(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:test_modern()
	local list = {
		{"drakarys", "draˈkaɾys"},
		{"valonqar", "vaˈloɴqar"},
		{"Thoros", "ˈθoɾos"},
		{"arákh", "aˈɾáx", "arakh"},
		{"ēngos", "ˈeːŋɡos"},
		{"amīvindigon", "amiːˈvindiɡon"},
		{"ojehiknon", "ojeˈhiknon"},
		{"pōja", "ˈpoːja"},
		{"riña", "ˈriɲa"},
		{"zirȳla", "ziˈɾyːla"},
		{"ipradis", "iˈpradis"},
		{"rholagon", "ṛoˈlaɡon"},
	}
	self:iterate(list, "check_output")
end

function tests:test_antique()
	local list = {
		{"vējōñe", "veːˈjoːɲe"},
		{"vōljes", "ˈwoːʎes"},
		{"vumbiarzy", "wumˈbi͜arzy"},
		{"vȳs", "ɥyːs"},
		{"ȳgha", "ˈyːɣa"},
		{"vajie", "ˈɥaɟi͜e"},
		{"vūjigon", "ˈwuːɟiɡon"},
		{"qrillaodikio", "qrilˈlao̯diki͜o"},
	}
	self:iterate(list, "check_output2")
end

return tests