Module:qhv-pron/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
m (Sware moved page Module:qhv/testcases to Module:qhv-pron/testcases without leaving a redirect: Derp)
No edit summary
Line 21: Line 21:
function tests:test_example()
function tests:test_example()
local list = {
local list = {
{"drakarys", "draˈkarys"},
{"drakaɾys", "draˈkarys"},
{"valonqar", "vaˈloɴqar"},
{"valonqar", "vaˈloɴqar"},
{"Thoros", "ˈθoɾos"},
{"Thoros", "ˈθoɾos"},
{"arakh", "aˈɾax"},
{"aɾakh", "aˈɾax"},
{"ēngos", "ˈeːŋɡos"},
{"ēngos", "ˈeːŋɡos"},
{"amīvindigon", "amiːˈvindiɡon"},
{"amīvindigon", "amiːˈvindiɡon"},
Line 30: Line 30:
{"pōja", "ˈpoːja"},
{"pōja", "ˈpoːja"},
{"riña", "ˈriɲa"},
{"riña", "ˈriɲa"},
{"zirȳla", "ziˈryːla"},
{"ziɾȳla", "ziˈryːla"},
}
}
self:iterate(list, "check_output")
self:iterate(list, "check_output")

Revision as of 16:48, 7 February 2021


3 tests failed. (refresh)
Text Expected Actual
test_example:
Failed drakaɾys draˈkarys draˈkaɾys
Passed valonqar vaˈloɴqar vaˈloɴqar
Passed Thoros ˈθoɾos ˈθoɾos
Failed aɾakh aˈɾax ˈaɾax
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
Failed ziɾȳla ziˈryːla ziˈɾyːla

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)
	return "[[Contionary:" .. text .. "#High Valyrian|" .. text .. "]]"
end

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

function tests:test_example()
	local list = {
		{"drakaɾys", "draˈkarys"},
		{"valonqar", "vaˈloɴqar"},
		{"Thoros", "ˈθoɾos"},
		{"aɾakh", "aˈɾax"},
		{"ēngos", "ˈeːŋɡos"},
		{"amīvindigon", "amiːˈvindiɡon"},
		{"ojehiknon", "ojeˈhiknon"},
		{"pōja", "ˈpoːja"},
		{"riña", "ˈriɲa"},
		{"ziɾȳla", "ziˈryːla"},
	}
	self:iterate(list, "check_output")
end

return tests